省实附中吧吧务应征系统3.0 源代码开放·忘记密码

<?php
session_start();
include(“header.php”);
function request_by_curl($remote_server,$post_string){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$remote_server);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

$r=true;
require(‘config.php’);
require(‘stat.php’);
function randomFileName(){
$len=32;
$chars=’ABCDEFGHIJKFGHIJKLMNOPQLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789′;
// characters to build the password from
mt_srand((double)microtime()*1000000*getmypid());
// seed the random number generater (must be done)
while(strlen($filename)<$len)
$filename.=substr($chars,(mt_rand()%strlen($chars)),1);
return $filename;
}
$reset_token = randomFileName();

$username=$_POST[“name”];
$mail=$_POST[“mail”];
$mobile=$_POST[“mobile”];
$db=mysql_connect($ucenterhostname,$ucentersqlname,$ucentersqlpass);
mysql_select_db($ucenterdbname,$db);
mysql_query(“set names ‘utf8′”);
$sql = “SELECT * FROM $ucenterdbtable WHERE `username` = ‘$username’ or `mail` = ‘$mail’ or ‘mobile’ = ‘$mobile'”;
$user=mysql_fetch_array(mysql_query($sql));
if(!$user)
{
echo -1;
exit;
}
$sql = “UPDATE $ucenterdbtable SET `reset_token` = ‘$reset_token’ WHERE `id` = “.$user[‘id’];
mysql_query($sql);
$username = $user[‘username’];
$to = $user[‘mail’];
$time=date(‘Y-m-d H:i:s’);
$reg_token=$reset_token;
$title = “【省实附中吧吧务应征系统】密码重置邮件(翰墨网络技术支持部门)”;
$url = “http://bawu.stop.sf-er.com/”;
$url.= “passwd_reset.php?username=$username”.”&”.”reset_token=$reg_token”;
$content = “亲爱的 $username :
<br>
您于 $time 在<b>省实附中吧吧务应征系统</b>申请了了账户 $username 的密码重置服务。
<br><br>
请立即点击以下<b>一次性</b>链接重置你的密码,请不要将其转发给任何人。
<br><br>  (如果不能点击,请将其复制到浏览器地址栏打开)
<br>
———————————————————————————————————-
<br>
<br>
$url
<br>
<br>
———————————————————————————————————-
<br><br>
如果你没有申请过重置密码,请您删除这封邮件。
<br><br>
省实附中吧吧务应征系统 http://bawu.stop.sf-er.com
<br><br>
$time”;
$content=urlencode($content);
$post = “to=$to&title=$title&content=$content”;
request_by_curl(‘http://www.qiu-lnt.com/api/opensend.php’,$post);

mysql_close();

echo “<script>location.href=’erro.php?content=密码重置邮件发送成功,请去邮箱查询’;</script>”;
?>

未经允许不得转载:Lyndon's Studio » 省实附中吧吧务应征系统3.0 源代码开放·忘记密码