-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbind_mobile.php
More file actions
75 lines (65 loc) · 1.93 KB
/
bind_mobile.php
File metadata and controls
75 lines (65 loc) · 1.93 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 15/9/15
* Time: 下午4:49
*/
include 'library/init.inc.php';
$operation = 'bind';
$opera = check_action($operation, getPOST('opera'));
if('bind' == $opera)
{
$response = array('error'=>1, 'msg'=>'');
$verify = getPOST('verify');
$mobile = getPOST('mobile');
$password = getPOST('password');
if(!check_cross_domain())
{
if($mobile == '')
{
$response['msg'] .= '-请输入手机号码<br/>';
} else {
if(is_mobile($mobile))
{
$mobile = $db->escape($mobile);
} else {
$response['msg'] .= '-手机号码格式错误<br/>';
}
}
if($verify == '')
{
$response['msg'] .= '-请输入验证码<br/>';
} else {
$check_code = 'select `code`,`expire` from '.$db->table('message_code').' where `mobile`=\''.$mobile.'\'';
$message_code = $db->fetchRow($check_code);
if($verify != $message_code['code'])
{
$response['msg'] .= '-验证码错误<br/>';
}
}
if($password == '')
{
$response['msg'] .= '-请填写密码<br/>';
} else {
$password = md5($password.PASSWORD_END);
}
if($response['msg'] == '')
{
$data = array('mobile'=>$mobile, 'password'=>$password);
if($db->autoUpdate('member', $data, '`account`=\''.$_SESSION['account'].'\''))
{
$response['error'] = 0;
$response['msg'] = '绑定手机号码成功';
} else {
$response['msg'] ='001:系统繁忙,请稍后再试';
}
}
} else {
$response['msg'] = '404:参数错误';
}
echo json_encode($response);
exit;
}
$_SESSION['token'] = 'can send message.';
$smarty->display('binding.phtml');