execute("
SELECT email, password, username
FROM arrowchat_admin
ORDER BY id ASC
LIMIT 1
");
$email = get_var('email');
if ($result AND $db->count_select() > 0)
{
$row = $db->fetch_array($result);
$password = $row['password'];
$activate_link = str_replace('forgot.php', 'activate.php?id=' . $password, $_SERVER['REQUEST_URI']);
$actual_link = "http://" . $_SERVER['HTTP_HOST'] . $activate_link;
if (strtolower($email) == strtolower($row['email']))
{
$to = $row['email'];
$username = $row['username'];
// Your subject
$subject="ArrowChat Reset Admin Password";
// Your message
$message="
Hi ArrowChat User!
";
$message.="Someone has requested that your password be reset for the administration panel. You can click on the link below to begin the reset proccess.
";
$message.="Your username is " . $username . "
";
$message.= '' . $actual_link . '
';
$message.="Best Regards,
";
$message.="ArrowChat Team";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$to.'' . "\r\n";
$headers .= "X-Mailer: php";
mail($to, $subject, $message, $headers);
$msg = "The password reset link has been sent to your email.";
}
else
{
$error = "That is not the correct email address.";
}
}
else
{
$error = "There was a database error. Please reinstall ArrowChat.";
}
}
$smarty = new Smarty;
// Process Smarty template
$smarty->assign('email', $email);
$smarty->assign('error', $error);
$smarty->assign('msg', $msg);
$smarty->display(dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout/pages_forgot.tpl");
?>