<?php
include_once 'conn/conn.php';
require_once 'Zend/Mail.php'; //调用发送邮件的文件
require_once 'Zend/Mail/Transport/Smtp.php'; //调用SMTP验证文件
$reback = '0';
$name = $_GET['foundname'];
$question = $_GET['question'];
$answer = $_GET['answer'];
$sql = "select email from tb_member where name = '".$name."' and question = '".$question."' and answer = '".$answer."'";
$email = $conne->getFields($sql,0);
if($email != ''){
$rnd = rand(1000,time());
$sql = "update tb_member set password = '".md5($rnd)."' where name = '".$name."' and question = '".$question."' and answer = '".$answer."'";
$tmpnum = $conne->uidRst($sql);
if($tmpnum >= 1){
//发送密码邮件
$subject="找回密码";
$mailbody='密码找回成功。您帐号的新密码是'.$rnd;
$envelope["from"]="cym3100@163.com";
//$envelope="mrsoft8888@sohu.com"; //网络版定义登录使用的邮箱
/* smtp测试版发送邮件方式,使用smtp作为服务器*/
$tr = new Zend_Mail_Transport_Smtp('192.168.1.247');
$mail = new Zend_Mail();
$mail->addTo($email,'获取用户新密码');
$mail->setFrom('cym3100@163.com','明日科技典型模块程序测试邮箱,修改用户注册密码!');
$mail->setSubject($subject);
$mail->setBodyHtml($mailbody);
//$mail->send($tr);
/* 网络版发送邮件方法 */
/*$config = array('auth' => 'login',
'username' => 'mrsoft8888',
'password' => 'mrsoft8888'); //定义SMTP的验证参数
$transport = new Zend_Mail_Transport_Smtp('smtp.sohu.com', $config); //实例化验证的对象
$mail = new Zend_Mail('GBK'); //实例化发送邮件对象
$mail->setBodyHtml($mailbody); //发送邮件主体
$mail->setFrom($envelope, '明日科技典型模块程序测试邮箱,修改用户注册密码!'); //定义邮件发送使用的邮箱
$mail->addTo($email, '获取用户新密码'); //定义邮件的接收邮箱
$mail->setSubject($subject); //定义邮件主题
$mail->send($transport); //执行发送操作*/
/* 网络版发送邮件方法 */
if(false ==$mail->send($tr) ){
$reback = '-1';
}else{
$reback = '1';
}
}else{
$reback = '2';
}
}else{
$reback = $sql;
}
echo $reback;
?>
热门文章更多>>
标签更多>>
专题更多>>
最新文章更多>>
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
- 使用 C# 6.0 功能运行 TFS 构建
mafia小海