| Author |
Message |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Oct 31, 2003 10:24 pm |
|
Here is a utility script to allow you to reset an Admin's password without using phpMyAdmin. | Code: | <?
/***********************************************************/
/* Just set $adminNameToReset to the admin name to reset */
/* and save this file. Call it anything you want, like */
/* ResetPassword.php. Then ftp it to the same folder where*/
/* mainfile.php is stored. Then point your browser to the */
/* file. The password for that admin will be changed to */
/* Password (note the capital P), by default. Then, */
/* immediately log in and change your password!!! You */
/* should then delete or rename this file!! */
/* You can also change the password to something other than*/
/* Password by changing $newAdminPassword */
/***********************************************************/
/* Author: Gaylen Fraley (Raven) 10/31/2003 */
/***********************************************************/
$adminNameToReset = '???';
$newAdminPassword = 'Password';
/***********************************************************/
/* You do not need to change anything below this line. */
/***********************************************************/
include("mainfile.php");
$sql = "Select aid from ".$user_prefix."_authors where aid='$adminNameToReset'";
$result = sql_query($sql,$dbi);
if (!sql_num_rows($result)) {
$mysqlError = mysql_error();
if (empty($mysqlError)) $mysqlError = "<b>$adminNameToReset</b> appears to be an invalid user name.<br /><br />No updates have been made.";
else $mysqlError = 'Unable to execute query.<br /><br />MySQL said <b>'.$mysqlError.'</b>.';
die($mysqlError);
}
$sql = "Update ".$user_prefix."_authors set pwd='".md5($newAdminPassword)."' where aid='$adminNameToReset'";
$result = sql_query($sql,$dbi);
echo "Update successful!<br /><br />Your password has been changed to <b>$newAdminPassword</b>.<br /><br />Log in and immediately change it to protect your site!<br /><br />Also, be sure to remove this file or rename it!";
?> |
|
|
|
|
 |
Roy_Shiker Hangin' Around

Joined: Dec 27, 2003 Posts: 45
|
Posted:
Sat Dec 27, 2003 7:33 pm |
|
Good Script, Thanks !.  |
|
|
|
 |
Toph New Member


Joined: Jan 31, 2004 Posts: 3
|
Posted:
Sat Jan 31, 2004 8:34 am |
|
I changed the admin password by hand but it didn't work. Excellent script you wrote, gonna come in handy, but - I still get the 'Begone' message.
Now, why is that? |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sat Jan 31, 2004 9:41 am |
|
When you change the password by hand, using phpMyAdmin for instance, you have to also select the MD5 option from the drop down box beside the password before you save it.
You are probably receiving that Begone message because the username is not matching a valid author name in the nuke_authors table. Usernames can only contain a-zA-Z0-9_- . |
|
|
|
 |
Toph New Member


Joined: Jan 31, 2004 Posts: 3
|
Posted:
Sat Jan 31, 2004 9:50 am |
|
That must be it, I used brackets as the community members wear tags. Cheers  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sat Jan 31, 2004 10:21 am |
|
That can easily be modified if you need to. In auth.php and modules/Your_Account/index.php the changes involve just 1 line. In auth.php modify this line | Code: | | if (ereg("[^a-zA-Z0-9_-]",trim($aid))) | to | Code: | | if (ereg("[^a-zA-Z0-9_-\[\]]",trim($aid))) |
Then in modules/Your_Account/index.php modify this line | Code: | | if ((!$username) || ($username=="") || (ereg("[^a-zA-Z0-9_-]",$username))) | to | Code: | | if ((!$username) || ($username=="") || (ereg("[^a-zA-Z0-9_-\[\]]",$username))) |
If you come across any other name checks, just modify them the same way. |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Aug 12, 2005 7:53 pm |
|
This is just a reminder for the new people and the old ones that can't remember  |
|
|
|
 |
cyptc New Member


Joined: Aug 16, 2005 Posts: 6
|
Posted:
Tue Aug 16, 2005 11:38 am |
|
Topic edited as has no relevance |
Last edited by cyptc on Mon May 17, 2010 10:18 pm; edited 1 time in total |
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Tue Aug 16, 2005 12:48 pm |
|
There is no redirection. You save the file and load/ftp that file up and then point your browser to it. Follow the prompts. |
|
|
|
 |
cyptc New Member


Joined: Aug 16, 2005 Posts: 6
|
Posted:
Tue Aug 16, 2005 1:38 pm |
|
Topic edited as has no relevance |
Last edited by cyptc on Mon May 17, 2010 10:18 pm; edited 1 time in total |
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Tue Aug 16, 2005 2:36 pm |
|
|
|
 |
infinity8x3 New Member


Joined: Jul 28, 2006 Posts: 1
|
Posted:
Fri Jul 28, 2006 8:27 am |
|
wow Raven that pass script saved my but big time when i tryed to change the god account pass in edit admins it said info saved but then when i tryed to log in as admin my new pass or old pass didnt work i thought i was screwed and would have to delete the database table nuke_aurthers but this script tottaly worked right the first time your knowlage of php is great and thanks for being so important to the nuke comunity |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Jul 28, 2006 8:48 am |
|
|
|
 |
bugsTHoR Involved


Joined: Apr 05, 2006 Posts: 252
|
Posted:
Fri Apr 27, 2007 5:11 pm |
|
thx Amigo, i luv your search box lol |
|
|
|
 |
nagahosting Regular


Joined: Nov 03, 2007 Posts: 52 Location: Nagalim
|
Posted:
Thu Jan 24, 2008 1:06 pm |
|
Very handy thanks Raven
 |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Jan 24, 2008 1:09 pm |
|
You're welcome  |
|
|
|
 |
|
|
|
|