【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:forgot.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?PHP
// 获取用户名和信箱
$username1 = @$HTTP_POST_VARS["username"];
$mailadres1 = @$HTTP_POST_VARS["mailadres"];
//包含文件
include("config.php");
// 检查管理员是否允许取回密码
if ($AllowForgotPassword == false){die($disabledFeatures);}
// 检查用户名和电子邮件是否正确
$query = "Select * from ".$DBprefix."signup where username='$username1' And mailadres='$mailadres1'";
$result = my
sql_query($query);
// 如果正确,则获取密码发送到客户端
if ($row =
mysql_fetch_array($result)){
$message = $message_forgot_password;
$message = str_replace("%p",$row["password"], $message);
$message = str_replace("%a","%", $message);
mail($mailadres1, $title_forgot_pass
word, $message, $email_message_header);
//显示密码被发送成功的信息
echo "The password has been send to your e-mailades. You should recieve it within a couple of minutes.<br><a href=\"login.php\">back to log-in page</a>";
}
else{
//如果用户名和电子邮件错误
if ($username1 == ""){makeform();}
else
// 显示错误提示信息
{makeform($incorrectUserMailaders);}
}
// 创建发送密码的表单
function makeform($errormessage=""){
?>
<html>
<head>
<title>Forgot password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>找回密码</h1>
<form name="form1" method="post" action="forgot.php">
<a href="login.php">返回登录页面</a><br>
<?
PHP // print the error message
echo "<font color=\"#FF0000\"><strong>$errormessage</strong></font><br>"; ?>
用户名:
<input type="text" name="username">
<br>
E_Mail:
<input type="text" name="mailadres">
<br>
<input type="submit" value="发送密码">
</form>
</body>
</html>
<?PHP } ?>