Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
kwality
Client



Joined: Dec 12, 2003
Posts: 35

PostPosted: Mon Aug 09, 2004 9:34 pm Reply with quote

I dont know if this is possible, but if somone could make a script that clears all nuke users passwords, randomly generates them and emails them then generated password

Id pay for it.. Laughing
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Tue Aug 10, 2004 12:18 am Reply with quote

Please donate what you think this script is worth to you Wink

Code:
<?

/********************************************************************/
/* Script Name  : passmaker.php                                     */
/* Author       : Gaylen Fraley (aka Raven)                         */
/* License      : Private. For personal use only. Use at your own   */
/*                risk.  I am not responsible for any damage caused */
/*                by the use or misuse of this script.  You may use */
/*                it but may not distribute it.                     */
/* Purpose      : To reset all passwords in the nuke users database */
/*                and to send an email to the user advising of the  */
/*                new password.                                     */
/* Date Released: 8/10/2004                                         */
/* Version      : 1.0.0                                             */
/********************************************************************/
/* USAGE NOTES  : Pretty self-explanatory.  To test the script set  */
/* $test = TRUE and $testUser = "A REAL USER NAME". The script will */
/* only use that record to act upon. The rest of the settings should*/
/* be self explanatory. {USERNAME} and {NEWPASSWORD} are NOT to be  */
/* changed.  The script will auto fill those settings.              */
/*                                                                  */
/* PLEASE BE SURE TO BACKUP YOUR USERS TABLE BEFORE RUNNING THIS!   */
/********************************************************************/

/////////////////////////
// Configurable Settings
/////////////////////////
$test        = FALSE;
$testUser    = 'USER';
$subject     = "You Have a New Password!";
$fromAddress = 'YOU@YOURDOMAIN.COM';
$siteURL     = "YOURDOMAIN.COM";

$message = "{USERNAME},\n\n"
      ."Your old password at http://$siteURL has been purposely expired for security reasons.\n"
      ."Your new password is ==> {NEWPASSWORD} <==. Please login to this site as soon as possible and verify your new password.\n\n"
      ."Sincerely,\n\n"
      ."The Management at $siteURL"
      ;
/////////////////////////
/////////////////////////

////////////////////////////////////////////////////////
// DO NOT MODIFY ANYTHING BELOW THIS LINE!!!!
////////////////////////////////////////////////////////
function makePass() {
    $cons = "bcdfghjklmnpqrstvwxyz";
    $vocs = "aeiou";
    for ($x=0; $x < 6; $x++) {
   mt_srand ((double) microtime() * 1000000);
   $con[$x] = substr($cons, mt_rand(0, strlen($cons)-1), 1);
   $voc[$x] = substr($vocs, mt_rand(0, strlen($vocs)-1), 1);
    }
    $makepass = $con[0] . $voc[0] .$con[2] . $con[1] . $voc[1] . $con[3] . $voc[3] . $con[4];
    return($makepass);
}
include('config.php');
$db = @mysql_connect('localhost',$dbuname,$dbpass) or die('Unable to connect to MySQL server. MySQL said: '.mysql_error());
@mysql_selectdb($dbname) or die('Unable to connect to database. MySQL said: '.mysql_error());
$sql = "SELECT user_id, username, user_email FROM ".$prefix."_users WHERE user_id >1 AND user_active='1'";
if ($test) $sql .= " and username='".$testUser."';";
else $sql .= ';';
$result = @mysql_query($sql) or die('Unable to execute query. MySQL said: '.mysql_error());
$mailLog = '';
$errorLog = '';
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
   extract($row);
   $newPass = makePass();
   $msg = str_replace("{USERNAME}",$username,$message);
   $msg = str_replace("{NEWPASSWORD}",$newPass,$msg);
   $attemptMail = @mail($user_email, $subject, $msg, "From: ".$fromAddress."\n");
   if ($attemptMail) {
      $sql = "UPDATE ".$prefix."_users SET user_password='".md5($newPass)."' WHERE user_id = $user_id;";
      $result = @mysql_query($sql) or die('Unable to update record for '.$username.'. MySQL said: '.mysql_error()."<br />Script aborted<br /><br />The following users were sent email and their passwords have been reset:<br />".$mailLog);
      $mailLog .= $username." - ".$user_email."<br />";
   }
   else $errorLog .= $username." - ".$user_email."<br />";
}
if (!empty($mailLog)) echo "The following users were sent email and their passwords have been reset:<br />".$mailLog;
if (!empty($errorLog)) echo "The script was unable to send emails to the following users:<br />".$errorLog;
mysql_free_result($result);
mysql_close();
?>
 
View user's profile Send private message
kwality







PostPosted: Tue Aug 10, 2004 3:13 pm Reply with quote

Wow, i <3 that script, and i will donate kaching!.

But i think my problem is beyond that.

I logged in with my new pass, and then changed it. But it stays set with the 'random password'.

Is there a way to alter the your account, so it actually holds the changed password?
 
Raven







PostPosted: Tue Aug 10, 2004 3:35 pm Reply with quote

It does. I tested it and it works just fine here.
 
kwality







PostPosted: Tue Aug 10, 2004 8:56 pm Reply with quote

Well the site i need it for, was the convresion of vB.

The script worked fine, but in my profile, password changes are not working.

I used the converter from the link you gave me a while go, and i transfered to a clean phpbb install. I then make a backup of that and uploaded it into the nuke site

But in the phpbb forums, users passwords etc., work.

this is not the case with my test site

Im starting to think its hopless Bang Head

Any final thoughts, im close to giving up.

I just dont understand why it worked in the phpbb standalone but not the nuke version (both of which were 2.0.6)

So i dont know..
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

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 ©