联系我们

18176930112


建站、模板咨询

destoon教程之系统接入第三方短信平台

此处接入的平台为互亿无线sms.ihi.com

修改两个文件


第一个:\include\global.func.php

找到方法 function send_sms 修改为

function send_sms($mobile, $mobilecode, $word = 0, $time = 0){
$sms_url = 'http://106.ihuyi.cn/webservice/sms.php?method=Submit';//短信接口地址

global $db, $DT, $DT_TIME, $DT_IP, $_username;
//判断是否输入key
if(!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) return false;

//生成短信内容
//验证码
$mobile_code=$mobilecode;
//短信内容
$mess_info="您的验证码是:".$mobile_code."。请不要把验证码泄露给其他人。如非本人操作,可不用理会!";
//要提交的信息
$post_data = "account=".$DT['sms_uid']
."&password=".$DT['sms_key']
."&mobile=".$mobile
."&content=".rawurlencode(convert($mess_info, DT_CHARSET, 'UTF-8'));

//短信字数统计
$word or $word = word_count($mess_info);


//采用PHP的cURL库推送网页
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $sms_url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
$return_str = curl_exec($curl);
curl_close($curl);

$code='ok';
//处理返回数据

//将短信内容插入数据库保存
$db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$mess_info','$word','$_username','$DT_TIME','$code')");

return $code;
}


第二个:\module\member\register.inc.php
找到


if($could_mobilecode) {
if($action == $action_sendscode) {
$mobile = isset($value) ? trim($value) : '';
if(!is_mobile($mobile)) exit('2');
isset($_SESSION['mobile_send']) or $_SESSION['mobile_send'] = 0;
if($do->mobile_exists($mobile)) exit('3');
if($_SESSION['mobile_time'] && $DT_TIME - $_SESSION['mobile_time'] < 180) exit('5');
if($_SESSION['mobile_send'] > 4) exit('6');

$mobilecode = random(6, '0123456789');
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = md5($mobile.'|'.$mobilecode);
$_SESSION['mobile_time'] = $DT_TIME;
$_SESSION['mobile_send'] = $_SESSION['mobile_send'] + 1;

$content = lang('sms->sms_code', array($mobilecode, $MOD['auth_days'])).$DT['sms_sign'];
send_sms($mobile, $content);
exit('1');
}
}


修改为

if($could_mobilecode) {
if($action == $action_sendscode) {
$mobile = isset($value) ? trim($value) : '';
if(!is_mobile($mobile)) exit('2');
isset($_SESSION['mobile_send']) or $_SESSION['mobile_send'] = 0;
if($do->mobile_exists($mobile)) exit('3');
if($_SESSION['mobile_time'] && $DT_TIME - $_SESSION['mobile_time'] < 180) exit('5');
if($_SESSION['mobile_send'] > 4) exit('6');

$mobilecode = rand(100000,999999);
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = md5($mobile.'|'.$mobilecode);
$_SESSION['mobile_time'] = $DT_TIME;
$_SESSION['mobile_send'] = $_SESSION['mobile_send'] + 1;

//$content = lang('sms->sms_code', array($mobilecode, $MOD['auth_days'])).$DT['sms_sign'];
send_sms($mobile, $mobilecode);
exit('1');
}
}

电话

咨询电话:
4008857862
18176930112 13878897862

微信咨询

千人QQ交流群

购物车

客服

顶部