-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetpsw.php
42 lines (42 loc) · 1.26 KB
/
resetpsw.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
//这里是重设密码的文件
require_once 'status.class.php';
require_once 'Database.class.php';
if(isset($_REQUEST['account']))
$account=$_REQUEST['account'];
if(isset($_REQUEST['resetpsw']))
$resetpsw=$_REQUEST['resetpsw'];
if(isset($_REQUEST['validtime']))
{
$validtime=$_REQUEST['validtime'];
$s=new Status();//状态获取类
if($s->judgeTime($validtime)=='202')
{
$st=array('status'=>'202');
$show['status']=$st['status'];
$show['response']=array(null);
echo json_encode($show);
exit();//有效期过了,异常退出
}
}
$conn=mysql_connect($_SERVER['SERVER_NAME'],Database::$database_username,Database::$database_userpassword);
mysql_select_db(Database::$selectdatabase);
mysql_query("set names utf8");
$sql="select * from ".Database::$database_user_table." where account='".$account."'";
$res=mysql_query($sql,$conn) or die(mysql_error());//
if($res)
{
$sql="update ".Database::$database_user_table." set psw='".$resetpsw."' where account='".$account."'";
$res1=mysql_query($sql) or die(mysql_error());
mysql_free_result($res);
if(mysql_affected_rows()>0)
{
$st=array('status'=>'200');
$show['status']=$st['status'];
$show['response']=array(null);
echo json_encode($show);
exit();//正常退出程序
}
}
exit();
?>