Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Matthew K. in März 09, 2011, 02:01:05 VORMITTAG

Titel: [Trick] Administrate Yourself
Beitrag von: Matthew K. in März 09, 2011, 02:01:05 VORMITTAG
I know I made a topic for this a while ago, but things have changed enough, that I decided to just start a new topic.

A long time ago, I decided to make a script for people who needed to administrate themselves, if they lost their main account, or for some reason it was un-administered..

I decided it was finally time to update it, so here it is.

Here are the features I worked in to this version.

Note: This does not work on XAMPP if you don't have a password setup, sorry Ha2. :P

Right now, it only will work with the SMF 2.0 series, and has validation to stop it from being run on SMF 1.1x series.

Although I wrote this version with the mindset of eventually backporting it to 1.1x.

Screenshots and zip attached.

To use, simply download "administrate.php" and upload it to the same directory as your forums SSI.php, then visit in your browser.

Enjoy,
Labradoodle-360
Titel: Re: [Trick] Administrate Yourself
Beitrag von: texasman1979 in März 09, 2011, 09:21:47 VORMITTAG
Just to double check, does this check to see if the account was at one time an admin? How would it prevent a would be hacker from gaining access? Or is it like install.php, intended to be removed after use?
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Arantor in März 09, 2011, 09:23:12 VORMITTAG
It requires the database password, which it checks for.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: texasman1979 in März 09, 2011, 09:29:17 VORMITTAG
Ah kk. Sounds like a pretty good deal. Lab you come up with some pretty good stuff. :) maybe i can get you to check my site out and me some thoughts, maybe we can put our heads together on something sometime.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in März 09, 2011, 11:28:27 VORMITTAG
Sure, feel free to shoot me a pm.

Moved to Tips and Tricks (http://www.simplemachines.org/community/index.php?board=72.0) :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: kat in März 09, 2011, 01:21:17 NACHMITTAGS
Useful for people who don't have an emergency admin account, I'd imagine. :)

Always the first thing I do, when I start a forum, that.

Make myself another admin account.

Hmmm... Thinking about it, I might just suggest that as a future feature. :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Arantor in März 09, 2011, 01:23:08 NACHMITTAGS
I'd actually discourage having more admin accounts than necessary... no point in having two separate accounts that can be brute-forced, it's more points of failure.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in März 09, 2011, 01:23:23 NACHMITTAGS
There's no need to with this script :P All you have to do is know the database password.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: kat in März 09, 2011, 01:38:47 NACHMITTAGS
Fairy nuff! :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: DoctorMalboro in März 09, 2011, 05:24:18 NACHMITTAGS
I've always wonder why SMF let administrators delete their own account, I mean, all permissions shouldn't always mean ALL permissions.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: NanoSector in März 09, 2011, 05:34:27 NACHMITTAGS
Zitat von: DoctorMalboro in März 09, 2011, 05:24:18 NACHMITTAGS
I've always wonder why SMF let administrators delete their own account, I mean, all permissions shouldn't always mean ALL permissions.
Lol, good point.

And nice script. Might use it when I am being stupid again and I remove my admin rights (again :P).
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in März 09, 2011, 05:36:45 NACHMITTAGS
This might sound quite contradicting to the purpose of this script, but during development of 1.0, I made a script called "unadministrate.php" which actually does the opposite of this, except it was very crude, with no validation whatsoever. :P
Titel: Re: [Trick] Administrate Yourself
Beitrag von: DoctorMalboro in März 10, 2011, 06:31:22 NACHMITTAGS
I would call it "New admin account for morons", but it would be to harsh :P
Titel: Re: [Trick] Administrate Yourself
Beitrag von: ysNoi in August 14, 2011, 02:46:55 VORMITTAG
Hi...

I forgot my Administrator password. I tried to upload administrate.php file as instructed above but I could not get to the "Administrate Yourself" page...
Can someone help me please...

Thanks,
ysNoi
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in August 14, 2011, 02:54:48 VORMITTAG
Administrate Yourself does not recover an admin password.

It would allow you to create a new account, and then run this file, to make that account an administrator however.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Shadow Queen in September 06, 2011, 11:08:31 NACHMITTAGS
Sound a good idea to use.  In cause it something happen like this.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Hj Ahmad Rasyid Hj Ismail in September 12, 2011, 10:13:23 NACHMITTAGS
Nice job. I think it should be integrated with repair_settings.php. But standalone is also nice.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in September 12, 2011, 11:05:23 NACHMITTAGS
I personally prefer it standalone, although in my opinion repair_settings.php needs a re-write too. So you never know.

Maybe combine a bunch of scripts together into a new section and name it "tools.php" or something.

If I were to re-write this, I would allow you to also create a new account, I saw somewhere that was the case for some, that they couldn't even create a new account, it'd be simple to add too.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Hj Ahmad Rasyid Hj Ismail in September 13, 2011, 12:06:11 VORMITTAG
Indeed. Creating a new account is also important especially with your tricks. I can't imagine how they're going to use this trick when they don't have a user account and can't create a new one.

I really think that SMF should create a protection to all admin account where it either cannot be deleted at all or can be deleted only by superadmin (preferably only one superadmin user and prerably only user #1 to avoid conflict).
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in September 13, 2011, 11:04:45 VORMITTAG
It somewhat does, you cannot delete the Administrator if it's the only admin account, so really, there has to be one base admin.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Shadow Queen in September 13, 2011, 02:11:28 NACHMITTAGS
When this happen? I can just log into the cpanel and upload the file. whatever this topic said to do?
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in September 13, 2011, 02:12:38 NACHMITTAGS
What do you mean? Not a very clear post.
Zitat von: Shadow Queen in September 13, 2011, 02:11:28 NACHMITTAGS
When this happen? I can just log into the cpanel and upload the file. whatever this topic said to do?
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Branko. in September 13, 2011, 02:57:11 NACHMITTAGS
Zitat von: Shadow Queen in September 13, 2011, 02:11:28 NACHMITTAGS
When this happen? I can just log into the cpanel and upload the file. whatever this topic said to do?
Labradoodle-360 is always precise when explaining something....   ;D  Read the first post again
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Shadow Queen in September 13, 2011, 04:33:11 NACHMITTAGS
I mean when this happen to the main account holder of the forum. You just upload the file to the same place as the SSI.php file?

Sorry, It's was my faulth about the unclear post I made :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in September 13, 2011, 04:37:38 NACHMITTAGS
When anyone who has the database password needs their account administrated, they can use this file in the same directory as SSI.php.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Shadow Queen in September 13, 2011, 05:28:31 NACHMITTAGS
Oh ok.

When that happen I just do what I needed to do.

And the main account holder become admin.

Neat tick
Titel: Re: [Trick] Administrate Yourself
Beitrag von: ~Dragon~ in Oktober 21, 2011, 04:20:35 NACHMITTAGS
Good Job I learn it :D
Titel: Re: [Trick] Administrate Yourself
Beitrag von: cicka in August 11, 2012, 12:35:20 NACHMITTAGS
Sorry to bump this old topic but I wanted to say thank you to Labradoodle-360 for this script. I learned a few things simply by reading the code.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in August 11, 2012, 01:09:33 NACHMITTAGS
No problem, and wow, I take that as a big compliment from you, thank you for the kind words! :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: cicka in August 11, 2012, 01:33:29 NACHMITTAGS
Zitat von: Labradoodle-360 in August 11, 2012, 01:09:33 NACHMITTAGS
No problem, and wow, I take that as a big compliment from you, thank you for the kind words! :)

You are very welcome :)
Titel: Re: [Trick] Administrate Yourself
Beitrag von: DEANO3528 in Januar 08, 2014, 04:38:16 NACHMITTAGS
REally sorry to bump this after so long, but I've read this and not being a super-whizz with the tech stuff, I wanted to ask a question:
Does this trick only work once administration rights have been removed/lost?
I have uploaded it to the correct directory (same as SSI.php) but nothing happened. So I wondered if I don't actually install it unless I already lost admin rights?
Sorry again for the idiot question and bump.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Matthew K. in Januar 08, 2014, 04:50:18 NACHMITTAGS
Not a problem. This is in case you lose your administration rights. It just modifies your id_group in the database automatically for you.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: DEANO3528 in Januar 08, 2014, 06:36:11 NACHMITTAGS
Ok many thanks for that. I will delete until it might be needed.
Really wish SMF would auto-protect #1 member, but hey-ho.
Titel: Re: [Trick] Administrate Yourself
Beitrag von: Arantor in Januar 08, 2014, 06:38:58 NACHMITTAGS
Protect it against what, exactly? SMF won't let you remove group 1 from any member unless the person doing it is also in group 1, and it won't let you remove group 1 from a user if that user is the only group 1 user. What's left to protect?

On the other hand, what happens if you leave the forum and sell it on? If user 1 is auto protected, that option becomes impossible.