Include("Includes/global.inc.php"); If ($btnSubmit) { $strEmail = validateEmail("Email Address", $txtEmail, TRUE); If (!$strError) { $strSQL = "SELECT id, userID FROM tblSecurity WHERE email='$strEmail'"; $result = dbquery($strSQL); $row = mysql_fetch_row($result); If ($row[0] == "") { $strError = "That email address does not exist in our database."; } If (!$strError) { $strTempString = "ABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; for ($i = 0; $i < 8; $i++) { $intPos = rand(0, 33); $strTempChar = substr($strTempString, $intPos, 1); $strPassword = $strPassword.$strTempChar; } $strPassword2 = md5($strPassword); $strSQL3 = "UPDATE tblSecurity SET password='$strPassword2' WHERE id=".$row[0]; $result3 = dbquery($strSQL3); $msgBody = "Your username is '".$row[1]."' and your temporary password is '$strPassword'."; mail($strEmail, "PMI password changed: ".date("m-d-Y"), $msgBody, "From: $adminEmail\r\nReply-To: $adminEmail\r\n"); $strError = "A new password has been emailed to the account you provided. "; $strError = $strError."You will be able to change this new, temporary password to "; $strError = $strError."whatever you wish after logging in."; } } } writeHeader("Forgot Your Password?"); declareError(TRUE); ?>
Please enter your email address below: