$mobile = trim($_POST['mobile']); if (empty($mobile) || !preg_match("/^(13|15|14|17|18)\\d{9}\$/", $mobile)) { exit("手机号错误"); } $sql = "select * from " . table('members') . " where mobile = '{$mobile}' LIMIT 1"; $userinfo = $db->getone($sql); if ($userinfo && $userinfo['uid'] != $_SESSION['uid']) { exit("手机号已经存在!请填写其他手机号码"); } elseif (!empty($userinfo['mobile']) && $userinfo['mobile_audit'] == "1" && $userinfo['mobile'] == $mobile) { exit("你的手机号 {$mobile} 已经通过验证!"); } else { if ($_SESSION['send_time'] && time() - $_SESSION['send_time'] < 180) { exit("请180秒后再进行验证!"); } $rand = mt_rand(100000, 999999); $r = captcha_send_sms($mobile, "感谢您使用{$_CFG['site_name']}手机认证,验证码为:{$rand}"); if ($r == "success") { $_SESSION['mobile_rand'] = $rand; $_SESSION['send_time'] = time(); $_SESSION['verify_mobile'] = $mobile; exit("success"); } else { exit("SMS配置出错,请联系网站管理员"); } } } elseif ($act == "verify_code") { $send_key = trim($_POST['send_key']); if (empty($send_key) || $send_key != $_SESSION['send_mobile_key']) { exit("链接错误"); } $verifycode = trim($_POST['verifycode']);
refresh_cache('sms_config'); adminmsg("保存成功!", 2); } if ($act == 'testing') { get_token(); $smarty->assign('navlabel', 'testing'); $smarty->display('sms/admin_sms_testing.htm'); } elseif ($act == 'sms_testing') { check_token(); $txt = "您好!这是一条检测短信模块配置的短信。收到此短信,意味着您的短信模块设置正确!您可以进行其它操作了!"; $mobile = $_POST['mobile']; if (!preg_match("/^(13|15|18)\\d{9}\$/", $mobile)) { adminmsg("手机号填写错误,请重新填写!", 0); } if ($_POST['type'] == 1) { $r = captcha_send_sms($mobile, $txt); if ($r == "success") { adminmsg('短信发送成功!', 2); } else { adminmsg("短信发送失败!{$r}", 1); } } elseif ($_POST['type'] == 2) { $r = send_sms($mobile, $txt); if ($r == "success") { adminmsg('短信发送成功!', 2); } else { adminmsg("短信发送失败!{$r}", 1); } } elseif ($_POST['type'] == 3) { $r = free_send_sms($mobile, $txt); if ($r == "success") {