-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforgot.php
More file actions
61 lines (48 loc) · 1.26 KB
/
forgot.php
File metadata and controls
61 lines (48 loc) · 1.26 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 15/9/7
* Time: 上午11:22
*/
include 'library/init.inc.php';
$operation = 'edit';
$opera = check_action($operation, getPOST('opera'));
if('edit' == $opera)
{
$response = array('error'=>1, 'msg'=>'');
$password = getPOST('password');
$mobile = getPOST('mobile');
if($password == '')
{
$response['msg'] = '请填写新密码';
}
if(!is_mobile($mobile))
{
$response['msg'] = '手机号码格式不正确';
} else {
$mobile = $db->escape($mobile);
}
if(!isset($_SESSION['token']) || $_SESSION['token'] != 'verify message code success.')
{
$response['msg'] = '请先通过身份验证';
}
if($response['msg'] == '')
{
$password = md5($password.PASSWORD_END);
$data = array(
'password' => $password
);
if($db->autoUpdate('member', $data, '`mobile`=\''.$mobile.'\''))
{
$response['msg'] = '找回密码成功';
$response['error'] = 0;
} else {
$response['msg'] = '系统繁忙,请稍后再试';
}
}
echo json_encode($response);
exit;
}
$_SESSION['token'] = 'can send message.';
$smarty->display('forgot.phtml');