|
|
本帖最后由 uijk123 于 2016-2-16 21:57 编辑
今天测试了下短信接口,因为在其他短信平台上还有余额,所以就改了下/include/global.func.php这个文件里的send_sms函数,发送验证码和信息的功能都OK,就是PC端注册有个小BUG,无论输入的验证码是否正确,旁边都是红叉,这个表框的JS是onblur="validator('mobilecode');"
但是发现JS里的validator函数根本不能检测验证码啊,请管理员看看是否为BUG

a1.jpg (12.94 KB, 下载次数: 0)
下载附件
2016-2-16 21:57 上传
//以下为DT官方短信发送函数
function send_sms_old($mobile, $message, $word = 0, $time = 0) {
global $db, $DT, $DT_TIME, $DT_IP, $_username;
if(!$DT['sms'] || !DT_CLOUD_UID || !DT_CLOUD_KEY || !is_mobile($mobile) || strlen($message) query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");
return $code;
}
//以下为我根据官方二开文档改的
function send_sms($mobile, $message, $word = 0, $time = 0) {
global $db, $DT, $DT_TIME, $DT_IP, $_username;
$word or $word = word_count($message);
$sms_uid = '****************'; //短信接口帐号
$sms_key = '*****************'; //短信接口密钥
$sms_charset = 'UTF-8'; //您的网站编码
$sms_mobile = $mobile; //接收手机号码
$sms_message = convert($message, DT_CHARSET, 'UTF-8'); //短信内容
//对短信内容进行编码
$sms_message = rawurlencode($sms_message);
//发送短信
$codedd = file_get_contents('http://api.smsbao.com/sms?u='.$sms_uid.'&p='.$sms_key.'&m='.$sms_mobile.'&c='.$sms_message);
//处理发送结果
注:这个平台成功只返回0,所以要改造一下
if($codedd==0){
$code = 1;
}else{$code = 'Can Not Connect SMS Server';}
$db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");
return $code;
} |
|