function str_suffix($text, $suffix)
{
    $suffixLength = str_length($suffix);
    $stringLength = str_length($text);
    $substring = str_substring($text, $stringLength - $suffixLength - 1, $suffixLength);
    return $suffix == $substring;
}
Exemple #2
0
function material_upinfo_submit()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr;
    checkAuthMod('index.php?n=material');
    //客服模拟登录操作没有修改权限
    $validation = MooAutoLoad('MooValidation');
    $uid = $userid;
    $user_rank_id = get_userrank($userid);
    //var_dump($user_rank_id);
    //$update1_arr = $update2_arr = $update3_arr = array();
    //note members表字段
    $members_search = array();
    $members_base = array();
    $members_choice = array();
    $members_introduce = array();
    $birthyear = MooGetGPC('year', 'string', 'P');
    $members_search['birthyear'] = $birthyear;
    $birthmonth = MooGetGPC('month', 'string', 'P');
    $birthday = MooGetGPC('days', 'string', 'P');
    $members_search['updatetime'] = time();
    $members_search['nickname'] = safeFilter(MoogetGPC('nickname', 'string', 'P'));
    $members_search['telphone'] = MoogetGPC('telphone', 'string', 'P');
    $members_search['marriage'] = MoogetGPC('marriage1', 'integer', 'P');
    $members_search['height'] = MoogetGPC('height', 'integer', 'P');
    $members_search['salary'] = MoogetGPC('salary', 'integer', 'P');
    $members_search['education'] = MoogetGPC('education1', 'integer', 'P');
    $members_search['children'] = MoogetGPC('children1', 'integer', 'P');
    $members_search['house'] = MoogetGPC('house', 'integer', 'P');
    $members_base['oldsex'] = MoogetGPC('oldsex', 'integer', 'P');
    $members_search['province'] = MoogetGPC('province', 'integer', 'P');
    $members_search['city'] = MoogetGPC('city', 'integer', 'P');
    if (in_array($members_search['province'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_search['city'] = $members_search['province'];
        $members_search['province'] = 10101000;
    }
    //note choice表字段
    $gender = $_MooClass['MooMySQL']->getOne("select gender from {$dbTablePre}members_search WHERE uid='{$uid}'", true);
    if ($gender['gender'] == 0) {
        $members_choice['gender'] = 1;
    } else {
        $members_choice['gender'] = 0;
    }
    //$update2_arr['sex'] = MoogetGpc('sex','integer','p');
    $members_choice['age1'] = MoogetGPC('age1', 'integer', 'P');
    $members_choice['age2'] = MoogetGPC('age2', 'integer', 'P');
    $members_choice['workprovince'] = MoogetGPC('workProvince', 'integer', 'P');
    $members_choice['workcity'] = MoogetGPC('workCity', 'integer', 'P');
    if (in_array($members_choice['workprovince'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_choice['workcity'] = $members_choice['workprovince'];
        $members_choice['workprovince'] = 10101000;
    }
    $members_choice['marriage'] = MoogetGPC('marriage2', 'integer', 'P');
    $members_choice['education'] = MoogetGPC('education2', 'integer', 'P');
    $members_choice['children'] = MoogetGPC('children2', 'integer', 'P');
    $members_choice['salary'] = MoogetGPC('salary1', 'integer', 'P');
    $members_choice['height1'] = MoogetGPC('height1', 'integer', 'P');
    $members_choice['height2'] = MoogetGPC('height2', 'integer', 'P');
    $members_choice['hasphoto'] = MoogetGPC('hasphoto', 'integer', 'P');
    $members_choice['nature'] = MoogetGPC('nature2', 'integer', 'P');
    $members_choice['body'] = MoogetGPC('body2', 'integer', 'P');
    $members_choice['weight1'] = MoogetGPC('weight1', 'integer', 'P');
    $members_choice['weight2'] = MoogetGPC('weight2', 'integer', 'P');
    $members_choice['occupation'] = MoogetGPC('occupation2', 'integer', 'P');
    $members_choice['nation'] = MoogetGPC('stock2', 'integer', 'P');
    $members_choice['hometownprovince'] = MoogetGPC('hometownProvince2', 'integer', 'P');
    $members_choice['hometowncity'] = MoogetGPC('hometownCity2', 'integer', 'P');
    if (in_array($members_choice['hometownprovince'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_choice['hometowncity'] = $members_choice['hometownProvince'];
        $members_choice['hometownprovince'] = 10101000;
    }
    $members_choice['wantchildren'] = MoogetGPC('wantchildren2', 'integer', 'P');
    $members_choice['smoking'] = MoogetGPC('issmoking', 'integer', 'P');
    $members_choice['drinking'] = MoogetGPC('isdrinking', 'integer', 'P');
    $members_introduce['introduce_check'] = safeFilter(trim(MoogetGPC('introduce', 'string', 'P')));
    $rs = $user_arr;
    //note 验证状态
    if (MOOPHP_ALLOW_FASTDB) {
        $sta = MooFastdbGet('certification', 'uid', $uid);
    } else {
        $sta = $_MooClass['MooMySQL']->getOne("select telphone from {$dbTablePre}certification WHERE uid='{$uid}'", true);
    }
    $where_arr = array('uid' => $uid);
    foreach ($members_search as $key => $val) {
        //无手机号吗
        if ($key == 'telphone' && $val == '') {
            continue;
        }
        $memberssearch[$key] = $val;
    }
    //	foreach ($members_base as $key=>$val){
    //		$membersbase[$key]=$val;
    //	}
    if (count($members_base) >= 1 || count($memberssearch) >= 1) {
        $members_search['updatetime'] = time();
        if (!rtrim($members_search['nickname'])) {
            MooMessage('昵称必填', 'javascript:history.go(-1)');
        }
        if (preg_match('/^(1[345]\\d{9})|(18[024-9]\\d{8})|(010-?\\d{8})|(02)[012345789]-?\\d{8}|(0[3-9]\\d{2,2}-?\\d{7,8})|(.*@.*)$/', $members_search['nickname'])) {
            MooMessage("昵称不符合规范!", "javascript:history.go(-1)");
        }
        //echo 'sss';exit;
        str_length($members_search['nickname']);
        //note 昵称截取
        $members_search['nickname'] = MooCutstr($members_search['nickname'], 18, $dot = '');
        if ($members_search['telphone'] && !preg_match('/^((1[345]\\d{9})|(18[0-9]\\d{8}))$/', $members_search['telphone'])) {
            MooMessage('请输入正确的手机号码', 'javascript:history.go(-1)');
        }
        //$birth=strtotime("$birthyear/$birthmonth/$birthday");
        $birth = "{$birthyear}-{$birthmonth}-{$birthday}";
        $members_base['birth'] = $birth;
        updatetable('members_base', $members_base, $where_arr);
        updatetable('members_search', $memberssearch, $where_arr);
        if (MOOPHP_ALLOW_FASTDB) {
            MooFastdbUpdate('members_base', 'uid', $uid, $members_base);
            MooFastdbUpdate('members_search', 'uid', $uid, $memberssearch);
        }
        //searchApi("members_man members_women")->UpdateAttributes(array($uid=>$members_search));
    }
    //提交会员动态makui
    UpdateMembersSNS($uid, '修改了资料');
    //内心独白必填
    //if(rtrim($update2_arr['introduce_check'] != '')){
    $members_introduce['introduce'] = '';
    $members_introduce['introduce_pass'] = '******';
    //if(isset($members_choice)){
    $members_choice['updatetime'] = time();
    updatetable('members_choice', $members_choice, $where_arr);
    //}
    updatetable('members_introduce', $members_introduce, $where_arr);
    if (MOOPHP_ALLOW_FASTDB) {
        $members_choice['uid'] = $uid;
        $members_introduce['uid'] = $uid;
        //print_r($update2_arr);exit;
        if (isset($members_choice)) {
            $members_choice['updatetime'] = time();
            MooFastdbUpdate('members_choice', 'uid', $uid, $members_choice);
        }
        MooFastdbUpdate('members_introduce', 'uid', $uid, $members_introduce);
    }
    //searchApi("members_man members_women")->UpdateAttributes(array($uid=>$members_choice));
    if (MOOPHP_ALLOW_FASTDB) {
        $userchoice = MooFastdbGet('members_choice', 'uid', $uid);
        $introduce = MooFastdbGet('members_introduce', 'uid', $uid);
        $userchoice = array_merge($userchoice, $introduce);
    } else {
        $userchoice = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}members_choice mc left join {$dbTablePre}members_introduce mi WHERE mc.uid=mi.uid AND uid = '{$uid}'", true);
    }
    //}else{
    //	MooMessage("内心独白必填!", "index.php?n=material&h=upinfo");
    //}
    /*
    //低质量会员自动分配
    if($user_rank_id == 0){
    	//以下信息都没选,都规为垃圾会员,自动分配给普通客服
    	if($update1_arr['height']=='-1' || $update1_arr['salary']=='-1' || $update1_arr['children']=='-1' || $update1_arr['oldsex']=='-1' || $update2_arr['age1']=='-1' || $update2_arr['age2']=='-1' || $update2_arr['marriage'] == '-1' || $update2_arr['children'] == '-1' || $update2_arr['body'] == '-1'){
    		invalid_user_allotserver($uid);
    	}
    }
    */
    $actio = MoogetGPC('actio', 'integer', 'R');
    switch ($actio) {
        case 1:
            if ($rs['telphone'] == $members_search['telphone'] || $sta['telphone'] == '' || $members_search['telphone'] == '') {
                header("location:index.php?n=material&h=upinfo&actio=1");
            } else {
                //重新手机认证
                $sql = "update {$dbTablePre}certification  set telphone='' where uid='{$uid}'";
                $_MooClass['MooMySQL']->query($sql);
                $certif_arr['telphone'] = '';
                MooFastdbUpdate('certification', 'uid', $uid, $certif_arr);
                if (MOOPHP_ALLOW_FASTDB) {
                    if (MOOPHP_ALLOW_FASTDB) {
                        $certification_1 = MooFastdbGet('certification', 'uid', $userid);
                    } else {
                        $certification_1 = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}certification  WHERE uid = '{$userid}'", true);
                    }
                }
                MooMessage("您的手机信息有变动请再次通过我们的验证", 'index.php?n=myaccount&h=telphone');
            }
            break;
        default:
            header("location:index.php?n=material&h=upinfo");
            break;
    }
    //note 快速常用搜索表更新
    //fastsearch_update($userid,'1');
    //note 快速高级搜索表更新
    //fastsearch_update($userid,'2');
}
function str_is_empty($str)
{
    return str_length($str) === 0;
}
Exemple #4
0
 public function check_str($username)
 {
     $len = str_length($username, 1);
     if ($len < 2 || $len > 30) {
         $this->errorno = 'error_username_cha';
         return false;
     }
     $guestexp = '\\xA1\\xA1|\\xAC\\xA3|^Guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8';
     if ($len > 30 || $len < 2 || preg_match("/\\s+|^c:\\con\\con|[%,\\*\"\\s\\<\\>\\&]|{$guestexp}/is", $username)) {
         $this->errorcode = "含有非法字符";
         $this->errorno = 'error_username_cha';
         return false;
     }
     return true;
 }