';
if (isset($_POST['email']))
{
echo $instructions;
$email = isset($_POST['email']) ? $_POST['email'] : "";
$user = fs_get_user_by_email($email);
if ($user === null)
{
echo "
".fs_r("A user with this username and email was not found")."
";
}
else
if (is_object($user))
{
$ok = fs_session_start();
if ($ok !== true)
{
$msg = "Error starting session";
if (is_string($ok)) $msg .= " :$ok";
$msg .= "
";
echo $msg;
return false;
}
global $FS_SESSION;
$FS_SESSION['user'] = $user;
fs_store_session();
$sid = fs_get_session_id();
$headers = "Content-Type: text/html; charset=\"UTF-8\"\r\n";
$headers .= "MIME-Version: 1.0 ";
$subject = "=?UTF-8?B?".base64_encode(fs_r("FireStats members area password recovery"))."?=";
$msg = sprintf(fs_r("Click %s to change your password, this link will work for a short time"), fs_link(fs_get_absolute_url($_SERVER['REQUEST_URI']."?reset&sid=$sid"),fs_r("here"), true));
$res = mail($email, $subject, $msg, $headers);
if ($res === true)
{
echo "
".fs_r("Email sent")."
";
}
else
{
echo "
".fs_r("Failed to send email")."
";
}
}
else
{
echo "
".$user."
";
}
?> ".sprintf(fs_r("Failed, maybe too much time have passed since you generated the email? %s"),fs_link("reset-password.php",fs_r("try again")))."
";
}
else
{
?>