📄 getpwd4.php
字号:
<?php
$username = "";
$password = "";
$email = "";
$mode = "";
$message = "";
if ( !isset ( $_SESSION ) ) {
session_start();
$username = $_SESSION["username"];
$password = $_SESSION["password"];
$email = $_SESSION["email"];
}
if ( isset ( $_POST["radMode"] ) ) {
$mode = $_POST["radMode"];
}
if ( $mode == "email" ) {
require("inc/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.126.com;smtp.sina.com.cn"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "zmzhao"; // SMTP username
$mail->Password = "123456"; // SMTP password
$mail->From = "zmzhao@126.com";
$mail->FromName = "赵增敏";
$mail->AddAddress( $email, $username );
$mail->CharSet = "GB2312"; // 这里指定字符集!
$mail->Encoding = "base64";
$mail->Subject = "会员密码";
$body = sprintf ( "<p>尊敬的%s用户:<p>您的密码是<b>%s</b></p>\n", $username, $password );
$mail->Body = $body;
$mail->AltBody = sprintf ( "尊敬的%s用户:\n您的密码是%s。", $username, $password );
if( $mail->Send() )
$message = "密码已发送到您的电子信箱中,请查收。";
else
$message = "<font color=\"red\">邮件发送失败!</font>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>找回密码</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include( "menu.php"); ?>
<br />
<?php if ( $mode == "web" ) { ?>
<table width="260" border="1" align="center">
<tr>
<th bgcolor="#0066CC" class="title" scope="col">找回密码</th>
</tr>
<tr>
<td height="56" align="center">您的密码是:<?php echo $password; ?></td>
</tr>
</table>
<?php } ?>
<?php if ( $mode == "email" ) { ?>
<table width="260" border="1" align="center">
<tr>
<th bgcolor="#0066CC" class="title" scope="col">找回密码</th>
</tr>
<tr>
<td height="56" align="center"><?php echo $message; ?></td>
</tr>
</table>
<?php } ?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -