Ejemplo n.º 1
0
 } else {
     if ($action == 'check_login') {
         //检测用户是否已经登录
         echo MES_User::check_login();
     } else {
         if ($action == 'logout') {
             //登出操作
             echo MES_User::logout();
         } else {
             if ($action == 'signup') {
                 //用户注册
             } else {
                 if ($action == 'check_user_exsit') {
                     //检测一个用户是否存在
                     $username = ANTI_SPAM($_GET['username'], array('minLength' => 1, 'maxLength' => 20));
                     echo MES_User::check_user_exsit($username);
                 } else {
                     if ($action == 'auto_register') {
                         //自动注册其实用的就是那个手机号码
                         $username = ANTI_SPAM($_POST['username'], array('minLength' => 1, 'maxLength' => 20));
                         echo MES_User::auto_register($username);
                     } else {
                         if ($action == "change_unregister_password") {
                             //修改未注册但是曾经下单用户的密码
                             $password = ANTI_SPAM($_POST['password'], array('minLength' => 6, 'maxLength' => 30));
                             echo MES_User::change_unregister_password($password);
                         } else {
                             if ($action == "get_user_order_detail") {
                                 //获得一个用户订单的详情
                                 $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
                                 $order_id = ANTI_SPAM($order_id, array('minLength' => 1, 'maxLength' => 12, 'type' => 'number'));
Ejemplo n.º 2
0
 public static function auto_register($mobile)
 {
     global $db;
     include_once ROOT_PATH . 'includes/lib_passport.php';
     $check_user = MES_User::check_user_exsit($mobile);
     //if($check_user['autoregister']==true){
     //}
     $mobile = addslashes($mobile);
     $msg = '';
     //这个密码实际上会在注册后立即被更新成一个随机密码
     $password = '******';
     $f_email = 'W' . $mobile . "@fal.com";
     $email = $f_email;
     $username = $f_email;
     $other['mobile_phone'] = $mobile;
     $other['rea_name'] = '';
     $back_act = '';
     if (register($username, $password, $email, $other) !== false) {
         //user type 写成11 自动注册
         //密码必须名文 因为这个要发送给用户
         $rand_password = MES_User::rand_num();
         $db->query("update ecs_users set user_type=11,password='******' where user_name='{$username}'");
         //用户类型设置bisc
         $_SESSION['user_msg'] = $username;
     }
     //标记一下这个用户是这次自动注册的
     $_SESSION['user_auto_register'] = '11';
     $_SESSION['user_auto_register_moblie'] = $mobile;
     return json_encode(array('code' => RES_SUCCSEE, 'msg' => $msg));
 }