Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Poll
Worthwhile?
Yes
100%
 100%  [ 17 ]
No
0%
 0%  [ 0 ]
Total Votes : 17


Author Message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Fri Oct 31, 2003 10:24 pm Reply with quote

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!";
?>
 
View user's profile Send private message
Roy_Shiker
Hangin' Around



Joined: Dec 27, 2003
Posts: 45

PostPosted: Sat Dec 27, 2003 7:33 pm Reply with quote

Good Script, Thanks !. Wink
 
View user's profile Send private message Send e-mail
Toph
New Member
New Member



Joined: Jan 31, 2004
Posts: 3

PostPosted: Sat Jan 31, 2004 8:34 am Reply with quote

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?
 
View user's profile Send private message
Raven







PostPosted: Sat Jan 31, 2004 9:41 am Reply with quote

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







PostPosted: Sat Jan 31, 2004 9:50 am Reply with quote

That must be it, I used brackets as the community members wear tags. Cheers Smile
 
Raven







PostPosted: Sat Jan 31, 2004 10:21 am Reply with quote

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







PostPosted: Fri Aug 12, 2005 7:53 pm Reply with quote

This is just a reminder for the new people and the old ones that can't remember ROTFL
 
cyptc
New Member
New Member



Joined: Aug 16, 2005
Posts: 6

PostPosted: Tue Aug 16, 2005 11:38 am Reply with quote

Topic edited as has no relevance


Last edited by cyptc on Mon May 17, 2010 10:18 pm; edited 1 time in total 
View user's profile Send private message
Raven







PostPosted: Tue Aug 16, 2005 12:48 pm Reply with quote

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







PostPosted: Tue Aug 16, 2005 1:38 pm Reply with quote

Topic edited as has no relevance


Last edited by cyptc on Mon May 17, 2010 10:18 pm; edited 1 time in total 
Raven







PostPosted: Tue Aug 16, 2005 2:36 pm Reply with quote

[ Only registered users can see links on this board! Get registered or login! ]
 
infinity8x3
New Member
New Member



Joined: Jul 28, 2006
Posts: 1

PostPosted: Fri Jul 28, 2006 8:27 am Reply with quote

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
 
View user's profile Send private message
Raven







PostPosted: Fri Jul 28, 2006 8:48 am Reply with quote

RavensScripts
 
bugsTHoR
Involved
Involved



Joined: Apr 05, 2006
Posts: 263

PostPosted: Fri Apr 27, 2007 5:11 pm Reply with quote

thx Amigo, i luv your search box lol

_________________
LUV RAVEN DISTROBUTION BEBE

Clanthemes.com are great (free advertisements for now until i get to 20,000 posts LoL) 
View user's profile Send private message
nagahosting
Regular
Regular



Joined: Nov 03, 2007
Posts: 52
Location: Nagalim

PostPosted: Thu Jan 24, 2008 1:06 pm Reply with quote

Very handy thanks Raven Smile


RavensScripts

_________________
Blessed Is He Who Comes In The Name Of The Lord 
View user's profile Send private message Visit poster's website
Raven







PostPosted: Thu Jan 24, 2008 1:09 pm Reply with quote

You're welcome Wink
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©