len:6644
len:15
len:6
len:42
len:5344
len:10
len:0
len:32
len:7
len:0
len:1263
len:6
zz22zz技术论坛
首页| 论坛| 消息
主题:pw8.7更换短信平台的解决方法
太史慈发表于 2013-11-26 09:49
现在第三方短信平台的运营商也很多,但是稳定的不多,我找了一家,还算稳定。
网址是http://www.sioo.com.cn这家,不过测试下来发现、移动的这几天发不了信息、可能是移动那边给限制了。

pw8.x程序里面要对应修改下,修改方法如下:
register.php
找到
echo $status ? 0 : 5;
改成
echo $status;
找到
!$status && Showmsg('手机验证码填写错误');
改成
$status && Showmsg('手机验证码填写错误');
当然、懂代码的会发现,我把这里的判断方式改反了,不要慌、下个文件里面还要修改呢。

打开lib/user/authentication.class.php
找到
function getverify($bev, $mobile, $markid, $issendtocredit = false, $messagetype = '') {
把这个函数整体替换成
//获取验证码
function getverify($bev, $mobile, $markid, $issendtocredit = false, $messagetype = '') {
//验证是否是手机
//if(!preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|18[789]{1}[0-9]{8}$/",$mobile)){
if(!$mobile || !preg_match("/^1[358]{1}[0-9]{9}$/",$mobile)){
//if(strlen($mobile) != 11) { ///^[1][3,5,8][0-9]{9}$/
return 2;
}
//验证号码是否已经被注册
global $db, $onlineip, $tdtime;
$check = $db->get_one("SELECT * FROM pw_members WHERE authmobile='".$mobile."'");
if($check['uid']) {
return 3;
}
//验证次数
$count = $db->get_value("SELECT count(*) FROM pw_member_authentication_code WHERE mobile = '".$mobile."' AND time > '".get_date($tdtime)."'");
if($count >= 2) {
return 4;
}
//生成验证码并记入session
session_start();
$code = '';
$list = '1234567890';
$len= strlen($list) - 1;
$num = 6;
for ($i = 0; $i < $num; $i++) {
$code .= $list[mt_rand(0, $len)];
}
$_SESSION['auth'.$mobile] = $code;
//之前是记录session
$pwSQL = S::sqlSingle(array(
'mobile'=> $mobile,
'code'=> $code,
'ip'=> $onlineip,
'time'=> get_date($GLOBALS['timestamp'],'Y-m-d H:i:s')
));
$db->update("INSERT INTO pw_member_authentication_code SET ".$pwSQL);
//发送短消息
$msg = rawurlencode("手机户注册验证码:".$code.",请在注册页面填写,短信验证码有效期20分钟");
require_once (R_P . 'require/posthost.php');
//$data = PostHost("http://210.5.158.31/hy?", "uid=80072&auth=4e2c68e27363ec7ec1ab62a19a7fa00d&mobile=".$mobile."&msg=".$msg."&expid=0&encode=gbk", "GET");
$data = file_get_contents("http://210.5.158.31/hy?uid=80072&auth=4e2c68e27363ec7ec1ab62a19a7fa00d&mobile=".$mobile."&msg=".$msg."&expid=0");
list($status,) = explode(',', $data);
return $status;
}
找到
function checkverify($mobile, $markid, $verify) {
整体替换成
//校验验证码
function checkverify($mobile, $markid, $verify) {
if(!$mobile) {
$status = 2;
return $status;
}
global $db, $onlineip;
$code = $db->get_value("SELECT code FROM pw_member_authentication_code WHERE mobile='".$mobile."' AND ip='".$onlineip."' ORDER BY time DESC LIMIT 1");
//session_start();
//if($_SESSION['auth'.$mobile] && $verify == $_SESSION['auth'.$mobile]) {
if($code && $verify == $code) {
$status = 0;
} else {
$status = 5;
}
return $status;
}
下一页 (1/2)
回帖(3):
3楼:january 30,http://www.instant-radio-codes.com/monclerukshop.php
Joe Hutchinson and the ..
2楼:工信部整治垃圾短信给整的
1楼:数据表结构,以后数据不是存云平台了,而是放到本地。
CREATE TABLE IF NOT EXISTS `pw_memb ..

全部回帖(3)»
最新回帖
收藏本帖
发新帖