public static function forgot($uEmail) { global $database; $sAttempt = User::check_attempts("forgot password"); if (is_array($sAttempt)) { return $sAttempt; } $sAttempt = User::add_attempt("forgot password"); if ($sResult = $database->CachedQuery("SELECT * FROM accounts WHERE `email_address` = :EmailAddress", array('EmailAddress' => $uEmail))) { $sForgotCode = random_string(60); $sUser = new User($sResult->data[0]["id"]); $sUser->uForgot = $sForgotCode; $sUser->InsertIntoDatabase(); $sVariable = array("email" => urlencode($sUser->sEmailAddress), "forgot_code" => urlencode($sForgotCode)); $sSend = Core::SendEmail($sUser->sEmailAddress, "Feathur Forgot Password", "forgot", $sVariable); } if (!is_array($sSend)) { return $sResult = array("content" => "Check your email for an activation link.", "type" => "succesbox"); } else { return $sResult = array("content" => $sSend["content"], "type" => "alertbox"); } }