WeCenter是一款知識型的社交化問答開源社區(qū)程序,專注于企業(yè)和行業(yè)社區(qū)內(nèi)容的整理、歸類、檢索和再發(fā)行。 是中國首個基于 PHP + MYSQL 開發(fā)的開源化社交問答社區(qū)。今天小編為大家講解weCenter_3.19版本的短信接口替換,使用的接口是我們短信寶群發(fā)平臺的短信接口,我們短信寶群發(fā)短信平臺非常穩(wěn)定,發(fā)送速度快,注冊還送測試短信,推薦大家使用。
首先我們在根目錄下創(chuàng)建smsbao_install.php文件來安裝短信寶相關(guān)信息的配置字段:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?phpheader('content-type:text/html;charset=utf-8');include('system/system.php');$model = new AWS_MODEL();$data = array('smsbao_user'=>unserialize(),'smsbao_pwd'=>unserialize(),'smsbao_sign'=>unserialize());foreach ($data as $key => $value) { $datas['varname'] = $key; $datas['value'] = $value;$a = $model->insert('system_setting',$datas);}echo '短信寶插件安裝成功,請刪除smsbao_install.php文件'; |
接著打開項目\views\default\admin\settings.tpl.htm文件,在93行左右添加配置短信寶信息代碼:
|
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
|
<tr><td> <div class="form-group"> <span class="col-sm-4 col-xs-3 control-label"><?php _e('短信寶用戶名'); ?></span> <div class="col-sm-5 col-xs-8"> <input name="smsbao_user" class="form-control" type="text" value="<?php echo $this->setting['smsbao_user']; ?>"/> <span class="help-block"><?php _e('請?zhí)顚懚绦艑氂脩裘?#39;); ?> 還沒有賬號?請<a href="http://www.fyzp06.cn/reg">點擊注冊</a></span> </div> </div> </td> </tr> <tr> <td> <div class="form-group"> <span class="col-sm-4 col-xs-3 control-label"><?php _e('短信寶密碼'); ?></span> <div class="col-sm-5 col-xs-8"> <input name="smsbao_pwd" class="form-control" type="text" value="<?php echo $this->setting['smsbao_pwd']; ?>"/> <span class="help-block"><?php _e('請?zhí)顚懚绦艑毭艽a'); ?></span> </div> </div> </td> </tr> <tr> <td> <div class="form-group"> <span class="col-sm-4 col-xs-3 control-label"><?php _e('短信寶簽名'); ?></span> <div class="col-sm-5 col-xs-8"> <input name="smsbao_sign" class="form-control" type="text" value="<?php echo $this->setting['smsbao_sign']; ?>"/> <span class="help-block"><?php _e('請?zhí)顚懚绦艑毢灻?#39;); ?></span> </div> </div> </td> </tr> |
再修改233~239行左右的代碼
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<div class="col-sm-8 col-xs-8"><label class="checkbox-inline"><input type="radio" name="register_valid_type" value="email"<?php if ($this->setting['register_valid_type'] == 'email') { ?> checked="checked"<?php } ?> /> <?php _e('郵件驗證'); ?></label><label class="checkbox-inline"><input type="radio" name="register_valid_type" value="mobile"<?php if ($this->setting['register_valid_type'] == 'mobile') { ?> checked="checked"<?php } ?> /> <?php _e('短信驗證'); ?></label><label class="checkbox-inline"><input type="radio" name="register_valid_type" value="approval"<?php if ($this->setting['register_valid_type'] == 'approval') { ?> checked="checked"<?php } ?> /> <?php _e('郵件驗證 + 后臺審核'); ?></label><label class="checkbox-inline"><input type="radio" name="register_valid_type" value="N"<?php if ($this->setting['register_valid_type'] == 'N') { ?> checked="checked"<?php } ?> /> <?php _e('不驗證'); ?></label></div> |
接著我們打開項目\views\default\account\register.tpl.htm文件,修改59~77行左右的代碼:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?php if (get_setting('register_valid_type') == 'mobile') { ?> <li> <input class="aw-register-pwd form-control" type="text" name="mobile" id="mobile" placeholder="手機(jī)號" tips="<?php _e('請輸入正確手機(jī)號'); ?>" errortips="<?php _e('手機(jī)號不符合規(guī)則'); ?>" /> </li> <li class="aw-register-verify"> <b class="pull-right btn btn-large" id="mocode">獲取驗證碼</b><input type="text" class="form-control" name="smsbao_verify" placeholder="<?php _e('短信驗證碼'); ?>" /> </li> <?php } ?> <?php if (get_setting('register_seccode') == 'Y') { ?> <li class="aw-register-verify"><img class="pull-right" id="captcha" onclick="this.src = G_BASE_URL + '/account/captcha/' + Math.floor(Math.random() * 10000);" src=""><input type="text" id="seccode_verify" class="form-control" name="seccode_verify" placeholder="<?php _e('驗證碼'); ?>" /> </li> <?php } ?> |
接著我們再添加短信發(fā)送按鈕倒計時的javascript代碼:
|
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
|
<script type="text/javascript"> var time = 0; var res = null; function sendTime(){ clearTimeout(res); // 先清空一下倒計時資源。 time--; // 倒計時時間遞減。 // 如果倒計時到達(dá)0時,則恢復(fù)按鈕原來的內(nèi)容 if (time <= 0) { time = "獲取驗證碼"; $('#mocode').text(time); clearTimeout(res); time = 0; return; } // 倒計時的內(nèi)容寫到按鈕里面 $('#mocode').text("剩余" + time + "秒"); res = setTimeout("sendTime()", 1000); } $(function(){ var flg = true; $('#mocode').on('click',function(){ var mobile = $("#mobile").val(); var code = $("#seccode_verify").val(); var reg = /^1[3,4,5,7,8]\d{9}$/; var ret = false; if (code == '') {alert('請?zhí)顚戲炞C碼'); return ret;} if (!reg.test(mobile)) {alert('手機(jī)號碼不正確');return ret;} if (0 == time) { var _data = {"code" : code, "mobile" : mobile}; if (flg == true) { // ajax提交請求 $.ajax({ //提交數(shù)據(jù)的類型 POST GET type:"POST", //提交的網(wǎng)址 url:G_BASE_URL + '/account/ajax/register_mobile/', //提交的數(shù)據(jù) data:_data, //返回數(shù)據(jù)的格式 datatype: "text",//"xml", "html", "script", "json", "jsonp", "text". //成功返回之后調(diào)用的函數(shù) success:function(data){ console.log(data) if (data == 'ok') { time = 60; sendTime(); alert('短信發(fā)送成功'); }else{ alert(data); } } , }); } return ret; } }) })</script> |
添加完成之后我們再修改頁面注冊對手機(jī)號驗證格式的代碼,在255行左右添加以下代碼:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
case 'mobile': $(this).parent().find('.aw-reg-tips').detach(); var mobilereg = /^1[34578]\d{9}$/; if (!mobilereg.test($(this).val())) { $(this).parent().find('.aw-reg-tips').detach(); $(this).parent().append('<span class="aw-reg-tips aw-reg-right"><i class="aw-icon i-followed"></i></span>'); }else{ $(this).parent().find('.aw-reg-tips').detach(); $(this).parent().append('<span class="aw-reg-tips aw-reg-right"><i class="aw-icon i-followed"></i></span>'); } return; |
接著我們打開項目\views\default\account\find_password\modify.tpl.htm文件,替換為以下代碼:
|
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
<?php TPL::output('global/header_meta.tpl.htm'); ?><div class="aw-register-box"> <div class="mod-head"> <a href=""><img src="<?php echo G_STATIC_URL; ?>/css/<?php echo $this->template_name; ?>/img/login_logo.png" alt="" /></a> <h1><?php _e('找回密碼'); ?></h1> </div> <div class="mod-body"> <form class="aw-register-form" id="fpw_form" method="post" action="account/ajax/find_password_modify/"> <input type="hidden" name="active_code" value="<?php echo htmlspecialchars($_GET['key']); ?>"/> <ul> <li class="error alert-danger collapse error_message"> <p><i class="icon-remove"></i><em></em></p> </li> <?php if (get_setting('register_valid_type') == 'mobile') { ?> <li> <input class="aw-register-pwd form-control" type="text" name="mobile" id="mobile" placeholder="手機(jī)號" tips="<?php _e('請輸入正確手機(jī)號'); ?>" errortips="<?php _e('手機(jī)號不符合規(guī)則'); ?>" /> </li> <li class="aw-register-verify"> <b class="pull-right btn btn-large" id="mocode">獲取驗證碼</b> <input type="text" class="form-control" name="smsbao_verify" placeholder="<?php _e('短信驗證碼'); ?>" /> </li> <?php } ?> <li> <input class="aw-register-email form-control" name="password" type="password" placeholder="<?php _e('密碼'); ?>" /> </li> <li> <input class="aw-register-email form-control" name="re_password" type="password" placeholder="<?php _e('再次輸入密碼'); ?>" /> </li> <li class="aw-register-verify"> <img id="captcha" onclick="this.src = G_BASE_URL + '/account/captcha/' + Math.floor(Math.random() * 10000);" src="" class="auth-img pull-right"/> <input class="form-control" type="text" id="seccode_verify" name="seccode_verify" placeholder="<?php _e('驗證碼'); ?>" /> </li> <li class="clearfix"> <button class="btn btn-large btn-blue btn-block" onclick="AWS.ajax_post($('#fpw_form'), AWS.ajax_processer, 'error_message'); return false;"><?php _e('重置密碼'); ?></button> </li> </ul> </form> </div></div><script type="text/javascript"> var time = 0; var res = null; function sendTime(){ clearTimeout(res); // 先清空一下倒計時資源。 time--; // 倒計時時間遞減。 // 如果倒計時到達(dá)0時,則恢復(fù)按鈕原來的內(nèi)容 if (time <= 0) { time = "獲取驗證碼"; $('#mocode').text(time); clearTimeout(res); time = 0; return; } // 倒計時的內(nèi)容寫到按鈕里面 $('#mocode').text("剩余" + time + "秒"); res = setTimeout("sendTime()", 1000); } $(function(){ var flg = true; $('#mocode').on('click',function(){ var mobile = $("#mobile").val(); var code = $("#seccode_verify").val(); console.log(code); var reg = /^1[3,4,5,7,8]\d{9}$/; var ret = false; if (code == '') {alert('請?zhí)顚戲炞C碼'); return ret;} if (!reg.test(mobile)) {alert('手機(jī)號碼不正確');return ret;} if (0 == time) { var _data = {"code" : code, "mobile" : mobile}; console.log(_data) if (flg == true) { // ajax提交請求 $.ajax({ //提交數(shù)據(jù)的類型 POST GET type:"POST", //提交的網(wǎng)址 url:G_BASE_URL + '/account/ajax/register_mobile/', //提交的數(shù)據(jù) data:_data, //返回數(shù)據(jù)的格式 datatype: "text",//"xml", "html", "script", "json", "jsonp", "text". //成功返回之后調(diào)用的函數(shù) success:function(data){ console.log(data) if (data == 'ok') { time = 60; sendTime(); alert('短信發(fā)送成功'); }else{ alert(data); } } , }); } return ret; } }) })</script><?php TPL::output('global/footer.tpl.htm'); ?> |
替換完成之后我們在項目\models\文件夾下創(chuàng)建smsbao.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
|
<?phpif (!defined('IN_ANWSION')){ die;}/*** 短信寶發(fā)送類*/class smsbao_class extends AWS_MODEL{ public function sendsms($phone,$content) { $user = get_setting('smsbao_user'); $pwd = md5(get_setting('smsbao_pwd')); $sign = get_setting('smsbao_sign'); $ret = file_get_contents($url); if ($ret == 0) { return true; }else{ return false; } }} |
接著我們打開項目\app\account\find_password.php文件,替換index_action方法:
|
1
2
3
4
5
6
7
8
9
10
11
|
public function index_action() { if (get_setting('register_valid_type') == 'mobile') { TPL::output('account/find_password/modify'); }else{ TPL::output('account/find_password/index'); } } |
再打開項目\app\account\ajax.php文件,替換get_access_rule方法:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
public function get_access_rule() { $rule_action['rule_type'] = 'white'; //黑名單,黑名單中的檢查 'white'白名單,白名單以外的檢查 $rule_action['actions'] = array( 'check_username', 'check_email', 'login_process', 'register_agreement', 'send_valid_mail', 'valid_email_active', 'register_process', 'request_find_password', 'register_mobile', 'find_password_modify', 'weixin_login_process' ); return $rule_action; } |
接著替換register_process_action方法:
|
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
public function register_process_action() { if (get_setting('register_type') == 'close') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前關(guān)閉注冊'))); } else if (get_setting('register_type') == 'invite' AND !$_POST['icode']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通過邀請注冊'))); } else if (get_setting('register_type') == 'weixin') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通過微信注冊'))); } if ($_POST['icode']) { if (!$invitation = $this->model('invitation')->check_code_available($_POST['icode']) AND $_POST['email'] == $invitation['invitation_email']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀請碼無效或與邀請郵箱不一致'))); } } if (trim($_POST['user_name']) == '') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請輸入用戶名'))); } else if ($this->model('account')->check_username($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用戶名已經(jīng)存在'))); } else if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用戶名包含無效字符'))); } else if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) OR trim($_POST['user_name']) != $_POST['user_name']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用戶名中包含敏感詞或系統(tǒng)保留字'))); } if ($this->model('account')->check_email($_POST['email'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已經(jīng)被使用, 或格式不正確'))); } if (strlen($_POST['password']) < 6 OR strlen($_POST['password']) > 16) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密碼長度不符合規(guī)則'))); } if (! $_POST['agreement_chk']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用戶協(xié)議才能繼續(xù)'))); } if (get_setting('register_valid_type') == 'mobile') { if (AWS_APP::session()->mo_code != $_POST['smsbao_verify']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請?zhí)顚懻_的短信驗證碼'))); } if ($this->model('account')->check_mobile($_POST['mobile'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('手機(jī)號已存在,請使用其他手機(jī)號'))); } $update_data['mobile'] = $_POST['mobile']; }else{ // 檢查驗證碼 if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) AND get_setting('register_seccode') == 'Y') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請?zhí)顚懻_的驗證碼'))); } } if (get_setting('ucenter_enabled') == 'Y') { $result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']); if (is_array($result)) { $uid = $result['user_info']['uid']; } else { H::ajax_json_output(AWS_APP::RSM(null, -1, $result)); } } else { $uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']); } if ($_POST['email'] == $invitation['invitation_email']) { $this->model('active')->set_user_email_valid_by_uid($uid); $this->model('active')->active_user_by_uid($uid); } if (isset($_POST['sex'])) { $update_data['sex'] = intval($_POST['sex']); if ($_POST['province']) { $update_data['province'] = htmlspecialchars($_POST['province']); $update_data['city'] = htmlspecialchars($_POST['city']); } if ($_POST['job_id']) { $update_data['job_id'] = intval($_POST['job_id']); } $update_attrib_data['signature'] = htmlspecialchars($_POST['signature']); // 更新主表 $this->model('account')->update_users_fields($update_data, $uid); // 更新從表 $this->model('account')->update_users_attrib_fields($update_attrib_data, $uid); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); if ($_POST['icode']) { $follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']); } else if (HTTP::get_cookie('fromuid')) { $follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid')); } if ($follow_users['uid']) { $this->model('follow')->user_follow_add($uid, $follow_users['uid']); $this->model('follow')->user_follow_add($follow_users['uid'], $uid); $this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '邀請注冊: ' . $_POST['user_name'], $follow_users['uid']); } if ($_POST['icode']) { $this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid); } if (get_setting('register_valid_type') == 'N' OR (get_setting('register_valid_type') == 'email' AND get_setting('register_type') == 'invite')) { $this->model('active')->active_user_by_uid($uid); } $user_info = $this->model('account')->get_user_info_by_uid($uid); if (get_setting('register_valid_type') == 'mobile') { $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); if (!$_POST['_is_mobile']) H::ajax_json_output(AWS_APP::RSM(array( 'url' => get_js_url('/home/first_login-TRUE') ), 1, null)); } if (get_setting('register_valid_type') == 'N' OR $user_info['group_id'] != 3 OR $_POST['email'] == $invitation['invitation_email']) { $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array( 'url' => get_js_url('/home/first_login-TRUE') ), 1, null)); } } else { AWS_APP::session()->valid_email = $user_info['email']; $this->model('active')->new_valid_email($uid); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array( 'url' => get_js_url('/account/valid_email/') ), 1, null)); } } if ($_POST['_is_mobile']) { $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); if ($_POST['return_url']) { $user_info = $this->model('account')->get_user_info_by_uid($uid); $return_url = strip_tags($_POST['return_url']); } else { $return_url = get_js_url('/m/'); } H::ajax_json_output(AWS_APP::RSM(array( 'url' => $return_url ), 1, null)); } } |
替換完成之后增加register_mobile_action方法:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
public function register_mobile_action() { if (!AWS_APP::captcha()->is_validate($_POST['code']) AND get_setting('register_seccode') == 'Y') { echo '請?zhí)顚懻_的驗證碼'; exit; } if(!preg_match('/^1[3,4,5,7,8]\d{9}$/',$_POST['mobile'])) { echo '請?zhí)顚懻_的手機(jī)號碼'; exit; } $code = rand(10000,50000); $content = '您的驗證碼為:'.$code.' 請妥善保存。'; AWS_APP::session()->mo_code = $code; $ret = $this->model('smsbao')->sendsms($_POST['mobile'],$content); if ($ret) { echo '發(fā)送成功,請注意查收!'; } } |
接著我們再替換find_password_modify_action方法:
|
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
public function find_password_modify_action() { if (get_setting('register_valid_type') == 'mobile') { if (AWS_APP::session()->mo_code != $_POST['smsbao_verify']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請?zhí)顚懻_的短信驗證碼'))); } if (!$_POST['password']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請輸入密碼'))); } if ($_POST['password'] != $_POST['re_password']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('兩次輸入的密碼不一致'))); } $user_info = $this->model('account')->get_user_info_by_mobile($_POST['mobile']); $this->model('account')->update_user_password_ingore_oldpassword($_POST['password'], $user_info['uid'], $user_info['salt']); $this->model('active')->set_user_email_valid_by_uid($user_info['uid']); if ($user_info['group_id'] == 3) { $this->model('active')->active_user_by_uid($user_info['uid']); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); unset(AWS_APP::session()->find_password); H::ajax_json_output(AWS_APP::RSM(array( 'url' => get_js_url('/account/login/'), ), 1, AWS_APP::lang()->_t('密碼修改成功, 請返回登錄'))); }else{ if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請?zhí)顚懻_的驗證碼'))); } $active_data = $this->model('active')->get_active_code($_POST['active_code'], 'FIND_PASSWORD'); if ($active_data) { if ($active_data['active_time'] OR $active_data['active_ip']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('鏈接已失效,請重新找回密碼'))); } } else { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('鏈接已失效,請重新找回密碼'))); } if (!$_POST['password']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請輸入密碼'))); } if ($_POST['password'] != $_POST['re_password']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('兩次輸入的密碼不一致'))); } if (! $uid = $this->model('active')->active_code_active($_POST['active_code'], 'FIND_PASSWORD')) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('鏈接已失效,請重新找回密碼'))); } $user_info = $this->model('account')->get_user_info_by_uid($uid); $this->model('account')->update_user_password_ingore_oldpassword($_POST['password'], $uid, $user_info['salt']); $this->model('active')->set_user_email_valid_by_uid($user_info['uid']); if ($user_info['group_id'] == 3) { $this->model('active')->active_user_by_uid($user_info['uid']); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); unset(AWS_APP::session()->find_password); H::ajax_json_output(AWS_APP::RSM(array( 'url' => get_js_url('/account/login/'), ), 1, AWS_APP::lang()->_t('密碼修改成功, 請返回登錄'))); } } |
好了,經(jīng)過以上的替換,短信寶的短信平臺已經(jīng)替換成功了,可以正常使用了。我們進(jìn)行測試發(fā)送。

報備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達(dá)。
另外:我們已經(jīng)開發(fā)好完整的weCenter問答社區(qū)程序短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類