{ if ($_REQUEST["email"]=="") { $siteError->add($LANG->l('Forgot password: Email required'), "error"); } if ($_REQUEST["username_email"]!="") { $siteError->add($LANG->l('Forgot password: Spam'), "error"); } if ($_REQUEST["email"]!="") { $sql = "SELECT * FROM `".DB_PREFIX."users` WHERE `email`='".$_REQUEST['email']."'"; $user = $DB->get($sql); if ($user["id"]=="") { $siteError->add($LANG->l('Forgot password: User doesn\'t exist'), "error"); } else { $test = "email"; } } if (!$siteError->hasErrors()) { $newpass = generatePassword(); $wherestr = " `id`='".$user['id']."' "; $message = $LANG->l('Your new %s password for the account %s with the email %s is: %s ', array('p1' => SITE_NAME, 'p2' => $user['username'], 'p3' => $user['email'], 'p4' => $newpass)); $res = $DB->query("UPDATE `".DB_PREFIX."users` SET `password`=MD5('".$newpass."') WHERE $wherestr "); $siteError->add($LANG->l('Password has been sent'), "success"); $test = send_mail($user[email], EMAIL_FROM, $LANG->l('[%s] forgot password', array('p1' => SITE_NAME)), $message, EMAIL_REPLY_TO); } } function generatePassword ($length = 8) { // start with a blank password $password = ""; // define possible characters $possible = "0123456789bcdfghjkmnpqrstvwxyz"; // set up a counter $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } } // done! return $password; } ?> Free iPad Wallpaper - Updated Daily - Free wallpapers
search
friends
partners
resolutions

forgot password



Register | Login
login
categories
statistics
  • Total Wallpapers: 2319
  • Total Categories: 5
  • Total Users: 339
  • Total Comments: 25
users online
  • Total Users:22