function forgotPasswordMessage($Email) { $conn = connectToDB(); $userSalt = GetSingleDbValue("SELECT `Salt` FROM `Users` WHERE `EmailAddress`='" . $Email . "'", $conn); if (!$userInfo) { $conn->close(); return false; } $password = createDefaultPassword(); $ExtraHash = hash("sha256", $password . $userSalt); CheckedQuery("UPDATE `Users` SET `ExtraHash`='" . $ExtraHash . "' WHERE `EmailAddress`='" . $Email . "'", $conn); $conn->close(); mail($Email, "LU Alumni Portal Password", "Your code for setting a new password is: " . $password . "\n\nIf you did not use the Forgot Password feature, then someone else has, and you should probably contact the Admin."); return; }
function makeSQL() { $Address = $this->Address . '; ' . $this->City . ' ' . $this->ZipCode; if (strlen($Address) <= 3) { $Address = NULL; } $this->Password = createDefaultPassword(); $PassInfo = saltPasswordForUpdate($Password); $this->SaltedHash = $PassInfo["SaltedHash"]; $this->Salt = $PassInfo["Salt"]; sanitizeIn($this->OldEmail); sanitizeIn($this->GradYear); sanitizeIn($this->FirstName); sanitizeIn($this->MiddleName); sanitizeIn($this->LastName); sanitizeIn($this->Email); sanitizeIn($Address); sanitizeIn($this->SaltedHash); sanitizeIn($this->Salt); if (isset($this->OldEmail) && (!isset($this->Email) || empty($this->Email))) { $this->Email = $this->OldEmail; } $sql1 = "INSERT INTO `Users` (EmailAddress"; $sql2 = " ('" . $this->Email . "'"; AddSQLPair($sql1, $sql2, "GradYear", $this->GradYear); AddSQLPair($sql1, $sql2, "FirstName", $this->FirstName); AddSQLPair($sql1, $sql2, "MiddleName", $this->MiddleName); AddSQLPair($sql1, $sql2, "LastName", $this->LastName); AddSQLPair($sql1, $sql2, "MailingAddress", $Address); AddSQLPair($sql1, $sql2, "OldEmail", $this->OldEmail); AddSQLPair($sql1, $sql2, "SaltedHash", $this->SaltedHash); AddSQLPair($sql1, $sql2, "Salt", $this->Salt); $sql1 = $sql1 . ") VALUES"; $sql2 = $sql2 . ")"; return $sql1 . $sql2; }