Example #1
0
/**
*	发送用户手机获奖短信
*	mobile @用户手机号
*   uid    @用户的ID
*	code   @中奖码
*/
function send_mobile_shop_code($mobile = null, $uid = null, $code = null)
{
    if (!$uid) {
        _message("发送用户手机获奖短信,用户ID不能为空!");
    }
    if (!$mobile) {
        _message("发送用户手机获奖短信,手机号码不能为空!");
    }
    if (!$code) {
        _message("发送用户手机获奖短信,中奖码不能为空!");
    }
    $db = System::load_sys_class('model');
    $template = $db->GetOne("select * from `@#_caches` where `key` = 'template_mobile_shop'");
    if (!$template) {
        $template = array();
        $content = "你在" . _cfg("web_name") . "够买的商品已中奖,中奖码是:" . $code;
    }
    if (empty($template['value'])) {
        $content = "你在" . _cfg("web_name") . "够买的商品已中奖,中奖码是:" . $code;
    } else {
        if (strpos($template['value'], "00000000") == true) {
            $content = str_ireplace("00000000", $code, $template['value']);
        } else {
            $content = $template['value'] . $code;
        }
    }
    return _sendmobile($mobile, $content);
}
Example #2
0
 public function findmobilecheck()
 {
     $title = "手机找回密码";
     $time = 120;
     $namestr = $this->segment(4);
     $name = _encrypt($namestr, "DECODE");
     if (strlen($name) != 11) {
         _message("参数错误!");
     }
     $member = $this->DB()->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$name}' LIMIT 1");
     if (!$member) {
         _message("参数不正确!");
     }
     if ($member['passcode'] == -1) {
         //更新验证码
         $randcode = rand(100000, 999999);
         $checkcodes = $randcode . '|' . time();
         //验证码
         $this->DB()->Query("UPDATE `@#_member` SET passcode='{$checkcodes}' where `uid`='{$member['uid']}'");
         $sendok = _sendmobile($name, $randcode);
         if ($sendok[0] != 1) {
             _message($sendok[1]);
         }
         header("location:" . WEB_PATH . "/member/finduser/findmobilecheck/" . _encrypt($member['mobile']));
         exit;
     }
     if (isset($_POST['submit'])) {
         $checkcodes = isset($_POST['checkcode']) ? $_POST['checkcode'] : _message("参数不正确!");
         if (strlen($checkcodes) != 6) {
             _message("验证码输入不正确!");
         }
         $usercode = explode("|", $member['passcode']);
         if ($checkcodes != $usercode[0]) {
             _message("验证码输入不正确!");
         }
         $urlcheckcode = _encrypt($member['mobile'] . "|" . $member['passcode']);
         _setcookie("uid", _encrypt($member['uid']));
         _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])));
         _message("手机验证成功", WEB_PATH . "/member/finduser/findok/" . $urlcheckcode, 2);
     }
     $enname = substr($name, 0, 3) . '****' . substr($name, 7, 10);
     $time = 120;
     include templates("user", "findmobilecheck");
 }
Example #3
0
 public function mobiles()
 {
     $mobile = array('mid' => '', 'mpass' => '');
     $mobile = System::load_sys_config("mobile");
     $cesi = $this->segment(4);
     if (isset($_POST['dosubmit_ceshi'])) {
         $sendobj = System::load_sys_class("sendmobile");
         $_POST['ceshi_haoma'] = trim($_POST['ceshi_haoma']);
         $_POST['ceshi_con'] = trim($_POST['ceshi_con']);
         if (empty($_POST['ceshi_con']) || empty($_POST['ceshi_haoma'])) {
             echo json_encode(array("-1", "内容或者手机号不能为空!"));
             return;
         }
         $ret = $sendobj->mobile_con_check($_POST['ceshi_con']);
         //内容检测不合法返回
         if ($ret[0] == -1) {
             echo json_encode($ret);
             return;
         }
         if (!is_numeric($_POST['ceshi_haoma'])) {
             echo json_encode(array("-1", "手机号不正确!"));
             return;
         }
         $sendok = _sendmobile($_POST['ceshi_haoma'], $_POST['ceshi_con']);
         echo json_encode($sendok);
         return;
     }
     /*if end*/
     if (isset($_POST['dosubmit'])) {
         $cfg_id = trim($_POST['mid']);
         $cfg_pass = trim($_POST['mpass']);
         $cfg_qianming = trim(isset($_POST['mqianming']) ? $_POST['mqianming'] : '');
         $cfg_type = abs(intval($_POST['interface']));
         if ($cfg_type == 1) {
             $mobile['cfg_mobile_1']['mid'] = $cfg_id;
             $mobile['cfg_mobile_1']['mpass'] = $cfg_pass;
             $mobile['cfg_mobile_1']['mqianming'] = $cfg_qianming;
             $mobile['cfg_mobile_2']['mid'] = $mobile['cfg_mobile_2']['mid'];
             $mobile['cfg_mobile_2']['mpass'] = $mobile['cfg_mobile_2']['mpass'];
             $mobile['cfg_mobile_2']['mqianming'] = $mobile['cfg_mobile_2']['mqianming'];
         }
         if ($cfg_type == 2) {
             $mobile['cfg_mobile_1']['mid'] = $mobile['cfg_mobile_1']['mid'];
             $mobile['cfg_mobile_1']['mpass'] = $mobile['cfg_mobile_1']['mpass'];
             $mobile['cfg_mobile_1']['mqianming'] = $mobile['cfg_mobile_1']['mqianming'];
             $mobile['cfg_mobile_2']['mid'] = $cfg_id;
             $mobile['cfg_mobile_2']['mpass'] = $cfg_pass;
             $mobile['cfg_mobile_2']['mqianming'] = $cfg_qianming;
         }
         $mobile['cfg_mobile_on'] = $cfg_type;
         if (!is_writable(G_CONFIG . 'mobile.inc.php')) {
             _message('Please chmod  mobile.ini.php  to 0777 !');
         }
         $html = var_export($mobile, true);
         $html = "<?php \n return " . $html . "; \n?>";
         $ok = file_put_contents(G_CONFIG . 'mobile.inc.php', $html);
         if ($ok) {
             _message("短信配置更新成功!");
         }
     }
     $sendmobile = System::load_sys_class("sendmobile");
     $sendmobile->GetBalance();
     if ($sendmobile->error == 1) {
         $text2 = "<b style='color:#0c0'>短信功能正常</b>,短信还剩余 " . $sendmobile->v . " 条";
     } else {
         $text2 = "<b style='color:#ff0000'>短信测试失败</b>,失败原因:" . $sendmobile->v;
     }
     $new_mbl = $sendmobile->GetBalance_new();
     if ($new_mbl['id']) {
         $text1 = "<b style='color:#0c0'>短信功能正常</b>,短信还剩余 " . $new_mbl['id'] . " 条";
     } else {
         $text1 = "<b style='color:#ff0000'>短信测试失败</b>,失败原因:" . $new_mbl['err'];
     }
     if (!isset($mobile['cfg_mobile_2'])) {
         $mobile['cfg_mobile_1'] = $mobile['cfg_mobile_2'] = array();
         $mobile['cfg_mobile_2']['mid'] = $mobile['mid'];
         $mobile['cfg_mobile_2']['mpass'] = $mobile['mpass'];
         $mobile['cfg_mobile_2']['mqianming'] = $mobile['mqianming'];
         $mobile['cfg_mobile_1'] = array();
         $mobile['cfg_mobile_1']['mid'] = '';
         $mobile['cfg_mobile_1']['mpass'] = '';
         $mobile['cfg_mobile_1']['mqianming'] = '';
     }
     include $this->tpl(ROUTE_M, 'config.mobile');
 }