Пример #1
0
function ajax_attend()
{
    global $_MooClass, $timestamp;
    $isattend = $_POST['isAttend'];
    $id = $_POST['aid'];
    $uid = $_POST['uid'];
    if ($id) {
        $sql = "update web_ahtv_reguser set isattend={$isattend} where id='{$id}'";
        $sql2 = "select certification from web_members_search where uid={$uid}";
        $rs = $_MooClass['MooMySQL']->getOne($sql2);
        $new_certi = isset($rs['certification']) && $rs['certification'] ? $rs['certification'] : 0;
        if ($_MooClass['MooMySQL']->query($sql)) {
            if ($isattend == 1) {
                $sql = "UPDATE web_members_search SET `certification`=`certification`+3  \n\t              WHERE uid='{$uid}' ";
                $str_arr = array($uid => array($new_certi + 3));
            } else {
                $sql = "UPDATE web_members_search SET `certification`=`certification`-3 WHERE uid='{$uid}' ";
                if ($new_certi - 3 < 0) {
                    $new_certi = 0;
                } else {
                    $new_certi = $new_certi - 3;
                }
                $str_arr = array($uid => array($new_certi));
            }
            $_MooClass['MooMySQL']->query($sql);
            searchApi('members_man members_women')->updateAttr(array('certification'), $str_arr);
            echo 'ok';
        } else {
            echo 'no';
        }
        //reset_integrity($uid);
    } else {
        echo 'no';
    }
}
Пример #2
0
function addphone()
{
    global $_MooClass, $dbTablePre, $user_arr, $userid, $serverid;
    $phone = $_GET['phone'];
    $value = array();
    if ($phone && preg_match('/^((1[35][\\d]{9})|(18[4689][\\d]{8}))$/', $phone)) {
        if ($_MooClass['MooMySQL']->query("update {$dbTablePre}members_search set telphone='{$phone}' where uid='{$userid}'")) {
            searchApi('members_man members_women')->updateAttr(array('telphone'), array($userid => array($phone)));
            //更新索引数据的属性值
            if (MOOPHP_ALLOW_FASTDB) {
                $value['phone'] = $phone;
                MooFastdbUpdate('members_search', 'uid', $userid, $value);
            }
            echo $phone;
        }
    } else {
        echo 0;
    }
}
Пример #3
0
function active_email()
{
    global $_MooClass;
    $uid = $u['uid'] = MooGetGPC('uid', 'string');
    $verifycode = MooGetGPC('verifycode', 'string');
    $username = $u['username'] = MooGetGPC('p', 'string');
    if ($verifycode == strtoupper(md5('hongniangwang' . $u['uid'] . $u['username']))) {
        $online_ip = GetIP();
        $t = time();
        $pass = md5('123456');
        $r = $_MooClass['MooMySQL']->getOne("select * from web_activelog where uid={$uid}  limit 1", true);
        if ($r['username'] == $username) {
            MooMessage("您已经激活过了", "index.php", "05");
        } else {
            //$_MooClass['MooMySQL']->query("update web_members_search,web_members_login set password='******',usertype=1,regdate='$t',last_login_time = '$t',login_meb = login_meb+1,lastip='$online_ip',lastvisit='$t'  where uid='$uid'");
            $_MooClass['MooMySQL']->query("update web_members_search as s,web_members_login as l set s.password='******',s.usertype=1,s.regdate='{$t}',l.last_login_time = '{$t}',l.lastip='{$online_ip}',l.lastvisit='{$t}'  where s.uid='{$uid}' and l.uid='{$uid}'");
            searchApi('members_man members_women')->updateAttr(array('usertype', 'regdate'), array($uid => array(1, $t)));
            $_MooClass['MooMySQL']->query("insert into web_activelog(uid,username,activetime) values('{$uid}','{$username}','{$t}')");
        }
        MooSetCookie('auth', MooAuthCode("{$uid}\t{$pass}", 'ENCODE'), 86400);
        MooSetCookie('username', $u['username'], time() + 3600);
        if (MOOPHP_ALLOW_FASTDB) {
            $user11 = MooFastdbGet('members_search', 'uid', $uid);
            $meb = $user11['login_meb'];
            $val_s = $val_l = array();
            $val_s['password'] = $pass;
            $val_s['usertype'] = 1;
            $val_s['regdate'] = $t;
            $val_l['last_login_time'] = $t;
            $val_l['login_meb'] = $meb + 1;
            $val_l['lMooFastdbUpdateastip'] = $online_ip;
            $val_l['lastvisit'] = $t;
            MooFastdbUpdate('members_search', 'uid', $uid, $val_s);
            //!!
            MooFastdbUpdate('members_login', 'uid', $uid, $val_l);
        }
        //$_MooClass['MooMySQL']->query("INSERT INTO `web_membersession` SET `username`= '$u[username]',`password`='$pass',`ip` = '$online_ip',`lastactive` = '$t',`uid` = '$uid'");
        MooMessage("验证激活成功", "index.php", "05");
    } else {
        MooMessage("参数有误!请注册", "index.php", "02");
    }
}
Пример #4
0
function system_adminmembers_move()
{
    global $dbTablePre, $_MooClass;
    $kefu_list = get_kefulist();
    $is_post = MooGetGPC('ispost', 'integer', 'G');
    $fromuser = MooGetGPC('fromuser', 'integer', 'G');
    if ($is_post && $fromuser) {
        $grade = MooGetGPC('grade', 'integer', 'G');
        $getuser = MooGetGPC('getuser', 'integer', 'G');
        $move_num = MooGetGPC('move_num', 'integer', 'G');
        if ($move_num) {
            $limit = "limit {$move_num}";
        }
        if ($grade) {
            $sql = "update {$dbTablePre}members_search m left join {$dbTablePre}member_admininfo a on m.uid=a.uid set m.sid={$getuser}  where m.sid={$fromuser} and a.effect_grade={$grade} {$limit}";
            $sql2 = "select m.uid as uid from {$dbTablePre}members_search m left join {$dbTablePre}member_admininfo a on m.uid=a.uid where m.sid={$fromuser} and a.effect_grade={$grade} {$limit}";
        } else {
            $sql = "update {$dbTablePre}members_search  set sid={$getuser}  where sid={$fromuser} {$limit}";
            $sql2 = "select uid from {$dbTablePre}members_search where sid={$fromuser} {$limit}";
        }
        $rs = $_MooClass['MooMySQL']->getAll($sql2);
        if (isset($rs) && $rs) {
            foreach ($rs as $k => $v) {
                $str_arr[$v] = array($getuser);
            }
            searchApi('members_man members_women')->updateAttr(array('sid'), $str_arr);
        }
        $_MooClass['MooMySQL']->query($sql);
        $num = $_MooClass['MooMySQL']->affectedRows();
        if ($num) {
            $sql = "update {$dbTablePre}admin_user set member_count=member_count-'{$num}' where uid={$fromuser}";
            $_MooClass['MooMySQL']->query($sql);
            $sql = "update {$dbTablePre}admin_user set member_count=member_count+'{$num}' where uid={$getuser}";
            $_MooClass['MooMySQL']->query($sql);
            serverlog(4, $GLOBALS['dbTablePre'] . "members_search", "{$GLOBALS['username']}将{$fromuser}号客服的{$num}个会员转出", $GLOBALS['adminid'], $uid);
        }
        salert("成功转移" . $num . "名会员", "index.php?action=system_adminmembers&h=move");
    }
    require_once adminTemplate('system_adminmembers_move');
}
Пример #5
0
function update_iswell_user($uid)
{
    global $_MooClass, $dbTablePre;
    $sql = "update {$dbTablePre}members_search set is_well_user=1 where uid={$uid}";
    searchApi('members_man members_women')->updateAttr(array('is_well_user'), array($uid => array(1)));
    $_MooClass['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        $value['is_well_user'] = 1;
        MooFastdbUpdate('members_search', 'uid', $uid, $value);
    }
}
Пример #6
0
function material_photo_upload()
{
    global $_MooClass, $dbTablePre, $userid, $user, $pic_size_arr, $user_arr, $memcached;
    $and_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : '';
    $uid = $_GET['uid'] = isset($_GET['uid']) ? $_GET['uid'] : '';
    if ($uid) {
        $userid = $mem_uid = $memcached->get('uid_' . $uid);
    }
    $checkuuid = check_uuid($and_uuid, $userid);
    if (!$checkuuid) {
        $error = "uuid_error";
        echo return_data($error, false);
        exit;
    }
    $user_arr = $user = MooMembersData($userid);
    $user_rank_id = get_userrank($userid);
    if (MOOPHP_ALLOW_FASTDB) {
        $usercer = MooFastdbGet('certification', 'uid', $userid);
    } else {
        $usercer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}certification WHERE uid='{$userid}' LIMIT 1 ", true);
    }
    if ($_POST['isupload'] == '1') {
        //note 设定用户id
        $memberid = $userid;
        //note 设定用户上传图片大小限制 最小10240字节 = 10k 最大419430字节 = 400K
        $minfilesize = 20480;
        $maxfilesize = 1024000;
        $filesize = $_FILES['userfile']['size'];
        if ($filesize > $maxfilesize) {
            $notice = "请上传小于1000KB的照片。";
            echo return_data($notice);
            exit;
        }
        if ($filesize < $minfilesize) {
            $notice = "请上传大于20KB的照片。";
            echo return_data($notice);
            exit;
        }
        //note 判断文件类型
        $flag = '';
        $true_type = file_type($_FILES['userfile']['tmp_name']);
        $extname = strtolower(substr($_FILES['userfile']['name'], strrpos($_FILES['userfile']['name'], '.') + 1));
        $images = array('/jpg/', '/jpeg/', '/gif/', '/png/', '/JPG/', '/JPEG/', '/GIF/', '/PNG/');
        if (in_array('/' . $extname . '/', $images)) {
            foreach ($images as $v) {
                //note http://ask.wangmeng.cn/question/76
                if (preg_match($v, $_FILES['userfile']['type']) && ('image/' . $true_type == $_FILES['userfile']['type'] || 'image/p' . $true_type == $_FILES['userfile']['type'] || 'image/x-' . $true_type == $_FILES['userfile']['type'])) {
                    $file_content = file_get_contents($_FILES['userfile']['tmp_name']);
                    $low_file_content = strtolower($file_content);
                    $pos = strpos($low_file_content, '<?php');
                    if ($pos) {
                        $notice = "照片中含有不安全信息请重新上传";
                        echo return_data($notice);
                        exit;
                    } else {
                        $flag = 1;
                    }
                }
            }
        }
        //echo $true_type,'_',$flag,'_',$_FILES['userfile']['type'];exit;
        if ($flag != 1) {
            $notice = "请上传JPEG,JPG,PNG或GIF格式";
            echo return_data($notice);
            exit;
        }
        //note 设定该用户最多上传20张图片(形象照除外)
        $maxuploadnum = 20;
        //note 查询出来的总数
        $query = $_MooClass['MooMySQL']->getOne("select count(1) as num from `{$dbTablePre}pic` where `uid` = '{$memberid}' AND `isimage` = '0'", true);
        $total = $query['num'];
        //note 还可以上传多少张
        $leave_num = $maxuploadnum - $total;
        if ($leave_num <= 0) {
            $notice = '您已经有' . $maxuploadnum . '张照片了,';
            if ($user_arr['mainimg']) {
                $notice .= '不可以再上传了。';
            } else {
                $notice .= '请在相册中选一张作为形象照。';
            }
            echo return_data($notice);
            exit;
        }
        //note 设定相册名
        $album = '';
        //note 设定全局路径
        $orgin = "orgin";
        //note 原图文件夹名
        $thumb_path = PIC_PATH;
        //图片路径
        $timestat = time();
        $thumb_datedir = date("Y", $timestat) . "/" . date("m", $timestat) . "/" . date("d", $timestat);
        //原图路径
        $main_img_path = $thumb_path . "/" . $thumb_datedir . "/" . $orgin . "/";
        //note 调用文件操作类库,建立无限级目录
        $mkdirs = MooAutoLoad('MooFiles');
        !is_dir($main_img_path) && $mkdirs->fileMake($main_img_path, 0777);
        //note 上传到指定目录(原图),并且获得上传后的文件描述
        $upload = MooAutoLoad('MooUpload');
        $upload->config(array('targetDir' => $main_img_path, 'saveType' => '0'));
        $files = $upload->saveFiles('userfile');
        //note 获得图片路径和缩略图的路径
        $imgurl = $files[0]['path'] . $files[0]['name'] . "." . $files[0]['extension'];
        if ($files[0]['extension'] == 'gif') {
            $output = imagecreatefromgif($imgurl);
            imagegif($output, $imgurl, 100);
            imagedestroy($output);
        }
        $imgurl2 = $files[0]['path'] . $files[0]['name'] . "_nowater." . $files[0]['extension'];
        @copy($imgurl, $imgurl2);
        //拷贝一张无水印图片(用于形象照)
        $pic_name = $files[0]['name'] . "." . $files[0]['extension'];
        $pic_name2 = $files[0]['name'] . "_nowater." . $files[0]['extension'];
        $first = new Imagick($imgurl);
        //写入水印
        $second = new Imagick('public/system/images/logo_original.png');
        //$second->setImageOpacity (0.4);//设置透明度
        $dw = new ImagickDraw();
        $dw->setGravity(Imagick::GRAVITY_SOUTHEAST);
        //设置位置
        //$dw->setGravity(Imagick::GRAVITY_SOUTH);//设置位置
        $dw->composite($second->getImageCompose(), 0, 0, 50, 0, $second);
        $first->drawImage($dw);
        $first->writeImage($imgurl);
        //将第一张图片的大小控制成我们需要的大小
        list($width, $height) = getimagesize($imgurl);
        $d = $width / $height;
        $off_wh = off_WH($width, $height);
        $new_width = $off_wh['width'];
        $new_height = $off_wh['height'];
        unset($off_wh);
        $big_path = $files[0]['path'];
        $big_name = $files[0]['name'] . '.' . $files[0]['extension'];
        $image = MooAutoLoad('MooImage');
        $image->config(array('thumbDir' => $big_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $pic_name, 'waterMarkMinWidth' => '41', 'waterMarkMinHeight' => '57', 'waterMarkStatus' => 9));
        $image->thumb($new_width, $new_height, $imgurl);
        $image->waterMark();
        //note 缩略无水印图片
        $image->config(array('thumbDir' => $big_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $pic_name2, 'waterMarkMinWidth' => '41', 'waterMarkMinHeight' => '57', 'waterMarkStatus' => 9));
        $image->thumb($new_width, $new_height, $imgurl2);
        $image->waterMark();
        $thumb1_width = $pic_size_arr["1"]["width"];
        $thumb1_height = $pic_size_arr["1"]["height"];
        $thumb2_width = $pic_size_arr["2"]["width"];
        $thumb2_height = $pic_size_arr["2"]["height"];
        $thumb3_width = $pic_size_arr["3"]["width"];
        $thumb3_height = $pic_size_arr["3"]["height"];
        //note 生成日期目录
        $thumb1_path = $thumb_path . "/" . $thumb_datedir . "/" . $thumb1_width . "_" . $thumb1_height . "/";
        $thumb2_path = $thumb_path . "/" . $thumb_datedir . "/" . $thumb2_width . "_" . $thumb2_height . "/";
        $thumb3_path = $thumb_path . "/" . $thumb_datedir . "/" . $thumb3_width . "_" . $thumb3_height . "/";
        !is_dir($thumb1_path) && $mkdirs->fileMake($thumb1_path, 0777);
        !is_dir($thumb2_path) && $mkdirs->fileMake($thumb2_path, 0777);
        !is_dir($thumb3_path) && $mkdirs->fileMake($thumb3_path, 0777);
        //note 缩略图文件名
        $thumb_filename = md5($files[0]['name']) . "." . $files[0]['extension'];
        $c = 41 / 57;
        if ($d > $c) {
            $thumb1_width = 41;
            $b = $width / $thumb1_width;
            $thumb1_height = $height / $b;
        } else {
            $thumb1_height = 57;
            $b = $height / $thumb1_height;
            $thumb1_width = $width / $b;
        }
        $image->config(array('thumbDir' => $thumb1_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $thumb_filename, 'waterMarkMinWidth' => '41', 'waterMarkMinHeight' => '57', 'waterMarkStatus' => 9));
        $image->thumb($thumb1_width, $thumb1_height, $imgurl);
        $image->waterMark();
        $c = 139 / 189;
        if ($d > $c) {
            $thumb2_width = 139;
            $b = $width / $thumb2_width;
            $thumb2_height = $height / $b;
        } else {
            $thumb2_height = 189;
            $b = $height / $thumb2_height;
            $thumb2_width = $width / $b;
        }
        $image->config(array('thumbDir' => $thumb2_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $thumb_filename, 'waterMarkMinWidth' => '139', 'waterMarkMinHeight' => '189', 'waterMarkStatus' => 9));
        $image->thumb($thumb2_width, $thumb2_height, $imgurl);
        $image->waterMark();
        $c = 171 / 244;
        if ($d > $c) {
            $thumb3_width = 171;
            $b = $width / $thumb3_width;
            $thumb3_height = $height / $b;
        } else {
            $thumb3_height = 244;
            $b = $height / $thumb3_height;
            $thumb3_width = $width / $b;
        }
        $image->config(array('thumbDir' => $thumb3_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $thumb_filename, 'waterMarkMinWidth' => '171', 'waterMarkMinHeight' => '244', 'waterMarkStatus' => 9));
        $image->thumb($thumb3_width, $thumb3_height, $imgurl);
        $image->waterMark();
        //note 设定是否是形象照 1为形象照,0为普通照
        $isimage = (int) $_POST['isimage'];
        $updatetime = time();
        if ($isimage === 1) {
            $_MooClass['MooMySQL']->query("update `{$dbTablePre}members_base` set `mainimg`='{$imgurl}',`pic_date` = '{$thumb_datedir}',`pic_name` = '{$pic_name}' where `uid` = '{$memberid}'");
            $_MooClass['MooMySQL']->query("update `{$dbTablePre}members_search` set images_ischeck='2'  where `uid` = '{$memberid}'");
            if (MOOPHP_ALLOW_FASTDB) {
                $image_arr = array();
                $image_arr['mainimg'] = $imgurl;
                $image_arr['pic_date'] = $thumb_datedir;
                $image_arr['pic_name'] = $pic_name;
                $members_search['images_ischeck'] = '2';
                MooFastdbUpdate('members_base', 'uid', $memberid, $image_arr);
                MooFastdbUpdate('members_search', 'uid', $memberid, $members_search);
            }
            searchApi("members_man members_women")->updateAttr(array('images_ischeck'), array($memberid => array(0)));
            UpdateMembersSNS($userid, '修改了形象照');
        }
        //note 写入相册表
        $isimage = 0;
        //web_members.mainimg == web_pic.imgurl 即形象照
        $_MooClass['MooMySQL']->query("insert into `{$dbTablePre}pic` set `uid` = '{$memberid}',`isimage` = '{$isimage}',`album` = '{$album}',`imgurl` = '{$imgurl}',`pic_date` = '{$thumb_datedir}',`pic_name` = '{$pic_name}'");
        //提交会员动态makui
        UpdateMembersSNS($userid, '修改了相册');
        $notice = "成功";
        echo return_data($notice);
        exit;
    } else {
        $user1 = $user_arr;
    }
}
Пример #7
0
index:<input type='text' name='index'/><br/>
会员id:<input type='text' name='uid'/><br/>
客服sid:<input type='text' name='sid'/><input type='submit' name='update2' value='也更新增量索引' /><br/>
</form>
</body>
</html>
<?php
error_reporting(0);
require 'config.php';
//note 加载框架
require 'framwork/MooPHP.php';
if (isset($_POST['uid'])){
	echo '<pre>';
	var_dump($_POST);
	echo '</pre>';
	$sp = searchApi($_POST['index']);
	echo $sp->index."</br>";
	if (isset($_POST['update'])){
		$fields = array('sid');
		$values = array(intval($_POST['uid'])=>array(intval($_POST['sid'])));
		$res = $sp->updateAttr($fields,$values);
			echo '<pre>';
	var_dump($res);
	echo '</pre>';
	}elseif(isset($_POST['update2'])){
		$fields = array('sid');
		$values = array(intval($_POST['uid'])=>array(intval($_POST['sid'])));
		$res = $sp->updateAttr2($fields,$values);
		echo '<pre>';
		var_dump($res);
		echo '</pre>';
Пример #8
0
<?php
error_reporting(0);
require 'config.php';

//note 加载框架
require 'framwork/MooPHP.php';
list($s,$m) = explode(' ', microtime());
$start = $s+$m;
//------------------------------------------------
$index = "choice";
$sp = searchApi($index);

$arr = array(array('marriage','4'));
$res = $sp->getResult();

var_dump($res['total']);
echo '<br/>';
//----------------------------------------------------
list($s,$m) = explode(' ', microtime());
$end = $s+$m;
echo $end-$start;
?>
Пример #9
0
function will_expire_vip()
{
    global $_MooClass, $dbTablePre;
    $sql_value2 = '';
    $time = strtotime('-7 day');
    $sql = "SELECT uid,endtime,sid FROM {$dbTablePre}members_search where endtime<'{$time}' and s_cid IN(20,30) LIMIT 5";
    $expire_members = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    if (empty($expire_members)) {
        exit('没有快到期的会员');
    }
    $sql2 = "INSERT INTO {$GLOBALS['dbTablePre']}admin_remark(sid,groupid,title,content,awoketime,dateline) VALUES";
    foreach ($expire_members as $member) {
        $dateline = time();
        $awoketime = $dateline + 600;
        $endtime = date('Y-m-d H:i:s', $member['endtime']);
        $sql_value2 .= "('{$member['sid']}','0','ID:{$member['uid']}vip会员快到期','{$member['uid']}会员到期时间为{$endtime}','{$awoketime}','{$dateline}'),";
    }
    $sql_value2 = substr($sql_value2, 0, -1);
    $sql2 .= $sql_value2;
    $GLOBALS['_MooClass']['MooMySQL']->query($sql2);
    //将过期vip会员自动转为普通会员
    $current_time = time();
    $sql = "select group_concat(uid) uid_list from {$dbTablePre}members_search WHERE endtime<'{$current_time}' AND s_cid IN(20,30)";
    $expire_user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    //写入日志
    $handle = "系统自动将{$expire_user['uid_list']}过期vip会员转为普通会员";
    $sql = "INSERT INTO {$dbTablePre}server_log SET type='4',tablename='web_members_search',handle='{$handle}',sid='0',time='{$current_time}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    //	var_dump($expire_user);
    //转为普通会员
    $sql = "UPDATE {$dbTablePre}members_search SET s_cid=40 WHERE endtime<'{$current_time}' AND s_cid IN(20,30) and usertype='1'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    $sql2 = "select uid from {$dbTablePre}members_search where endtime<'{$current_time}' AND s_cid IN(20,30) and usertype='1'";
    $rs = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql2);
    if (is_array($rs) && !empty($rs)) {
        foreach ($rs as $k => $v) {
            $str_arr[$v['uid']] = array(40);
        }
        searchApi('members_man members_women')->updateAttr(array('s_cid'), $str_arr);
    }
    //$sql = "SELECT uid FROM {$dbTablePre}members bgtime<$time WHERE s_cid IN(0,1)";
}
Пример #10
0
/**
 * 登录表单处理
 * 描述:
 */
function login_submit()
{
    global $_MooClass, $dbTablePre, $_MooCookie, $uuid, $memcached;
    $error = array();
    //noet 对提交的数据过滤
    if ($_POST) {
        $username = trim($_POST['username']);
        //		$username = "******";
        $md5_password = md5($_POST['password']);
        //		$md5_password = md5(123456);
        $cookietime = intval(isset($_POST['cookietime']) ? $_POST['cookietime'] : '');
        $remember_username = MooGetGPC('remember', 'integer', 'P');
    }
    /*****设置回转的页面*****/
    if (empty($_POST['username']) && empty($_POST['password'])) {
        //note 转至邮箱验证页
        $error = "用户名和密码为空";
        echo return_data($error, false);
        exit;
    }
    //note 用户名不能为空
    if (empty($_POST['username'])) {
        //note 转至邮箱验证页
        $error = "用户名为空";
        echo return_data($error, false);
        exit;
    }
    //note 密码不能为空
    if (empty($_POST['password'])) {
        //note 转至邮箱验证页
        $error = "密码为空";
        echo return_data($error, false);
        exit;
    }
    if (empty($error)) {
        $userid = 0;
        $sp = searchApi('members_man members_women');
        $limit = array(0, 1);
        //note 验证用户名,密码     enky
        if (is_numeric($username)) {
            if (strlen($username) == 11) {
                //判断手机号是否存在
                $filter = array();
                $filter[] = array('telphone', $username);
                if ($sp->getResultOfReset($filter, $limit)) {
                    $ids = $sp->getIds();
                    if (isset($ids[0])) {
                        $userid = $ids[0];
                    }
                }
            }
            if (!$userid) {
                //判断uid是否存在
                $filter = array();
                $filter[] = array('@id', $username);
                if ($sp->getResultOfReset($filter, $limit)) {
                    $ids = $sp->getIds();
                    if (isset($ids[0])) {
                        $userid = $ids[0];
                    }
                }
            }
            if (!$userid) {
                if ($user_one = $_MooClass['MooMySQL']->getOne("SELECT uid from `{$dbTablePre}members_base` where qq='{$username}'", true)) {
                    $userid = $user_one['uid'];
                }
            }
        } else {
            $filter = array();
            $filter[] = array('username', $username);
            if ($sp->getResultOfReset($filter, $limit)) {
                $ids = $sp->getIds();
                if (isset($ids[0])) {
                    $userid = $ids[0];
                }
            }
        }
        //note 用户名找不到
        if (!$userid) {
            $login_where = is_numeric($username) ? "uid='{$username}' or telphone='{$username}'" : "username='******'";
            $user_one = $_MooClass['MooMySQL']->getOne("SELECT uid from `{$dbTablePre}members_search` where {$login_where}", true);
            if ($user_one) {
                $userid = $user_one['uid'];
            } else {
                $error = "用户名不存在";
                echo return_data($error, false);
                exit;
            }
        }
        //获取
        $user = array_merge(MooGetData('members_login', 'uid', $userid), MooMembersData($userid));
        if ($user['is_lock'] != '1') {
            $error = "用户已经被锁定";
            echo return_data($error, false);
            exit;
        }
        //note 用户密码错误
        if ($user['uid'] && $user['password'] != $md5_password) {
            //note 转至邮箱验证页
            $error = "密码错误";
            echo return_data($error, FALSE);
            exit;
        }
        if (empty($error)) {
            //note 验证通过
            if ($user['uid'] && $user['password'] == $md5_password) {
                //生成随机唯一id,andriod用
                $userid = $user['uid'];
                $uuid = user_md5_id($user['uid']);
                $memcached->set('uuid_' . $userid, $uuid, 0, 0);
                $memcached->set('uid_' . $userid, $userid, 0, 0);
                $user['uuid'] = $uuid;
                if ($user['automatic'] == 1) {
                    MooSetCookie('auth', MooAuthCode("{$user['uid']}\t{$user['password']}", 'ENCODE'), 86400 * 7);
                } else {
                    MooSetCookie('auth', MooAuthCode("{$user['uid']}\t{$user['password']}", 'ENCODE'), 86400);
                }
                $user_sha = $_MooClass['MooMySQL']->getOne("SELECT lastvisit from `{$dbTablePre}members_login` where uid='{$userid}'");
                $s_time = $user_sha['lastvisit'];
                $ret_count = $_MooClass['MooMySQL']->getOne("SELECT count(uid) as c FROM {$dbTablePre}service_visitor WHERE uid >0 and visitorid = '{$userid}' AND who_del !=2 and visitortime > '{$s_time}' ");
                $shadow_numb = $ret_count['c'] ? $ret_count['c'] : 0;
                // MooSetCookie('auth','SDFSFGAFGD\AHFGHGHJ',86400);
                $time = time();
                $_MooClass['MooMySQL']->query("update {$dbTablePre}members_login set last_login_time = '{$time}',login_meb = login_meb+1,lastvisit='{$time}' where uid = '{$user['uid']}'");
                //更新最后登录时间
                //会员最后登录时间
                MooSetCookie('last_login_time', $time, 86400);
                //note 客服提醒
                if ($user['is_awoke'] == '1') {
                    $awoketime = time() + 120;
                    $sql = "INSERT INTO `{$dbTablePre}admin_remark` SET sid='{$user['sid']}',title='会员上线',content='ID:{$user['uid']}会员刚刚通过pc机上线,请联系',awoketime='{$awoketime}',dateline='{$GLOBALS['timestamp']}'";
                    $_MooClass['MooMySQL']->query($sql);
                }
                MooPlugins('ipdata');
                $online_ip = GetIP();
                if ($online_ip != $user['lastip']) {
                    $user_address = convertIp($online_ip);
                    include "./module/crontab/crontab_config.php";
                    foreach ($provice_list as $key => $provice_arr) {
                        if (strstr($user_address, $provice_arr) !== false) {
                            //if(){
                            $province = $key;
                            break;
                        }
                    }
                    if (empty($province)) {
                        $province = $current_user['province'];
                    }
                    //得到市对应的城市代号
                    foreach ($city_list as $city_key => $city_val) {
                        if (strstr($user_address, $city_val) !== false) {
                            $city = $city_key;
                            break;
                        }
                    }
                }
                MooSetCookie('province', $user['province'], 86400);
                MooSetCookie('city', $user['city'], 86400);
                $lastactive = time();
                $uid = $user['uid'];
                //note 更新用户的最近登录ip和最近登录时间
                $updatesqlarr = array('lastip' => $online_ip);
                $wheresqlarr = array('uid' => $uid);
                updatetable("members_login", $updatesqlarr, $wheresqlarr);
                if (MOOPHP_ALLOW_FASTDB) {
                    $val = array();
                    $val['lastip'] = $online_ip;
                    //$val['client']=0;
                    $val['last_login_time'] = $time;
                    $val['lastvisit'] = $time;
                    //$val['isOnline']=1;
                    MooFastdbUpdate('members_login', 'uid', $uid, $val);
                    //!!
                }
                //记录本次登录ip及上次的ip,及真实的最后访问时间
                $sql_ip = "SELECT last_ip,finally_ip FROM {$GLOBALS['dbTablePre']}member_admininfo WHERE uid='{$uid}'";
                $member_admin_info = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_ip);
                if (!empty($member_admin_info)) {
                    $sql_ip = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET last_ip='{$member_admin_info['finally_ip']}',finally_ip='{$online_ip}',real_lastvisit='{$lastactive}' WHERE uid='{$uid}'";
                } else {
                    $sql_ip = "INSERT INTO {$GLOBALS['dbTablePre']}member_admininfo SET finally_ip='{$online_ip}',uid='{$uid}',real_lastvisit='{$lastactive}'";
                }
                $GLOBALS['_MooClass']['MooMySQL']->query($sql_ip);
            }
        }
    }
    //资料完善度
    $all_len = 0;
    $user_arr = MooMembersData($uid);
    if ($uid) {
        $all_len = (int) (getUserinfo_per($user_arr) * 100);
    }
    $user['all_len'] = $all_len;
    $user['choice'] = MooGetData('members_choice', 'uid', $uid);
    if (MooGetphoto($user['uid'], 'com')) {
        $mainimg = MooGetphoto($user['uid'], 'com');
    }
    $user_sha = $_MooClass['MooMySQL']->getOne("SELECT telphone from `{$dbTablePre}certification` where uid='{$userid}'");
    if (empty($error)) {
        $user['telphonesha'] = isset($user_sha['telphone']) ? $user_sha['telphone'] : 0;
        $user['mainimg'] = $mainimg;
        $user['password'] = '';
        $user['regip'] = '';
        $user['qq'] = '';
        $user['msn'] = '';
        $user['telphone'] = '';
        $user['username'] = '';
        $user['numofvis'] = $shadow_numb;
        $ret_count1 = $_MooClass['MooMySQL']->getOne("SELECT count(s_uid) as c FROM {$dbTablePre}services WHERE s_uid = '{$userid}' and flag = '1' and s_uid_del='0' and s_status = '0' ", true);
        $total1 = $ret_count1['c'];
        //2009-11-22日修改(得到总数)
        $user['nummail'] = $total1;
        echo return_data($user, true);
        exit;
        //            echo "<pre>$return</pre>";exit;
    } else {
        $error = "用户名或密码错误";
        echo return_data($error, false);
        exit;
    }
}
Пример #11
0
/**
 * 普通会员搜索加入全权会员
 */
function GeneralUserSearch($index, $cond, $sort, $page, $pagesize, $code = 0, $offset = null)
{
    global $user_arr, $isselectarea, $isdispmore, $isresult;
    $search_attrs = array('city', 'province');
    $choice_attrs = array('workcity', 'workprovince');
    $cl = searchApi($index);
    $cl->setQueryType(false);
    $pagesize2 = (int) $pagesize / 2;
    foreach ($cond as $k => $v) {
        if ('usertype' == $v[0]) {
            unset($cond[$k]);
        }
    }
    $cond3 = $cond2 = $cond;
    $cond3[] = array('usertype', '1|3', false);
    if ($isselectarea && !$isdispmore) {
        $rs = $cl->getResultOfReset($cond3, array($offset, $pagesize), $sort);
        if (isset($rs['total_found']) && $rs['total_found']) {
            $total_found = $rs['total_found'];
        } else {
            $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"] . '&dm=1';
            header('Location:' . $currenturl);
            exit;
        }
    }
    if (!isset($total_found) || !$total_found) {
        $attrs = $search_attrs;
        if ($index == 'choice') {
            $attrs = $choice_attrs;
        }
        foreach ($attrs as $k => $v) {
            foreach ($cond3 as $key => $val) {
                if ($v == $val[0]) {
                    unset($cond3[$key]);
                    unset($cond2[$key]);
                    unset($cond[$key]);
                    break;
                }
            }
        }
        $rs = $cl->getResultOfReset($cond3, array($offset, $pagesize), $sort);
        if (isset($rs['total_found']) && $rs['total_found']) {
            $total_found = $rs['total_found'];
        }
        if ($total_found > 600) {
            $total_found = 600;
        }
    }
    if ($total_found) {
        //注册会员总数
        $cond[] = array('usertype', '1', false);
        $rs_reg = $cl->getResultOfReset($cond, array($offset, $pagesize), $sort);
        if (isset($rs_reg['total_found']) && $rs_reg['total_found']) {
            $total_reg = $rs_reg['total_found'];
        } else {
            $total_reg = 0;
        }
        $cond2[] = array('usertype', '3', false);
        $rs_col = $cl->getResultOfReset($cond2, array($offset, $pagesize), $sort);
        if (isset($rs_col['total_found']) && $rs_col['total_found']) {
            $total_col = $rs_col['total_found'];
        } else {
            $total_col = 0;
        }
        //$total_col = $total_found - $total_reg;
        $pagenum = ceil($total_found / $pagesize);
        //分页数
        if ($page > $pagenum) {
            $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
            $currenturl2 = preg_replace("/(&page=\\d+)/", '&page=' . $pagenum, $currenturl);
            header('Location:' . $currenturl2);
            exit;
        }
    } else {
        $total_found = 0;
    }
    //	var_dump($total_reg);
    //	var_dump($total_col);
    //计算分别取多少条
    $reg_page_num = ceil($total_reg / $pagesize2);
    $collection_page_num = ceil($total_col / $pagesize2);
    //	var_dump($reg_page_num);var_dump($collection_page_num);
    if ($reg_page_num > $collection_page_num) {
        if ($collection_page_num == 0) {
            $offset_col = 0;
            $pagesize_col = 0;
            $offset_reg = ($page - 1) * $pagesize;
            $pagesize_reg = $pagesize;
        } else {
            if ($page < $collection_page_num) {
                $offset_reg = ($page - 1) * $pagesize2;
                $pagesize_reg = $pagesize2;
                $offset_col = ($page - 1) * $pagesize2;
                $pagesize_col = $pagesize2;
            } elseif ($page == $collection_page_num) {
                $offset_reg = ($page - 1) * $pagesize2;
                $pagesize_reg = $pagesize - $total_col % $pagesize2;
                $offset_col = ($page - 1) * $pagesize2;
                $pagesize_col = $total_col % $pagesize2;
            } else {
                $offset_col = 0;
                $pagesize_col = 0;
                $offset_reg = ($collection_page_num - 1) * $pagesize2 + ($pagesize - $total_col % $pagesize2) + ($page - $collection_page_num - 1) * $pagesize;
                //前面页面显示3个的+中间显示不定项的+后面显示6个的
                $pagesize_reg = $pagesize;
            }
        }
    } elseif ($reg_page_num < $collection_page_num) {
        if ($reg_page_num == 0) {
            $offset_col = ($page - 1) * $pagesize;
            $pagesize_col = $pagesize;
            $offset_reg = 0;
            $pagesize_reg = 0;
        } else {
            if ($page < $reg_page_num) {
                $offset_reg = ($page - 1) * $pagesize2;
                $pagesize_reg = $pagesize2;
                $offset_col = ($page - 1) * $pagesize2;
                $pagesize_col = $pagesize2;
            } elseif ($page == $reg_page_num) {
                $offset_reg = ($page - 1) * $pagesize2;
                $pagesize_reg = $total_reg % $pagesize2;
                $offset_col = ($page - 1) * $pagesize2;
                $pagesize_col = $pagesize - $pagesize_reg;
            } else {
                $offset_col = ($reg_page_num - 1) * $pagesize2 + ($pagesize - $total_reg % $pagesize2) + ($page - $reg_page_num - 1) * $pagesize;
                //前面页面显示3个的+中间显示不定项的+后面显示6个的
                $pagesize_col = $pagesize;
                $offset_reg = 0;
                $pagesize_reg = 0;
            }
        }
    } elseif ($reg_page_num == $collection_page_num) {
        $offset_reg = ($page - 1) * $pagesize2;
        $pagesize_reg = $total_reg % $pagesize2;
        $offset_col = ($page - 1) * $pagesize2;
        $pagesize_col = $total_col % $pagesize2;
    }
    //	var_dump((int)$offset_reg);var_dump($pagesize_reg);var_dump($offset_col);var_dump($pagesize_col);
    if ($pagesize_reg) {
        $user_reg = sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize_reg, $code, $offset_reg);
        //注册会员
        if (!is_array($user_reg) || empty($user_reg)) {
            $user_reg = array();
        }
    }
    if ($pagesize_col) {
        $user_collect = sphinx_search2($cl, $index, $cond2, $sort, $page, $pagesize_col, $code, $offset_col);
        //采集会员
    }
    $gender = 1;
    if (isset($user_arr['gender']) && isset($user_arr['s_cid'])) {
        $gender = $user_arr['gender'];
    }
    if (!empty($user_reg) && !empty($user_collect)) {
        if ($gender) {
            $arr1 = $user_reg;
            $arr2 = $user_collect;
        } else {
            $arr2 = $user_reg;
            $arr1 = $user_collect;
        }
        isset($arr1[0]) && ($user_list[] = $arr1[0]);
        isset($arr2[0]) && ($user_list[] = $arr2[0]);
        isset($arr1[1]) && ($user_list[] = $arr1[1]);
        isset($arr2[1]) && ($user_list[] = $arr2[1]);
        isset($arr1[2]) && ($user_list[] = $arr1[2]);
        isset($arr2[2]) && ($user_list[] = $arr2[2]);
        isset($arr1[3]) && ($user_list[] = $arr1[3]);
        isset($arr2[3]) && ($user_list[] = $arr2[3]);
        isset($arr1[4]) && ($user_list[] = $arr1[4]);
        isset($arr2[4]) && ($user_list[] = $arr2[4]);
        isset($arr1[5]) && ($user_list[] = $arr1[5]);
        isset($arr2[5]) && ($user_list[] = $arr2[5]);
    } elseif (!empty($user_reg) && empty($user_collect)) {
        $user_list = $user_reg;
    } elseif (empty($user_reg) && !empty($user_collect)) {
        $user_list = $user_collect;
    } else {
        $user_list = array();
    }
    if (!empty($user_reg) || !empty($user_collect)) {
        $isresult = true;
    }
    //var_dump($user_list);
    return array('total' => $total_found, 'user' => $user_list);
}
Пример #12
0
function savePhoto($uid)
{
    global $dbTablePre;
    $msg = null;
    $x1 = MooGetGPC('x1', 'integer');
    $y1 = MooGetGPC('y1', 'integer');
    $x2 = MooGetGPC('x2', 'integer');
    $y2 = MooGetGPC('y2', 'integer');
    $width = MooGetGPC('width', 'integer');
    $height = MooGetGPC('height', 'integer');
    $photoimage = MooGetGPC('photoimage', 'string');
    $first_dir = substr($uid, -1, 1);
    $secend_dir = substr($uid, -2, 1);
    $third_dir = substr($uid, -3, 1);
    $forth_dir = substr($uid, -4, 1);
    $userpath = "../data/upload/userimg/" . $first_dir . "/" . $secend_dir . "/" . $third_dir . "/" . $forth_dir . "/";
    //$userpath="../data/upload/userimg/5/2/3/4/";
    //echo $userpath;
    if (!is_dir($userpath)) {
        $array = explode('/', $userpath);
        $count = count($array);
        for ($i = 0; $i < $count; $i++) {
            $msg .= $array[$i];
            if (!file_exists($msg)) {
                mkdir($msg, 0777);
            }
            $msg .= '/';
        }
    }
    //$newimages=resizeImage($photoimage,$width,$height,$x1,$y1,$uid);
    $sizearray = array(0 => array('width' => 320, 'height' => 400), 1 => array('width' => 171, 'height' => 212), 2 => array('width' => 100, 'height' => 125), 3 => array('width' => 60, 'height' => 75), 4 => array('width' => 50, 'height' => 63), 5 => array('width' => 110, 'height' => 138), 6 => array('width' => 100, 'height' => 125));
    $namearray = array(0 => 'big', 1 => 'mid', 2 => 'medium', 3 => 'small', 4 => 'page', 5 => 'com', 6 => 'index');
    $newimages = changesize($photoimage, $userpath, $x1, $y1, $width, $height, $uid, $sizearray, $namearray);
    //生成另外三种形象照
    /*$bigphoto=MooGetphotoAdmin($uid,'big');
      
      $thuid=$uid*3;
      //$userpath="../data/upload/userimg/";
      $arr=explode('.',$bigphoto);
      $jpg=$arr[count($arr)-1];
      $index_name=$thuid.'_'.'index.'.$jpg;
      $com_name  =$thuid.'_'.'com.'.$jpg;
      $page_name =$thuid.'_'.'page.'.$jpg;
      list($width,$height)=getimagesize($bigphoto);
      $d=$width/$height;
      $c=100/125;//100*125
      if($d>$c){
          $g1_width=100;
          $b=$width/$g1_width;
          $g1_height=$height/$b;
      }else{
          $g1_height=125;
          $b=$height/$g1_height;
          $g1_width=$width/$b;
      }
      ImagickResizeImage($bigphoto,$userpath.$index_name,$g1_width,$g1_height);
      $c=50/63;//100*125
      if($d>$c){
          $g2_width=50;
          $b=$width/$g2_width;
          $g2_height=$height/$b;
      }else{
          $g2_height=63;
          $b=$height/$g2_height;
          $g2_width=$width/$b;
      }
      ImagickResizeImage($bigphoto,$userpath.$page_name,$g2_width,$g2_height);
      $c=110/138;//100*125
      if($d>$c){
          $g3_width=110;
          $b=$width/$g3_width;
          $g3_height=$height/$b;
      }else{
          $g3_height=138;
          $b=$height/$g3_height;
          $g3_width=$width/$b;
      }
      ImagickResizeImage($bigphoto,$userpath.$com_name,$g3_width,$g3_height); */
    $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search SET `images_ischeck`=1  WHERE `uid`='{$uid}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    searchApi('members_man members_women')->updateAttr(array('images_ischeck'), array($uid => array(1)));
    //更新索引数据的属性值
    if (MOOPHP_ALLOW_FASTDB) {
        $value['images_ischeck'] = 1;
        MooFastdbUpdate("members_search", 'uid', $uid, $value);
    }
    $image_type_arr = array('mid', 'medium');
    /*foreach($image_type_arr as $image_type){
          $image_file=substr(MooGetphotoAdmin($uid,$image_type),3);       
          @file_get_contents("http://control.wjmax.com/cdn/services/rsPushService/addRefreshUrl?userName=zikou&password=zikou123hzn&hasEncrypt=false&pushUrl=http://www.7651.com/".$image_file);
      }*/
    sendusermessage($uid, "您的形象照已经通过红娘的审核", "形象照审核");
    serverlog(3, $dbTablePre . "members_search", $GLOBALS['username'] . "审核会员" . $uid . "的形象照成功", $GLOBALS['adminid'], $uid);
}
Пример #13
0
 }
 //如果支付金额不正确 ——不改变会员状态
 if ($total_fee_res < $total_money) {
     echo "success";
     exit;
 }
 //会员信息
 $sql = "SELECT nickname,telphone FROM {$dbTablePre}members_search WHERE uid='{$uid}'";
 $res = $_MooClass['MooMySQL']->getOne($sql, true);
 //联系方式
 $telephone = !empty($res['telphone']) ? $res['telphone'] : '';
 //更新会员等级 城市之星不用更改等级
 if ($attach != '2') {
     $sql_uid = "UPDATE {$dbTablePre}members_search SET s_cid='{$s_cid}'  WHERE uid='{$uid}'";
     $_MooClass['MooMySQL']->query($sql_uid);
     searchApi('members_man members_women')->updateAttr(array('s_cid'), array($uid => array($s_cid)));
 }
 //更新支付状态
 $sql_getpayid = "SELECT max(id) id FROM {$dbTablePre}payment_new WHERE order_id='{$out_trade_no}'";
 $getpayid = $_MooClass['MooMySQL']->getOne($sql_getpayid, true);
 $id = $getpayid['id'];
 $sql_pay = "UPDATE {$dbTablePre}payment_new SET pay_time='{$bgtime}',pay_info='{$bank_type}',apply_note='{$apply_note}',status='1',check_time='{$bgtime}',contact='{$telephone}' WHERE id='{$id}'";
 $_MooClass['MooMySQL']->query($sql_pay);
 //确认更改状态成功
 $sql_com_uid = "SELECT s_cid FROM {$dbTablePre}members_search WHERE uid='{$uid}'";
 $com_uid = $_MooClass['MooMySQL']->getOne($sql_com_uid, true);
 $sql_com = "SELECT status FROM {$dbTablePre}payment_new WHERE id='{$id}'";
 $confirm = $_MooClass['MooMySQL']->getOne($sql_com, true);
 //------------------------------
 //处理业务完毕
 //------------------------------
Пример #14
0
function make($uid, $usertype)
{
    global $_MooClass, $dbTablePre, $timestamp, $memcached;
    $time = time();
    $randdo = rand(1, 10);
    if ($randdo > 8) {
        return 0;
    } elseif ($randdo > 5) {
        //省内
        $address = "province";
    } else {
        //本市
        $address = "ctiy";
    }
    $lastmake = $memcached->get('lastmake' . $GLOBALS['MooUid']);
    if (empty($lastmake)) {
        $memcached->set('lastmake' . $GLOBALS['MooUid'], $time);
    } else {
        if ($lastmake + rand(100, 180) > $time) {
            return 0;
        } else {
            $memcached->replace('lastmake' . $GLOBALS['MooUid'], $time);
        }
    }
    //note 当前会员工作地
    if (MOOPHP_ALLOW_FASTDB) {
        $current_user = MooFastdbGet('members_search', 'uid', $uid);
    } else {
        $current_user = $_MooClass['MooMySQL']->getOne("select province,city,gender,birthyear from {$dbTablePre}members_search where uid='{$uid}'");
    }
    //note 与当前会员在同一工作地或同一省的会员
    $fgender = $current_user['gender'] == '0' ? '1' : '0';
    //取当前用户相反性别
    //note 与会员年龄上下相差5岁左右的
    if ($fgender == 1) {
        $age1 = $current_user['birthyear'] - 1;
        $age2 = $current_user['birthyear'] + 9;
    } else {
        $age1 = $current_user['birthyear'] - 9;
        $age2 = $current_user['birthyear'] + 1;
    }
    MooPlugins('ipdata');
    $ip = GetIP();
    $user_address = convertIp($ip);
    //$user_address="安徽省合肥市 电信";
    include "ework/include/crontab_config.php";
    foreach ($provice_list as $key => $provice_arr) {
        if (strpos($user_address, $provice_arr) !== false) {
            $province = $key;
            break;
        }
    }
    if (!$province) {
        $province = $current_user['province'];
    }
    $age_between = " AND mes1.birthyear>='{$age1}' AND mes1.birthyear<='{$age2}'";
    if ($fgender == '0') {
        //if($usertype=='1'){
        //$sql = "SELECT count(1) AS num FROM {$dbTablePre}membersfastsort_man WHERE  province='{$province}'  AND birthyear>='$age1' AND birthyear<='$age2' and images_ischeck=1";
        //}else{
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search WHERE  province='{$province}'  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1 and usertype=1";
        //}
    }
    if ($fgender == '1') {
        //if($usertype=='1'){//普通会员
        //$sql = "SELECT count(1) AS num FROM {$dbTablePre}membersfastsort_women WHERE  province='{$province}'  AND birthyear>='$age1' AND birthyear<='$age2' and images_ischeck=1";
        //}else{//高级会员产生的浏览为本站的
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search WHERE  province='{$province}'  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1 and usertype=1";
        //}
    }
    if (MOOPHP_ALLOW_FASTDB) {
        global $fastdb;
        $md5_sql1 = md5($sql);
        $inprovince = unserialize($fastdb->get($md5_sql1));
        if (!$inprovince || $inprovince['last_time'] < time()) {
            $inprovince = $_MooClass['MooMySQL']->getOne($sql);
            $inprovince['last_time'] = time() + 3600 * 24 * 7;
            $fastdb->set($md5_sql1, serialize($inprovince));
        }
    } else {
        $inprovince = $_MooClass['MooMySQL']->getOne($sql);
    }
    $rand = $inprovince['num'] > 60 ? $inprovince['num'] : 30000;
    $rand = mt_rand(1, $rand);
    $arrUser = array();
    /*if($inprovince['num']>60){	
    		if($fgender == '0'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_man AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1  LIMIT {$rand},1";
    			//}else{
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    		
    		if($fgender == '1'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_women AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    
    		$arrUser = $_MooClass['MooMySQL']->getOne($sql);//mes1.uid >= mes2.uid		
        }else{
    		if($fgender == '0'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_man AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    		
    		if($fgender == '1'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_women AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}		
    		$arrUser = $_MooClass['MooMySQL']->getOne($sql);//mes1.uid >= mes2.uid
    		
    	}*/
    $cl = searchApi('members_man members_women');
    if ($user['num'] > 60) {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            $cond[] = array('province', $province, false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $sort = 'city desc';
            $rs_total = $cl->getResult($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResult($cond, $limit, $sort);
        }
    } else {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            //$cond[] = array('province',$province,false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $sort = 'province desc,city desc';
            $rs_total = $cl->getResult($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResult($cond, $limit, $sort);
        }
    }
    if (is_array($rs) && isset($rs['matches']) && !empty($rs['matches'])) {
        $ids = $cl->getIds();
        //print_r($ids);
        if (!empty($ids)) {
            $arrUser['uid'] = $ids[0];
        }
        //$arrUser = $_MooClass ['MooMySQL']->getOne($sql,true);
    }
    if ($arrUser && !MooGetScreen($arrUser['uid'], $uid)) {
        $nowtime = time();
        if (MOOPHP_ALLOW_FASTDB) {
            $user = MooFastdbGet('members_search', 'uid', $arrUser['uid']);
            $time = time() - 600;
            if ($user['lastvisit'] < $time) {
                $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
            }
            $val = array();
            $val['lastvisit'] = $nowtime;
            MooFastdbUpdate('members_login', 'uid', $arrUser['uid'], $val);
            //!!
        } else {
            $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
        }
        $result = $_MooClass['MooMySQL']->getOne("SELECT `vid` FROM `{$dbTablePre}service_visitor` WHERE uid='{$arrUser['uid']}' AND visitorid='{$uid}' AND `who_del`!=2");
        if ($result['vid']) {
            $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}service_visitor` SET `visitortime`='{$nowtime}' WHERE `vid`={$result['vid']}");
        } else {
            $_MooClass['MooMySQL']->query("INSERT INTO `{$dbTablePre}service_visitor` SET `uid`='{$arrUser['uid']}',`visitorid`='{$GLOBALS['MooUid']}',`visitortime`='{$nowtime}',`who_del`=1");
        }
    }
    /*	return 	$arrUser?$arrUser:0;*/
}
Пример #15
0
/**
 * 登录表单处理
 * 描述:
 */
function login_submit()
{
    global $_MooClass, $dbTablePre, $_MooCookie, $timestamp;
    //noet 对提交的数据过滤
    if (MooGetGPC('btnLogin', 'string', 'P') || MooGetGPC('loginsubmit', 'string', 'P')) {
        $username = MooGetGPC('username', 'string', 'P');
        $password = MooGetGPC('password', 'string', 'P');
        $username = trim($username);
        $md5_password = md5($password);
        $cookietime = intval(MooGetGPC('cookietime', 'string', 'P') ? MooGetGPC('cookietime', 'string', 'P') : '');
        $remember_username = MooGetGPC('remember', 'integer', 'P');
    }
    /*****设置回转的页面*****/
    $returnurl = MooGetGPC('returnurl', 'string', "P");
    $userid = 0;
    $sp = searchApi('members_man members_women');
    $limit = array(0, 1);
    //note 验证用户名,密码     enky
    if (is_numeric($username)) {
        if (strlen($username) == 11) {
            //判断手机号是否存在
            $filter = array();
            $filter[] = array('telphone', $username);
            if ($sp->getResultOfReset($filter, $limit)) {
                $ids = $sp->getIds();
                if (isset($ids[0])) {
                    $userid = $ids[0];
                }
            }
        }
        if (!$userid) {
            //判断uid是否存在
            $filter = array();
            $filter[] = array('@id', $username);
            if ($sp->getResultOfReset($filter, $limit)) {
                $ids = $sp->getIds();
                if (isset($ids[0])) {
                    $userid = $ids[0];
                }
            }
        }
        if (!$userid) {
            if ($user_one = $_MooClass['MooMySQL']->getOne("SELECT uid from `{$dbTablePre}members_base` where qq='{$username}'", true)) {
                $userid = $user_one['uid'];
            }
        }
    } else {
        $filter = array();
        $filter[] = array('username', $username);
        if ($sp->getResultOfReset($filter, $limit)) {
            $ids = $sp->getIds();
            if (isset($ids[0])) {
                $userid = $ids[0];
            }
        }
    }
    //note 用户名找不到
    if (!$userid) {
        $login_where = is_numeric($username) ? "uid='{$username}' or telphone='{$username}'" : "username='******'";
        $user_one = $_MooClass['MooMySQL']->getOne("SELECT uid from `{$dbTablePre}members_search` where {$login_where}", true);
        if ($user_one) {
            $userid = $user_one['uid'];
        } else {
            //note 转至邮箱验证页
            if ($returnurl) {
                MooMessage("用户名不存在", "{$returnurl}", '01');
            } else {
                MooMessage("用户名不存在", "login.html", '01');
            }
        }
    }
    //获取
    $user = array_merge(MooGetData('members_login', 'uid', $userid), MooMembersData($userid));
    if ($user['is_lock'] != '1') {
        MooMessage("很抱歉您的用户名已经被锁定!<br>请联系真爱一生网客服:<b>400-8787-920</b>", "{$returnurl}", '01', 6);
    }
    //note 用户密码错误
    if ($user['uid'] && $user['password'] != $md5_password) {
        //note 转至邮箱验证页
        if ($returnurl) {
            MooMessage("用户密码错误", "{$returnurl}", '01');
        } else {
            MooMessage("用户密码错误", "login.html", '01');
        }
        exit;
    }
    //note 验证通过
    if ($user['uid'] && $user['password'] == $md5_password) {
        if ($user['automatic'] == 1) {
            MooSetCookie('auth', MooAuthCode("{$user['uid']}\t{$user['password']}", 'ENCODE'), 86400 * 7);
        } else {
            MooSetCookie('auth', MooAuthCode("{$user['uid']}\t{$user['password']}", 'ENCODE'), 86400);
        }
        // MooSetCookie('auth','SDFSFGAFGD\AHFGHGHJ',86400);
        $time = time();
        $_MooClass['MooMySQL']->query("update {$dbTablePre}members_login set last_login_time = '{$time}',login_meb = login_meb+1,lastvisit='{$time}' where uid = '{$user['uid']}'");
        //更新最后登录时间
        //会员最后登录时间
        MooSetCookie('last_login_time', $time, 86400);
        //note 客服提醒
        if ($user['is_awoke'] == '1') {
            $awoketime = time() + 120;
            $sql = "INSERT INTO `{$dbTablePre}admin_remark` SET sid='{$user['sid']}',title='会员上线',content='ID:{$user['uid']}会员刚刚通过pc机上线,请联系',awoketime='{$awoketime}',dateline='{$GLOBALS['timestamp']}'";
            $_MooClass['MooMySQL']->query($sql);
        }
        //note 记住用户名
        if ($remember_username == 1) {
            MooSetCookie('username', $username, time() + 3600);
        } else {
            MooSetCookie('username', $username, -1200);
        }
        MooPlugins('ipdata');
        $online_ip = GetIP();
        if ($online_ip != $user['lastip']) {
            $user_address = convertIp($online_ip);
            include "./module/crontab/crontab_config.php";
            foreach ($provice_list as $key => $provice_arr) {
                if (strstr($user_address, $provice_arr) !== false) {
                    //if(){
                    $province = $key;
                    break;
                }
            }
            if (empty($province)) {
                $province = $current_user['province'];
            }
            //得到市对应的城市代号
            foreach ($city_list as $city_key => $city_val) {
                if (strstr($user_address, $city_val) !== false) {
                    $city = $city_key;
                    break;
                }
            }
        }
        MooSetCookie('province', $user['province'], 86400);
        MooSetCookie('city', $user['city'], 86400);
        $lastactive = time();
        $uid = $user['uid'];
        //note 更新用户的最近登录ip和最近登录时间
        $updatesqlarr = array('lastip' => $online_ip, 'lastvisit' => $lastactive);
        $wheresqlarr = array('uid' => $uid);
        updatetable("members_login", $updatesqlarr, $wheresqlarr);
        if (MOOPHP_ALLOW_FASTDB) {
            $val = array();
            $val['lastip'] = $online_ip;
            //$val['client']=0;
            $val['last_login_time'] = $time;
            $val['lastvisit'] = $time;
            //$val['isOnline']=1;
            MooFastdbUpdate('members_login', 'uid', $uid, $val);
            //!!
        }
        //记录本次登录ip及上次的ip,及真实的最后访问时间
        $sql_ip = "SELECT last_ip,finally_ip FROM {$GLOBALS['dbTablePre']}member_admininfo WHERE uid='{$uid}'";
        $member_admin_info = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_ip);
        if (!empty($member_admin_info)) {
            $sql_ip = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET last_ip='{$member_admin_info['finally_ip']}',finally_ip='{$online_ip}',real_lastvisit='{$lastactive}' WHERE uid='{$uid}'";
        } else {
            $sql_ip = "INSERT INTO {$GLOBALS['dbTablePre']}member_admininfo SET finally_ip='{$online_ip}',uid='{$uid}',real_lastvisit='{$lastactive}'";
        }
        $GLOBALS['_MooClass']['MooMySQL']->query($sql_ip);
        //note 先删除表里面已存在对应用户的session
        //$_MooClass['MooMySQL']->query("DELETE FROM `{$dbTablePre}membersession` WHERE `uid` = '$uid'");
        //删除过期SESSION
        //$date=time()-1200;
        //$_MooClass['MooMySQL']->query("DELETE FROM `{$dbTablePre}membersession` WHERE lastactive<'$date'");
        //$_MooClass['MooMySQL']->query("REPLACE INTO `{$dbTablePre}membersession` SET `username`= '$user[username]',`password`='$user[password]',`ip` = '$online_ip',`lastactive` = '$lastactive',`uid` = '$uid'");
        //发送短信提醒关注的会员上线了
        //fanglin暂时屏蔽
        /*if($_MooCookie['iscontact'] != "yes"){
        		   MooSend_Contact($uid,$user['gender'],"system");
        		}
        
        
        		//note 伪造用户访问
        		$selectuser=selectuser($user['province'],$user['city'],$user['birthyear'],$user['gender']);
        		$time=strtotime(date('Y-m-d'))-24*60*60;
        		for($i=0;$i<count($selectuser);$i++){
        		      $result=$_MooClass['MooMySQL']->getOne("SELECT `uid` FROM `".$dbTablePre."service_visitor` WHERE `uid`='".$selectuser[$i]['uid']."' AND `visitorid`='".$user['uid']."' AND `who_del`!=2");
        		      if($result['uid']==''){
        		              $_MooClass['MooMySQL']->query("INSERT INTO `".$dbTablePre."service_visitor` SET `uid`='".$selectuser[$i]['uid']."',`visitorid`='".$user['uid']."',`visitortime`='".$time."',`who_del`=1");
        		      }else $_MooClass['MooMySQL']->query("UPDATE `".$dbTablePre."service_visitor` SET `visitortime`='".$time."' WHERE `uid`='".$selectuser[$i]['uid']."' AND `visitorid`='".$user['uid']."'");
        
        		}*/
        //note 转至邮箱验证页
        if ($returnurl) {
            //header("Location:".$returnurl);
            echo "<script>location.href='{$returnurl}';</script>";
        } else {
            //header("Location:service.html");
            echo "<script>location.href='service.html';</script>";
        }
        exit;
    }
}
Пример #16
0
function sphinx_search($filters, $limits, $sorts)
{
    if (isset($filters['uid'])) {
        return array('total' => 0);
    }
    if ($limits[0] + $limits[1] >= 1000) {
        return array('total' => 0);
    }
    $allow_sorts = array('uid', 'birthyear', 'images_ischeck', 'regdate', 'sid', 'is_lock');
    $sort = '';
    if (!empty($sorts)) {
        $sort = str_replace('order by ', '', $sorts);
        $sort_arr = explode(' ', trim($sort));
        if (!in_array($sort_arr[0], $allow_sorts)) {
            return array('total' => 0);
        }
        $sort = str_replace('uid', '@id', $sort);
    }
    $filter = array();
    $index = !isset($filters['gender']) || $filters['gender'] == 3 ? 'members_women  members_man' : ($filters['gender'] == 1 ? 'members_women' : 'members_man');
    unset($filters['gender']);
    foreach ($filters as $key => $value) {
        if (strpos($key, 'in') && strpos($key, '(')) {
            list($key, $value) = explode('in', $key);
            $key = trim($key);
            $value = str_replace(',', '|', str_replace(array('(', ')'), '', $value));
            $filter[] = array($key, $value);
        } else {
            $filter[] = array($key, $value);
        }
    }
    //过滤记忆uid
    if (isset($_GET['h']) && isset($_GET['action'])) {
        $remember_adminid = in_array($GLOBALS['groupid'], $GLOBALS['admin_service_arr']) ? '0' : $GLOBALS['adminid'];
        $uids = sphinx_remember_uids($_GET['action'] . '_' . $_GET['h'] . '_' . $remember_adminid);
        if (!empty($uids)) {
            $filter[] = array('@id', implode('|', $uids), true);
        }
    }
    //exit;
    $sp = searchApi($index);
    $sp->setQueryType(true);
    $sp->getResultOfReset($filter, $limits, $sort);
    $total = $sp->getRs('total_found');
    $member_list = array();
    if ($total > 0 && ($uids = $sp->getIds())) {
        $where = 'where m.uid in (' . implode(',', $uids) . ')';
        $member_list = get_member_list($where, $sorts);
    }
    return array('total' => $total, 'member_list' => $member_list);
}
Пример #17
0
function invalid_user_allotserver($uid)
{
    global $_MooClass, $dbTablePre;
    if (MooMembersData($uid, 'is_lock') != 1 || MooMembersData($uid, 'usertype') != 1) {
        return FALSE;
    }
    //查询此会员是否分配过
    $user = $_MooClass['MooMySQL']->getOne("SELECT lastvisit FROM `" . $dbTablePre . "members_login` WHERE `uid`='" . $uid . "'");
    $user['sid'] = MooMembersData($uid, 'sid');
    /*
    $user=$_MooClass['MooMySQL']->getOne("SELECT `sid`,lastvisit FROM `".$dbTablePre."members_login` WHERE `uid`='".$uid."' AND is_lock = 1 AND usertype=1");
    */
    if ($user['sid'] == 0) {
        $time = strtotime(date('Y-m-d'));
        //查询可以分配给的客服
        $sql = "SELECT uid,member_count FROM {$dbTablePre}admin_user \n                WHERE\n                member_count<400 AND is_allot=1 AND\n                ( \n                ( allot_member<20 AND allot_time>'{$time}')\n                OR\n                ( allot_time<'{$time}')\n                )\n                ORDER BY member_count ASC,allot_member ASC LIMIT 1";
        $service_list = $_MooClass['MooMySQL']->getOne($sql);
        if (!empty($service_list)) {
            $timestamp = time();
            //更新members表中sid及分配时间
            $sql = "UPDATE {$dbTablePre}members_search SET sid='{$service_list['uid']}' WHERE uid='{$uid}'";
            $_MooClass['MooMySQL']->query($sql);
            searchApi('members_man members_women')->updateAttr(array('sid'), array($uid => array($service_list['uid'])));
            $sql = "UPDATE {$dbTablePre}members_base SET allotdate='{$timestamp}' WHERE uid='{$uid}'";
            $_MooClass['MooMySQL']->query($sql);
            //判断member_admininfo表中是否有此会员,没有时插入到后台扩展表
            $sql = "SELECT uid FROM {$GLOBALS['dbTablePre']}member_admininfo WHERE uid='{$uid}'";
            $member_admin_info = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
            if (empty($member_admin_info)) {
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}member_admininfo SET uid='{$uid}',effect_grade=1";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            }
            //更新后台客服表中对应客服的分配会员总数及当日分配总数
            $sql = "UPDATE {$dbTablePre}admin_user SET member_count=member_count+1,allot_member=allot_member+1,allot_time='{$timestamp}' WHERE uid='{$service_list['uid']}'";
            $_MooClass['MooMySQL']->query($sql);
        }
    }
}
Пример #18
0
function ajax_change_public_members()
{
    global $dbTablePre;
    $uid = MooGetGPC('uid', 'integer', 'G');
    $puid = MooGetGPC('puid', 'integer', 'G');
    $photo = MooGetGPC('photo', 'integer', 'G');
    $age2 = 24;
    $tmp_end = gmdate('Y', time()) - $age2;
    $age_condition = " birthyear>='{$tmp_end}'";
    $sql = "update {$dbTablePre}members_search set sid='{$uid}'  where sid='{$puid}' and" . $age_condition . " and gender='1'";
    $sql2 = "select uid from {$dbTablePre}members_search where sid='{$puid}' and" . $age_condition . " and gender=1";
    if ($photo == '1') {
        $sql .= "and images_ischeck='1'";
        $sql2 .= "and images_ischeck='1'";
    } else {
        $sql .= "and images_ischeck!='1'";
        $sql2 .= "and images_ischeck!='1'";
    }
    $res = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    $res2 = $GLOBALS['_MooClass']['MooMySQL']->query($sql2);
    if (is_array($res2) && !empty($res2)) {
        $str_arr = array();
        foreach ($res2 as $k => $v) {
            $str_arr[$v['uid']] = array($uid);
        }
        !empty($str_arr) && searchApi("members_man members_women")->updateAttr(array('sid'), $str_arr);
    }
    serverlog(3, $dbTablePre . 'members_search', $GLOBALS['adminid'] . "号客服一键将公海会员库的24岁以下女会员转到252名下", $GLOBALS['adminid']);
    salert("转换成功", 'index.php?action=allmember&h=advancesearch');
    exit;
}
Пример #19
0
function vipuser_star()
{
    $uid = MooGetGPC('uid', 'integer', 'G');
    $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search SET city_star=0 WHERE uid = {$uid}";
    if (MOOPHP_ALLOW_FASTDB) {
        $value['s_cid'] = 40;
        MooFastdbUpdate('members_search', 'uid', $uid, $value);
    }
    serverlog(3, $dbTablePre . "members_search", "{$GLOBALS['username']}将用户ID:{$uid}的城市之星取消", $GLOBALS['adminid'], $uid);
    if ($GLOBALS['_MooClass']['MooMySQL']->query($sql)) {
        searchApi('members_man members_women')->updateAttr(array('city_star'), array($uid => array(0)));
        echo "ok";
    } else {
        echo "error";
    }
    exit;
}
Пример #20
0
function ajax_dealuser()
{
    global $_MooClass, $dbTablePre;
    $dealuid = MooGetGPC('dealuid', 'integer');
    $senduid = MooGetGPC('senduid', 'integer');
    $id = MooGetGPC('id', 'integer');
    $type = MooGetGPC('type', 'integer');
    $content = MooGetGPC('content', 'string');
    if ($dealuid == '' || $senduid == '' || $id == '' || $type == '' || $content == '') {
        echo 'errors';
        exit;
    }
    $t = time();
    if ($type == 4) {
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_search SET is_lock='0'  WHERE uid='{$dealuid}'");
        searchApi("members_man members_women")->updateAttr(array('is_lock'), array($dealuid => array(0)));
        if (MOOPHP_ALLOW_FASTDB) {
            $value['is_lock'] = 0;
            MooFastdbUpdate('members_search', 'uid', $dealuid, $value);
        }
    } elseif ($type != 4 && $type != 1) {
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}services(s_cid,s_uid,s_fromid,s_title,s_content,s_time) VALUES('3','{$dealuid}','{$senduid}','会员投诉','尊敬的红娘用户,您已被会员投诉,我们非常期望红娘会员之间相互尊重,您的一言一行将可能影响您在其他会员中的印象,谢谢您的合作。','{$t}')");
    }
    $results = $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}services (s_cid,s_uid,s_fromid,s_title,s_content,s_time) VALUES('3','{$senduid}','','投诉回复','{$content}','{$t}')");
    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}report SET is_disabled='1' WHERE id='{$id}'");
    if ($results) {
        echo 'ok';
        exit;
    } else {
        echo 'errors';
        exit;
    }
}
Пример #21
0
function search_cityinline()
{
    global $_MooClass, $dbTablePre, $user_arr, $userid, $last_login_time;
    if (isset($user_arr['province'])) {
        $province = $user_arr['province'];
    }
    if (isset($user_arr['city'])) {
        $city = $user_arr['city'];
    }
    //页码
    $page = 1;
    if (isset($_GET['page'])) {
        $page = intval(max(1, $_GET['page']));
    }
    $pagesize = 4;
    $offset = ($page - 1) * $pagesize;
    //note sql语句
    $sql_gender = '';
    if (isset($user_arr['gender']) && $user_arr['gender'] == '0') {
        //$gender = '1';
        //$sql_gender = " and m.gender='1'";
        $index = 'members_women';
    } else {
        //$gender = '0';
        //$sql_gender = " and m.gender='0'";
        $index = 'members_man';
    }
    $cl = searchApi($index);
    //note 地区sql语句
    //	$sql_area = '';
    //	if($province == -1) $province = 0;
    //	if($city == -1) $city = 0;
    //	if($province != 0 && $city != 0){
    //		$sql_area = " and m.province='$province' and m.city='$city' ";
    //	}elseif($province == 0 && $city != 0){
    //		$sql_area = " and m.province='$province'";
    //	}elseif($province != 0 && $city == 0){
    //		$sql_area = " and m.city='$city'";
    //	}elseif($province == 0 && $city == 0){
    //		$sql_area = '';
    //	}else{
    //		$sql_area = '';
    //	}
    $cond = array();
    $cond[] = array('usertype', '1', false);
    //获得在线用户数据
    if (is_array($province) || is_array($city)) {
        $lastvisit = array();
    } else {
        $lastvisit = MooUserOnlineArea($province, $city);
    }
    //$lastvisit = array($province => array('1098212','1215687','1743145','1744119','1744358','1096623','1097401','1097732','1216122','1216529'));
    if (!is_array($lastvisit) || empty($lastvisit)) {
        MooMessage("对不起,当前没有在线的会员", "index.php?n=search");
    } else {
        $lastvisit_str = '';
        if (isset($lastvisit[$province]) && !empty($lastvisit[$province])) {
            $lastvisit_str = implode('|', $lastvisit[$province]);
        }
        if (isset($lastvisit[$city]) && !empty($lastvisit[$city])) {
            if ($lastvisit_str) {
                $lastvisit_str .= '|' . implode('|', $lastvisit[$city]);
            } else {
                $lastvisit_str = implode('|', $lastvisit[$city]);
            }
        }
        $cond[] = array('@id', $lastvisit_str, false);
    }
    if ($province) {
        $cond[] = array('province', $province, false);
    }
    if ($city) {
        $cond[] = array('city', $city, false);
    }
    //note 照片显示
    //$sql_photo = " and m.images_ischeck='1' and is_lock='1'";
    $cond[] = array('is_lock', '1', false);
    $cond[] = array('images_ischeck', '1', false);
    $sort_str = '@weight desc,s_cid desc,city_star desc,images_ischeck desc';
    //	$timestamp = time();
    //    $expiretime2 = $timestamp - 300;//过期时间
    //note 当前在线时间
    //	$time = time();
    //	$timemark = $time - 300;
    //	$sql_time = '';
    //	$sql_time = "m.lastvisit>'$timemark' ";
    //	$sql = " and usertype='1'".$sql_area.$sql_photo.$sql_gender;
    //	echo $sql;die;
    //	$sql_md5 = md5($sql); //md5保存sql
    //	$sql_search = "select id from `{$dbTablePre}member_tmp` where `condition_md5`='{$sql_md5}' and expiretime > '$expiretime2'";
    //    $ret_search = $_MooClass['MooMySQL']->getOne($sql_search);
    //	if($ret_search){
    //		$search_id = $ret_search['id'];
    //		cityinline_index($search_id);
    //	}else{
    $limit = array($offset, $pagesize);
    $rs = $cl->getResultOfReset($cond, $limit, $sort_str);
    if (isset($rs['total_found']) && $rs['total_found']) {
        //有数据
        $total = $rs['total_found'];
        $total_pages = ceil($total / $pagesize);
        $ids = $cl->getIds();
    } else {
        //没有数据降低条件
        $cond = array();
        $cond[] = array('usertype', '1', false);
        $cond[] = array('is_lock', '1');
        $cond[] = array('images_ischeck', '1');
        $cond[] = array('@id', $lastvisit_str, false);
        $rs = $cl->getResult($cond, $limit, $sort_str);
        if (isset($rs['total_found']) && $rs['total_found']) {
            $total = $rs['total_found'];
            $total_pages = ceil($total / $pagesize);
            $ids = $cl->getIds();
        }
    }
    //note 找不到匹配的结果返回单独提示页面
    if (!isset($ids) || empty($ids)) {
        include MooTemplate('public/search_error', 'module');
        exit;
    }
    $user_list = is_array($ids) && !empty($ids) ? implode(",", $ids) : '';
    if ($user_list) {
        $page = min($page, $total_pages);
        $order_by = "order by s_cid desc ,city_star desc, pic_num desc,images_ischeck desc ";
        $user = $_MooClass['MooMySQL']->getAll("select s.*,b.mainimg from `{$dbTablePre}members_search` s left join `{$dbTablePre}members_base` b on s.uid=b.uid where s.uid in ({$user_list}) {$order_by}");
    }
    if (!isset($html)) {
        $html = '';
    }
    if ($total > 4) {
        $url = 'index.php?n=search&h=cityinline';
        $pagebar = pagebar($page, $total_pages, $url, $html);
    }
    include MooTemplate('public/search_cityinline', 'module');
    exit;
    //		$total_count = $_MooClass['MooMySQL']->getOne("select count(*) as count from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //		$total = $total_count["count"];
    //		//echo $total;die;
    //		if($total>=1){
    //			if($total>=4){
    //				$user = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //			}else{
    //				$sql_province = " and usertype='1'"." and m.province='{$province}'".$sql_photo.$sql_gender;
    //				$user = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //			}
    //		}else{
    //			$sql1 = " and usertype='1'".$sql_photo.$sql_gender;
    //			$total1 = $_MooClass['MooMySQL']->getOne("select count(*) as count from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql1);
    //			if($total1<1){
    //				MooMessage("对不起,当前没有在线的会员", "index.php?n=search");
    //			}
    //			$user1 = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql1);
    //		}
    //		$user_list = "";
    //		if(!empty($user)){
    //			foreach ($user as $v) {
    //				$user_uid .= $v['uid'].',';
    //			}
    //			if(!empty($user_uid))
    //				$user_uid = substr($user_uid,0,-1);
    //			$user_list .= $user_uid;
    //		}
    //
    //		if(!empty($user1)){
    //			foreach ($user1 as $v){
    //				$user_uid2 .= $v['uid'].',';
    //			}
    //			if(!empty($user_uid2))
    //				$user_uid2 = substr($user_uid2,0,-1);
    //			$user_list .= '|'.$user_uid2;
    //		}
    //echo $user_list;die;
    //		$addtime = time();
    //        $expiretime = $addtime;
    //        $sql = "select id from `{$dbTablePre}member_tmp` where condition_md5 = '$sql_md5'";
    //        $ret = $_MooClass['MooMySQL']->getOne($sql);
    //        if (isset($ret['id']) && $ret['id']) {  //有则更新
    //            $search_id = $ret['id'];
    //            $_MooClass['MooMySQL']->query("update `{$dbTablePre}member_tmp` set search_uid='$userid' , uid_list='$user_list', addtime='$addtime',expiretime='$expiretime' where id='$search_id'");
    //        } else {    //无则插入
    //            $sql = "insert into `{$dbTablePre}member_tmp` set search_uid='$userid',condition_md5='$sql_md5',uid_list='$user_list',addtime='$addtime',expiretime='$expiretime'";
    //            $_MooClass['MooMySQL']->query($sql);
    //            $search_id = $_MooClass['MooMySQL']->insertId();
    //        }
    //		cityinline_index($search_id);
    //	}
}
Пример #22
0
function recommendMember()
{
    global $_MooClass, $dbTablePre, $timestamp, $memcached, $_MooCookie;
    $gender = !MooGetGPC('gender', 'integer', 'G') ? 0 : 1;
    //note 性别
    include_once "./module/crontab/crontab_config.php";
    $cur_ip = GetIP();
    //		$cur_ip = "202.120.2.200";//上海ip
    //		$cur_ip = "218.202.206.102";//新疆ip
    //$cur_ip = "218.70.178.197"; //重庆
    //		$cur_ip="221.130.166.242";
    MooPlugins('ipdata');
    $ip_arr = convertIp($cur_ip);
    //得到省份对应的数值,查库
    $province = $city = "";
    foreach ($provice_list as $key => $val) {
        if (strstr($ip_arr, $val)) {
            $province = $key;
            $currentdistrict = $val;
            break;
        }
    }
    if (isset($_GET['province'])) {
        foreach ($provice_list as $key => $val) {
            if ($_GET['province'] == $key) {
                $currentdistrict = $val;
                break;
            }
        }
    }
    //得到市对应的城市代号
    foreach ($city_list as $city_key => $city_val) {
        if (strstr($ip_arr, $city_val)) {
            $city = $city_key;
            break;
        }
    }
    if (isset($_GET['province'])) {
        $province = MooGetGPC('province', 'integer', 'G');
        //note 修正广东省深圳和广州的区域查询
        if (in_array($province, array(10101201, 10101002))) {
            $city = $province;
            $province = 10101000;
        }
        //修正直辖市查询
        if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
            $city = '0';
        }
        $sql = "SELECT * FROM {$dbTablePre}index_cachefile WHERE province='{$province}' AND city='{$city}'";
        $cachefile_list = $_MooClass['MooMySQL']->getAll($sql);
        foreach ($cachefile_list as $cachefile) {
            $cachefile['provincestarfile'] = rtrim($cachefile['provincestarfile'], '.data');
            if ($memcached->get($cachefile['provincestarfile'])) {
                $memcached->delete($cachefile['provincestarfile']);
            }
            $cachefile['citystarfile'] = rtrim($cachefile['citystarfile'], '.data');
            if ($memcached->get($cachefile['citystarfile'])) {
                $memcached->delete($cachefile['citystarfile']);
            }
            $cachefile['provinceotherfile'] = rtrim($cachefile['provinceotherfile'], '.data');
            if ($memcached->get($cachefile['provinceotherfile'])) {
                $memcached->delete($cachefile['provinceotherfile']);
            }
        }
    }
    $userList = array();
    //查市城市之星
    //note 修正广东省深圳和广州的区域查询
    if (in_array($province, array(10101201, 10101002))) {
        $city = $province;
        $province = 10101000;
    }
    $sql_city = "s.city='{$city}'";
    //修正直辖市查询
    if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
        $city = '0';
    }
    if ($city == 0) {
        $sql_city = "s.province='{$province}'";
    }
    if (!empty($city) || !empty($province)) {
        //默认没有进入  选择省后进入
        $sql = "SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base b on s.uid=b.uid  left join {$dbTablePre}members_introduce i on s.uid=i.uid WHERE s.images_ischeck=1 and s.s_cid='20' and s.gender='{$gender}' and ({$sql_city} AND s.is_lock=1 AND  s.nickname!='' AND i.introduce!='' AND s.showinformation=1 AND s.city_star>=1 AND s.usertype=1)  order by s.s_cid limit 6";
        //$userList = $_MooClass['MooMySQL']->getAll($sql);
        $param = "type=query/name=userlist_{$city}_citystar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        //
        $userList = $GLOBALS['_MooBlock']["userlist_{$city}_citystar"];
        //市缓存文件
        //$city_cachefile = "userlist_{$city}_citystar".'_'.md5($param).'.data';
    }
    //市无城市之星,从省取城市之星
    if (empty($userList)) {
        $sql = "select s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce from  {$dbTablePre}members_search as s left join {$dbTablePre}members_base b on s.uid=b.uid left join {$dbTablePre}members_introduce as i on s.uid=i.uid WHERE s.province='{$province}'\n\t\t\t          AND s.is_lock=1   and  s.gender='{$gender}' \n\t\t\t          AND s.images_ischeck = 1 AND s.showinformation=1 \n\t\t\t          and s.city_star>=1 and s.usertype=1 and i.introduce!='' ans s.nickname!='' LIMIT 6";
        //			$userList = $_MooClass['MooMySQL']->getAll($sql);
        $param = "type=query/name=userlist_{$province}_provincestar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        $userList = $GLOBALS['_MooBlock']["userlist_{$province}_provincestar"];
        //省缓存文件
        //$province_cachefile = "userlist_{$province}_provincestar".'_'.md5($param).'.data';
    }
    //城市之星不够取钻石会员(市->省->全国)
    $count = count($userList);
    if ($count < 6) {
        //默认进入
        $addarr = array('cityadd', 'provinceadd', 'countryadd');
        $user_in = '1747188|2154375|1600591|2159633|20782701|20785837|20561126|20305660|20910184';
        //城市之星uid
        $user_list = array();
        if (!is_array($userList)) {
            $userList = array();
        }
        //enky add
        foreach ($userList as $user) {
            $user_list[] = $user['uid'];
        }
        if (!empty($user_list)) {
            $user_in .= ',' . implode('|', $user_list);
        }
        //从(市->省->全国)取钻石会员
        $cityadd = array();
        $provinceadd = array();
        $countryadd = array();
        foreach ($addarr as $add) {
            if ($count < 6) {
                $id = '';
                //从市取
                if ($add == 'cityadd') {
                    if (!$city || $city == 0) {
                        continue;
                    }
                    $sql_add = "s.city='{$city}' and";
                    $id .= $city;
                }
                //从省取
                if ($add == 'provinceadd') {
                    if (!$province || $province == 0) {
                        continue;
                    }
                    $sql_add = "s.province='{$province}' and";
                    $id .= $province;
                }
                //全国取
                if ($add == 'countryadd') {
                    $sql_add = '';
                    $id .= 'country';
                }
                //取几个钻石会员
                $add_query_sum = 6 - $count;
                //enky need change
                $cl = searchApi('members_women members_man');
                $cond[] = array('is_lock', '1', false);
                $cond[] = array('images_ischeck', '1', false);
                $cond[] = array('gender', $gender, false);
                $cond[] = array('usertype', '1', false);
                //$cond[] = array('@id','20752315|'.$user_in,true);//uid
                $cond[] = array('s_cid', '20', false);
                $cond[] = array('city_star', '0', false);
                $cond[] = array('showinformation', '1', false);
                $cond[] = array('pic_num', array(1, 20), false);
                if ($province) {
                    array('province', $province, false);
                }
                if ($city) {
                    array('city', $city, false);
                }
                $limit = array($add_query_sum);
                $res_matches = $cl->getResult($cond, $limit);
                if ($res_matches) {
                    $count_res = count($res_matches);
                    $array_merge = array();
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i])) {
                            $ids[] = $res_matches['matches'][$i]['id'];
                        }
                    }
                    $sql_str = implode(',', $ids);
                    $nickname_res = $_MooClass['MooMySQL']->getAll("select nickname,uid from web_members_search where uid in " . "({$sql_str})");
                    $mainimg_res = $_MooClass['MooMySQL']->getAll("select mainimg from web_members_base where uid in " . "({$sql_str})");
                    $introduce_res = $_MooClass['MooMySQL']->getAll("select introduce from web_members_introduce where uid in " . "({$sql_str})");
                    //合并到sphinx查询出的整理后的数组
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i]['attrs'])) {
                            $res_matches['matches'][$i]['attrs']['nickname'] = $nickname_res[$i]['nickname'];
                            $res_matches['matches'][$i]['attrs']['uid'] = $nickname_res[$i]['uid'];
                            $res_matches['matches'][$i]['attrs']['mainimg'] = $mainimg_res[$i]['mainimg'];
                            $res_matches['matches'][$i]['attrs']['introduce'] = $introduce_res[$i]['introduce'];
                            $bigarr[] = $res_matches['matches'][$i]['attrs'];
                        }
                    }
                    ${$add} = $bigarr;
                } else {
                    $sql = "select s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce from {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid  left join {$dbTablePre}members_introduce as i on s.uid=i.uid where s.uid not in({$user_in})\n\t\t\t\t\t\t\t\t  AND {$sql_add} s.city_star=0 AND s.s_cid = 20  and s.gender=" . $gender . " \n\t\t\t\t\t\t\t\t  AND s.images_ischeck  = 1 AND s.is_lock = 1 AND s.showinformation = 1\n\t\t\t\t\t\t\t\t  AND s.pic_num >=1 AND s.usertype=1 AND i.introduce!='' AND s.nickname!=''  LIMIT {$add_query_sum}";
                    $param = "type=query/name=userlist_{$id}_other/sql={$sql}/cachetime=86400";
                    $_MooClass['MooCache']->getBlock($param);
                    ${$add} = $GLOBALS['_MooBlock']["userlist_{$id}_other"];
                }
                //已获取的首页会员uid
                $user_list = array();
                if (!is_array(${$add})) {
                    ${$add} = array();
                }
                //enky add
                foreach (${$add} as $user) {
                    $user_list[] = $user['uid'];
                }
                if (!empty($user_list)) {
                    $user_in .= ',' . implode(',', $user_list);
                }
                //echo $user_in;exit;
                //已有总数
                $count += count(${$add});
            }
        }
        //$countryadd  have data
        $userList = array_merge($userList, $cityadd, $provinceadd, $countryadd);
        //省其它类型会员缓存文件
        //$province_othercachefile = "userlist_{$id}_other".'_'.md5($param).'.data';
    }
    //生成的block缓存文件存库
    /* $city = $city ? $city : 0;
    		$sql = "SELECT * FROM {$dbTablePre}index_cachefile WHERE  province='{$province}' AND city='{$city}'";
    		$cache_arr = $_MooClass['MooMySQL']->getAll($sql);
    		
    		if(empty($cache_arr)){
    			$province_cachefile = isset($province_cachefile)?$province_cachefile:'';
    			$sql = "INSERT INTO {$dbTablePre}index_cachefile SET province='{$province}',city='{$city}',provincestarfile='{$province_cachefile}',citystarfile='{$city_cachefile}',provinceotherfile='{$province_othercachefile}'";
    			$_MooClass['MooMySQL']->query($sql);
    		}  */
    //推荐列表中如果存在,则以推荐列表中的指定的sort替换
    $sql = "SELECT * FROM {$dbTablePre}members_recommend WHERE  province='{$province}' AND city='{$city}' order by sort asc";
    $recommend_list = $_MooClass['MooMySQL']->getAll($sql);
    if (!empty($recommend_list)) {
        foreach ($recommend_list as $list) {
            $sort = $list['sort'] < 1 ? 0 : $list['sort'] - 1;
            if (MOOPHP_ALLOW_FASTDB) {
                $u = MooFastdbGet('members_search', 'uid', $list['uid']);
                $u2 = MooFastdbGet('members_base', 'uid', $list['uid']);
                if (is_array($u) && is_array($u2)) {
                    $u = array_merge($u, $u2);
                }
            } else {
                $sql = "SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid left join {$dbTablePre}members_introduce  as i on s.uid=i.uid WHERE s.uid='{$list['uid']}'";
                $u = $_MooClass['MooMySQL']->getOne($sql);
            }
            if ($u) {
                foreach ($userList as $key => $val) {
                    if ($list['uid'] == $val['uid']) {
                        $user_key = $key;
                        break;
                    }
                }
                if (isset($user_key)) {
                    if (isset($userList[$sort])) {
                        $userList[$key] = $userList[$sort];
                    }
                    $userList[$sort] = $u;
                } else {
                    $userList[$sort] = $u;
                }
            }
        }
    }
    //删除数组中多余的部分
    array_splice($userList, 6);
    $result = array();
    $imgSrcSmall = $imgSrcMid = $imgSrcUrl = '';
    foreach ($userList as $v) {
        $introduce = '';
        if (isset($v['introduce'])) {
            $introduce = MooCutstr($v['introduce'], 50, '...');
        }
        $imgSrcSmall = MooGetphoto($v['uid'], 'small');
        $imgSrcMid = MooGetphoto($v['uid'], 'mid');
        if ($imgSrcSmall) {
            $imgSrc = $imgSrcMid;
        } elseif ($v['gender'] == '1') {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        } else {
            $imgSrc = "module/index/templates/default/images/se_man.gif";
        }
        if (isset($v['mainimg']) && !empty($v['mainimg']) && isset($v['images_ischeck']) && $v['images_ischeck'] == 1) {
            $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src={$imgSrc} width=\"120\"/> </a>";
        } else {
            if (isset($v['gender']) && $v['gender']) {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_woman.gif\" /> </a> ";
            } else {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_man.gif\" /></a> ";
            }
        }
        if ($v['birthyear']) {
            $birthyear = date('Y') - $v['birthyear'] . '岁';
        } else {
            $birthyear = '年龄保密';
        }
        $result[] = array("uid" => $v['uid'], "mainimg" => $v['mainimg'], "images_ischeck" => $v['images_ischeck'], "gender" => $v['gender'], "introduce" => $introduce, "imgUrl" => $imgUrl, "nickname" => $v['nickname'], "birthyear" => $birthyear, "province" => $v['province'], "city" => $v['city']);
    }
    echo json_encode($result);
}
Пример #23
0
function update_pay($order_id)
{
    global $_MooClass, $dbTablePre;
    $sql = "update {$dbTablePre}payment_new set status=1 where order_id='{$order_id}'";
    $_MooClass['MooMySQL']->query($sql);
    $sql = "SELECT uid,apply_sid FROM {$dbTablePre}payment_new WHERE order_id ='{$order_id}'";
    $tmp_u = $_MooClass['MooMySQL']->getOne($sql, true);
    $sql = "UPDATE {$dbTablePre}members_search SET sid = 0  WHERE uid = " . $tmp_u['uid'];
    @$_MooClass['MooMySQL']->query($sql);
    searchApi('members_man members_women')->updateAttr(array('sid'), array($tmp_u['uid'] => array(0)));
    if (MOOPHP_ALLOW_FASTDB) {
        $value = array();
        $value['sid'] = 0;
        MooFastdbUpdate('members_search', 'uid', $tmp_u['uid'], $value);
    }
    if ($tmp_u['apply_sid'] > 0) {
        $sql = "UPDATE {$dbTablePre}admin_user SET member_count = member_count - 1 WHERE uid = " . $tmp_u['apply_sid'];
        @$_MooClass['MooMySQL']->query($sql);
    }
    return true;
}
Пример #24
0
/**
 * 优质会员--增加sphinx程序
 */
function allmember_excellent()
{
    $qs = trim(MooGetGPC('quicksearch', 'integer', 'G'));
    //$qs = 0;
    if (!$qs) {
        allmember_excellent_sql();
        exit;
    } else {
        global $rsort;
        $total = 0;
        $page_per = 20;
        $page = MooGetGPC('page', 'integer', 'G');
        $page = $page ? $page : 1;
        $offset = ($page - 1) * $page_per;
        //允许的排序方式
        $allow_order = array('uid' => 'ID', 'birthyear' => '年龄', 'images_ischeck' => '照片', 'salary' => '收入', 'allotdate' => '分配时间', 'regdate' => '注册时间', 'lastvisit' => '最后登陆时间', 'login_meb' => '登陆次数', 'sid' => '工号/客服', 'is_lock' => '是否锁定', 'real_lastvisit' => '在线状态');
        $keyword = trim(MooGetGPC('keyword', 'string', 'G'));
        $choose = MooGetGPC('choose', 'string', 'G');
        $where = '';
        $cond = array();
        if (!empty($choose) && !empty($keyword)) {
            if ($choose == 'uid') {
                $cond[] = array('@id', $keyword, false);
            } else {
                $cond[] = array($choose, $keyword, false);
            }
            $where = "m.{$choose}='{$keyword}'";
        }
        $order = trim(MooGetGPC('order', 'string', 'G'));
        if ($order == 'salary' || $order == 'allotdate' || $order == 'real_lastvisit' || $order == 'login_meb') {
            //sphinx不能做排序
            allmember_excellent_sql();
            exit;
        }
        $sort_str = '';
        $query_builder = get_query_builder($where, $allow_order, '', '', 'regdate', 'desc', $rsort);
        $sql_sort = $query_builder['sort'];
        $sort_arr = $query_builder['sort_arr'];
        $rsort_arr = $query_builder['rsort_arr'];
        if ($sql_sort) {
            if (strpos($sql_sort, 'uid desc')) {
                $sort_str = '@id desc';
            } elseif (strpos($sql_sort, 'uid asc')) {
                $sort_str = '@id asc';
            } else {
                $sort_str = substr($sql_sort, 9);
            }
        }
        $member_list = array();
        $field = trim(MooGetGPC('f', 'string', 'G'));
        if (!$field) {
            $field = 'age';
        }
        $result = '';
        if ($field != 'isattend') {
            if (isset($query_builder['sql_sort'])) {
                $n = 0;
                foreach ($query_builder['rsort_arr'] as $k => $v) {
                    if ($k == 'uid') {
                        $k = '@id';
                    }
                    if ($n < 5) {
                        if (!$sort_str) {
                            $sort_str = $k . ' ' . $v;
                        } else {
                            $sort_str .= ',' . $k . ' ' . $v;
                        }
                    } else {
                        break;
                    }
                    $n++;
                }
            }
            $index = 'members_man members_women';
            $limit = array($offset, $page_per);
            $cl = searchApi($index);
            if ($field == 'age') {
                $year = date('Y', time()) - 25;
                $cond[] = array('birthyear', array($year, 99), false);
            } elseif ($field == 'sal') {
                $cond[] = array('salary', '4|5|6|7|8|9', false);
            } elseif ($field == 'province') {
                $cond[] = array('province', '10102000|10103000|10101201|10101002|10101000|10105000', false);
            } elseif ($field == 'city') {
                $cond[] = array('city', '10127001', false);
            }
            $rs = $cl->getResult($cond, $limit, $sort_str);
            $ids = $cl->getIds();
            if (is_array($ids) && !empty($ids)) {
                $total = $rs['total_found'];
                $ids_str = implode(',', $ids);
                $sql = "SELECT m.uid,m.nickname,m.gender,m.birthyear,m.salary,m.province,m.city,m.s_cid,ml.lastvisit,mb.source,ml.login_meb,mb.allotdate,m.regdate,m.sid,m.is_lock,a.isattend FROM {$GLOBALS['dbTablePre']}members_search m \n\t\t            LEFT JOIN {$GLOBALS['dbTablePre']}members_base mb on m.uid=mb.uid LEFT JOIN {$GLOBALS['dbTablePre']}members_login ml on m.uid= ml.uid LEFT JOIN {$GLOBALS['dbTablePre']}ahtv_reguser a\n\t\t            ON m.uid=a.uid where m.uid in ({$ids_str})";
                $result = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
            }
        } elseif ($field == 'isattend') {
            $where_sql = "a.isattend=1";
            if ($where) {
                $where_sql = $where . ' and ' . $where_sql;
            }
            $sql_count = "SELECT count(a.uid) as c FROM {$GLOBALS['dbTablePre']}members_search m \n\t\t\t            LEFT JOIN {$GLOBALS['dbTablePre']}members_base mb on m.uid=mb.uid LEFT JOIN {$GLOBALS['dbTablePre']}members_login ml on m.uid= ml.uid LEFT JOIN {$GLOBALS['dbTablePre']}ahtv_reguser a\n\t\t\t            ON m.uid=a.uid where {$where_sql}";
            $rs = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_count, true);
            if (isset($rs['c']) && $rs['c']) {
                $total = $rs['c'];
            }
            if ($total > 0) {
                $sql2 = "SELECT m.uid,m.nickname,m.gender,m.birthyear,m.salary,m.province,m.city,m.s_cid,ml.lastvisit,mb.source,ml.login_meb,mb.allotdate,m.regdate,m.sid,m.is_lock,a.isattend FROM {$GLOBALS['dbTablePre']}members_search m \n\t\t\t\t            LEFT JOIN {$GLOBALS['dbTablePre']}members_base mb on m.uid=mb.uid LEFT JOIN {$GLOBALS['dbTablePre']}members_login ml on m.uid= ml.uid LEFT JOIN {$GLOBALS['dbTablePre']}ahtv_reguser a\n\t\t\t\t            ON m.uid=a.uid where {$where_sql} limit {$offset},{$page_per}";
                $result = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql2, 0, 0, 0, true);
            }
        } else {
            allmember_excellent_sql();
            exit;
        }
        if (!empty($result)) {
            foreach ($result as $v) {
                $grade = 0;
                //年龄
                if (empty($v['birthyear'])) {
                    $age = 0;
                } else {
                    $age = Date('Y') - $v['birthyear'];
                }
                if ($age >= 25) {
                    $grade++;
                }
                //收入
                $salary = $v['salary'];
                if ($salary >= 4) {
                    $grade++;
                }
                //地区
                $province = $v['province'];
                $city = $v['city'];
                $array_district = array("10102000", "10103000", "10101201", "10101002", "10105000");
                if (in_array($province, $array_district) || $city == "10127001") {
                    $grade++;
                }
                if ($v['isattend']) {
                    $grade++;
                }
                if ($grade) {
                    $uid = $v['uid'];
                    $nickname = $v['nickname'];
                    $gender = $v['gender'];
                    $s_cid = $v['s_cid'];
                    $birthyear = $v['birthyear'];
                    $salary = $v['salary'];
                    $lastvisit = $v['lastvisit'];
                    $login_meb = $v['login_meb'];
                    $province = $v['province'];
                    $city = $v['city'];
                    $source = $v['source'];
                    $allotdate = $v['allotdate'];
                    $regdate = $v['regdate'];
                    $sid = $v['sid'];
                    $islock = $v['is_lock'];
                    $isattend = $v['isattend'];
                    $member_list[] = array('uid' => $uid, 'nickname' => $nickname, 'gender' => $gender, 's_cid' => $s_cid, 'birthyear' => $birthyear, 'salary' => $salary, 'lastvisit' => $lastvisit, 'login_meb' => $login_meb, 'province' => $province, 'city' => $city, 'source' => $source, 'allotdate' => $allotdate, 'regdate' => $regdate, 'sid' => $sid, 'islock' => $islock, 'grade' => $grade, 'isattend' => $isattend);
                }
            }
        }
        $page_total = max(1, ceil($total / $page_per));
        $page = min($page, $page_total);
        //来源
        if ($member_list) {
            foreach ($member_list as $key => $user) {
                if (preg_match_all("/(wf=\\w+)&?|(st=\\w+)&?/i", $user['source'], $matches)) {
                    $member_list[$key]['source'] = $matches[1][0] . "<br />" . $matches[2][1];
                }
            }
        }
        $currenturl = "index.php?action=allmember&h=excellent";
        //&province={$provinceL}";//.$link;
        $currenturl1 = "index.php?action=allmember&h=excellent&choose={$choose}&keyword={$keyword}clear=1";
        $page_links = multipage($total, $page_per, $page, $currenturl1);
        $condition = array();
        $condition['m.uid'] = $condition['m.username'] = $condition['m.nickname'] = $condition['m.telphone'] = $condition['m.sid'] = '';
        //获取本次查询条件
        $condition = array_merge($condition, get_condition($where));
        $title = '优质会员';
        require_once adminTemplate('allmember_excellent');
    }
}
Пример #25
0
    if (isset($city_star)) {
        //note 升级为城市之星
        $sql = "update web_members_search set city_star = '{$time}'  where uid in ({$uid})";
        $_MooClass['MooMySQL']->query($sql);
        if (strpos($uid, ',')) {
            $uid_arr = explode(',', $uid);
            $str_arr = array();
            if (!empty($uid_arr)) {
                foreach ($uid_arr as $k => $v) {
                    $str_arr[$v] = array($time);
                }
            }
        } else {
            $str_arr[$uid] = array($time);
        }
        !empty($str_arr) && searchApi('members_man members_women')->updateAttr(array('city_star'), $str_arr);
    }
} else {
    echo "请输入操作内容;s_cid 用户权限({10,铂金会员}{20,钻石会员}{30,高级会员}{40,普通会员}{50,红娘}) ;(city_star : 1)为为城市之星";
    exit;
}
$sql = "select * from web_members+search where uid in ({$uid})";
$re = $_MooClass['MooMySQL']->getAll($sql);
$table = "members";
$field = "uid";
foreach ($re as $r) {
    $key = $r['uid'];
    $value =& $r;
    //var_dump($value);
    //echo "<br/>";var_dump(unserialize($fastdb->get($table.$field.$key)));
    //exit;
Пример #26
0
function myuser_delmyuser()
{
    global $h;
    $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    $uid = MooGetGPC('uid', 'integer', 'G');
    $sql = "SELECT sid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid='{$uid}'";
    $sid = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    if ($sid['sid'] == $GLOBALS['adminid'] || $myservice_idlist == 'all' || in_array($sid['sid'], $myservice_idlist)) {
        //members表sid清0
        $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search  SET sid='0' WHERE uid='{$uid}' ";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        searchApi('members_man members_women')->updateAttr(array('sid'), array($uid => array(0)));
        if (MOOPHP_ALLOW_FASTDB) {
            $arr = array();
            $arr['sid'] = 0;
            MooFastdbUpdate('members_search', 'uid', $uid, $arr);
        }
        //对应的维护会员总数减1
        $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count-1 WHERE uid='{$sid['sid']}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //后台扩展表标记为删除状态
        $sql = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET is_delete=1 WHERE uid='{$uid}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //写日志
        serverlog(3, $GLOBALS['dbTablePre'] . 'members_search', "{$GLOBALS['username']}客服将自己的会员{$uid}删除放弃", $GLOBALS['adminid'], $uid);
        salert('删除成功');
    } else {
        salert('操作不合法');
    }
}
Пример #27
0
function active_activity_acceding_add()
{
    $data = array();
    if (!empty($_POST)) {
        $uid = MooGetGPC('uid', 'string', 'P');
        if (empty($uid)) {
            MooMessageAdmin('请填写用户的uid', 'index.php?action=active_activity_acceding&h=add');
        }
        $channel = MooGetGPC('channel', 'integer', 'P');
        if (empty($channel)) {
            MooMessageAdmin('请选择活动项目', 'index.php?action=active_activity_acceding&h=add');
        }
        //找出已经是参加活动的会员
        $activity_all_user = $GLOBALS['_MooClass']['MooMySQL']->getAll('select `uid` from `' . $GLOBALS['dbTablePre'] . 'activity_acceding` where `uid` in (' . $uid . ')');
        //找出已经是参加某项活动的会员
        $activity_all_channel_user = $GLOBALS['_MooClass']['MooMySQL']->getAll('select `uid` from `' . $GLOBALS['dbTablePre'] . 'activity_acceding` where `channel`=' . $channel . ' and `uid` in (' . $uid . ')');
        $activity_all_users = $activity_all_channel_users = array();
        if (!empty($activity_all_user)) {
            foreach ($activity_all_user as $value) {
                $activity_all_users[] = $value['uid'];
            }
        }
        if (!empty($activity_all_channel_user)) {
            foreach ($activity_all_channel_user as $value) {
                $activity_all_channel_users[] = $value['uid'];
            }
        }
        $uids = explode(',', $uid);
        $members_uid = $GLOBALS['_MooClass']['MooMySQL']->getAll('select uid from ' . $GLOBALS['dbTablePre'] . 'members_search');
        foreach ($members_uid as $key => $member_uid) {
            foreach ($member_uid as $k => $v) {
                $memuid[] = $v;
            }
        }
        foreach ($uids as $key => $value) {
            if (!in_array($value, $memuid)) {
                $error_uid[] = $value;
            }
        }
        if (isset($error_uid)) {
            MooMessageAdmin('没有您添加的uid' . implode(',', $error_uid), 'index.php?action=active_activity_acceding&h=add');
        }
        $up_youzhi = empty($activity_all_users) ? $uids : array_diff_assoc($uids, $activity_all_users);
        $add_channel_user = empty($activity_all_channel_users) ? $uids : array_diff_assoc($uids, $activity_all_channel_users);
        is_array($add_channel_user) && !empty($add_channel_user) && ($sid = $GLOBALS['_MooClass']['MooMySQL']->getAll('select `uid`,`sid` from `' . $GLOBALS['dbTablePre'] . 'members_search` where `uid` in (' . implode(',', $add_channel_user) . ')'));
        $sids = $add_channel = $add_msg = array();
        if (isset($sid) && is_array($sid) && !empty($sid)) {
            foreach ($sid as $value) {
                if (!empty($value['sid'])) {
                    $sids[$value['uid']] = $value['sid'];
                }
            }
        }
        $dateline = time();
        $awoketime = $dateline + 120;
        foreach ($add_channel_user as $value) {
            $add_channel[] = '(' . $value . ',' . $channel . ')';
            if (array_key_exists($value, $sids)) {
                $add_msg[] = '(' . $sids[$value] . ',"会员参见活动","' . $value . '参加新的活动了",' . $awoketime . ',' . $dateline . ')';
            }
        }
        if (!empty($add_channel)) {
            if ($GLOBALS['_MooClass']['MooMySQL']->query('INSERT INTO `web_activity_acceding` (`uid`, `channel`) VALUES ' . implode(',', $add_channel))) {
                $GLOBALS['_MooClass']['MooMySQL']->query('INSERT INTO `web_admin_remark` (`sid`,`title`,`content`,`awoketime`,`dateline`) VALUES ' . implode(',', $add_msg));
                if (is_array($up_youzhi) && !empty($up_youzhi) && $GLOBALS['_MooClass']['MooMySQL']->query('UPDATE `web_members_search` SET `is_well_user` = \'1\'  WHERE `uid` in (' . implode(',', $up_youzhi) . ')')) {
                    $uid_arr = array();
                    foreach ($up_youzhi as $k => $v) {
                        $uid_arr[$v] = array(1);
                    }
                    !empty($uid_arr) && searchApi("members_man members_women")->updateAttr(array('is_well_user'), $uid_arr);
                    $is_well_user = array();
                    foreach ($up_youzhi as $value) {
                        $is_well_user['is_well_user'] = 1;
                        MooFastdbUpdate('members_search', 'uid', $value, $is_well_user);
                    }
                }
                MooMessageAdmin('操作成功', 'index.php?action=active_activity_acceding&h=add');
            } else {
                MooMessageAdmin('操作失败', 'index.php?action=active_activity_acceding&h=add');
            }
        }
    }
    $channels = $GLOBALS['_MooClass']['MooMySQL']->getAll('select `title`,`id` from `' . $GLOBALS['dbTablePre'] . 'activity`');
    require adminTemplate('active_activity_acceding_detail');
}
Пример #28
0
/**
 * 登录首页
 * 描述:
 * 
 */
function index_index()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr, $memcached;
    $sql_condition_province = $sql_condition_city = $province = '';
    $currentdistrict = '0';
    $arr_diamond_female = $arr_diamond_male = null;
    $provice_list = $city_list = $province_othercachefile = null;
    $s_cid = 40;
    //note 先初始化用户信息
    //MooUserInfo();
    //-------会员推荐------//
    $workprovince = MooGetGPC('workprovince', 'integer', 'G');
    //工作省份
    $workcity = MooGetGPC('workcity', 'integer', 'G');
    //工作城市
    if (in_array($workprovince, array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $workcity = $workprovince;
        $workprovince = 10101000;
    }
    $age1 = MooGetGPC('age1', 'integer', 'G');
    //最小年龄
    $age2 = MooGetGPC('age2', 'integer', 'G');
    //最大年龄
    $userList = $userList2 = array();
    $index_total_user = 12;
    //首页总用户数
    //note 当前年份
    $year = date('Y');
    //登录用户查找性别
    $sql_gender = '';
    //性别取反
    if ($GLOBALS['MooUid']) {
        $gender = $user_arr['gender'] == 1 ? 0 : 1;
        /* $sql_gender = " and gender='$gender'";
        		$sql_condition_province .= $sql_gender;
        		$sql_condition_city .= " and gender='$gender'"; */
    } else {
        $gender = !MooGetGPC('gender', 'integer', 'G') ? 0 : 1;
        //note 性别
    }
    $date_time = date('d');
    $month_time = date('m');
    $reguser_num = 30000 + $month_time * 1100 + $date_time * 191;
    //新加滚动文字
    /*$time_list = time();
    	$sql = "select content from {$dbTablePre}text_show where start_time<'$time_list' and end_time>'$time_list' order by reg_time desc limit 0,15";
    	$text_list = $_MooClass['MooMySQL']->getAll($sql);*/
    //显示男姓or显示女生搜索
    /* if(isset($workprovince) && isset($workcity) && isset($age1) && $age2){
    		//$sql = "select * from {$dbTablePre}members where gender=$sex and images_ischeck=1 ";
    		include_once("./module/crontab/crontab_config.php");
    		//note 从快速搜索表中查询
    		if($gender == '0'){
    			$sql = "select uid from {$dbTablePre}members_search where  images_ischeck=1 and gender='0'";				
    		}
    		
    		if($gender == '1'){
    			$sql = "select uid from {$dbTablePre}members_search where images_ischeck=1 and gender='1'";
    		}
    		
    		if($workprovince != 0 && $workcity == 0){//仅选择了省
    			$sql .= " and province=$workprovince";
    		}elseif($workprovince != 0 && $workcity != 0){ //选择了省市
    			$sql .= " and province=$workprovince and city=$workcity";
    		}
    		if($age1 != '0' && $age2 != '0'){
    			if($age1 < $age2){
    				//查找数据的年龄条件
    				$between = ($year-$age2).' and '.($year-$age1);
    				$sql .= " and birthyear between $between";
    			}else{
    				//查找数据的年龄条件
    				$between = ($year-$age1).' and '.($year-$age2);
    				$sql .= " and birthyear between $between";
    			}
    		}
    		
    		$sql .= " and is_lock = 1";
    		//$sql .= " and is_lock = 1 limit 12";
    		$sql .= " order by city_star desc,s_cid asc,bgtime desc ,pic_num desc limit 20";
            //var_dump($sql);exit;
    		//note 查询出来的用户id写入缓存
    		$md5 = md5($sql);
    		$index_search = ("type=query/name=userid_{$md5}/sql=$sql/cachetime=86400");
    	
    		$_MooClass['MooCache']->getBlock($index_search);
    		$userid = $GLOBALS['_MooBlock']["userid_{$md5}"];
    		
    		//查询为空则跳转到首页
    		if(empty($userid)) {
    			MooMessage("非常抱歉!没有您所找的会员!", 'index.php','01');
    			exit;
    		}
    		//note uid数组转换成字符串	
    		$index_img_num = 5;
    		$index_img = index_img($currentdistrict,$index_img_num);
    		$small_img_num = 3;
    		$small_img = small_img($currentdistrict,$small_img_num);
    		$user_arr1 = array();
    		foreach ($userid as $v1){
    			$user_arr1[] = $v1['uid'];
    		}
    		//note 获得用户id
    		$userid_list =  implode(",",$user_arr1);
    		$sql = "select s.uid,s.gender,s.images_ischeck,s.nickname,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce from {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid left join {$dbTablePre}members_introduce i on s.uid=i.uid where s.uid in ($userid_list) order by s.city_star desc, s.s_cid asc";
    		
    		//note 查询出来的用户信息写入缓存
    		$md5 = md5($sql);
    		$index_search = ("type=query/name=userList_{$md5}/sql=$sql/cachetime=86400");
    		
    		$_MooClass['MooCache']->getBlock($index_search);
    		$userList = $GLOBALS['_MooBlock']["userList_{$md5}"];
    		
    	}
    	
    	else{ */
    //默认进入
    //包含配置文件
    include_once "./module/crontab/crontab_config.php";
    $cur_ip = GetIP();
    //		$cur_ip = "61.190.44.98";
    //		$cur_ip = "202.120.2.200";//上海ip
    //		$cur_ip = "218.202.206.102";//新疆ip
    //$cur_ip = "218.70.178.197"; //重庆
    //		$cur_ip="221.130.166.242";
    MooPlugins('ipdata');
    $ip_arr = convertIp($cur_ip);
    //得到省份对应的数值,查库
    $province = $city = "";
    foreach ($provice_list as $key => $val) {
        if (strstr($ip_arr, $val)) {
            $province = $key;
            $currentdistrict = $val;
            break;
        }
    }
    if (isset($_GET['province'])) {
        foreach ($provice_list as $key => $val) {
            if ($_GET['province'] == $key) {
                $currentdistrict = $val;
                break;
            }
        }
    }
    $test = array();
    if (isset($currentdistrict)) {
        $index_img_num = 5;
        $index_img = index_img($currentdistrict, $index_img_num);
        $small_img_num = 3;
        $small_img = small_img($currentdistrict, $small_img_num);
        $test = test($currentdistrict);
    }
    //得到市对应的城市代号
    foreach ($city_list as $city_key => $city_val) {
        if (strstr($ip_arr, $city_val)) {
            $city = $city_key;
            break;
        }
    }
    if (isset($_GET['province'])) {
        //默认快速查询没有进入
        $province = MooGetGPC('province', 'integer', 'G');
        //note 修正广东省深圳和广州的区域查询
        if (in_array($province, array(10101201, 10101002))) {
            $city = $province;
            $province = 10101000;
        }
        //修正直辖市查询
        if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
            $city = '0';
        }
        /* $sql = "SELECT * FROM {$dbTablePre}index_cachefile WHERE province='{$province}' AND city='{$city}'";
        			$cachefile_list = $_MooClass['MooMySQL']->getAll($sql);
        			foreach($cachefile_list as $cachefile){
        				if(file_exists("data/block/{$cachefile['provincestarfile']}")){
        					@unlink("data/block/{$cachefile['provincestarfile']}");
        				}
        				if(file_exists("data/block/{$cachefile['citystarfile']}")){
        					@unlink("data/block/{$cachefile['citystarfile']}");
        				}
        				if(file_exists("data/block/{$cachefile['provinceotherfile']}")){
        					@unlink("data/block/{$cachefile['provinceotherfile']}");
        				}
        			}  */
    }
    $userList = array();
    //查市城市之星
    //note 修正广东省深圳和广州的区域查询
    if (in_array($province, array(10101201, 10101002))) {
        $city = $province;
        $province = 10101000;
    }
    $sql_city = "s.city='{$city}'";
    //修正直辖市查询
    if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
        $city = '0';
    }
    if ($city == 0) {
        $sql_city = "s.province='{$province}'";
    }
    if (!empty($city) || !empty($province)) {
        //默认没有进入  选择省后进入
        $sql = "SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base b on s.uid=b.uid  left join {$dbTablePre}members_introduce as i on s.uid=i.uid WHERE  s.s_cid='20' and s.gender='{$gender}' and ({$sql_city} AND s.is_lock=1 AND s.images_ischeck=1 and s.nickname!='' AND s.showinformation=1 AND s.city_star>=1 AND s.usertype=1) AND i.introduce!='' order by s.s_cid limit 6";
        //$userList = $_MooClass['MooMySQL']->getAll($sql);
        $param = "type=query/name=userlist_{$city}_citystar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        //
        $userList = $GLOBALS['_MooBlock']["userlist_{$city}_citystar"];
        //市缓存文件
        //$city_cachefile = "userlist_{$city}_citystar".'_'.md5($param).'.data';
    }
    //市无城市之星,从省取城市之星
    if (empty($userList)) {
        //默认进入
        //enky note
        //$sql="select * from {$dbTablePre}members_base as b left join {$dbTablePre}members_search as s on b.uid=s.uid WHERE s.province='$province'  AND s.is_lock=1        AND s.images_ischeck = 1 AND s.showinformation=1      and s.city_star>=1 and s.usertype=1 AND s.uid!=20752315 LIMIT 20";
        $sql = "select s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce from  {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid left join {$dbTablePre}members_introduce as i on s.uid=i.uid WHERE s.province='{$province}'\n\t\t\t          AND s.is_lock=1   and  s.gender={$gender}\n\t\t\t          AND s.images_ischeck = 1 AND s.showinformation=1 \n\t\t\t          and s.city_star>=1 and s.usertype=1 AND i.introduce!='' and s.nickname!='' LIMIT 6";
        //			$userList = $_MooClass['MooMySQL']->getAll($sql);
        $param = "type=query/name=userlist_{$province}_provincestar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        $userList = $GLOBALS['_MooBlock']["userlist_{$province}_provincestar"];
        //省缓存文件
        //$province_cachefile = "userlist_{$province}_provincestar".'_'.md5($param).'.data';
    }
    //城市之星不够取钻石会员(市->省->全国)
    $count = count($userList);
    if ($count < 6) {
        //默认进入
        $addarr = array('cityadd', 'provinceadd', 'countryadd');
        $user_in = '1747188|2154375|1600591|2159633|20782701|20785837|20561126|20305660|20910184';
        //城市之星uid
        $user_list = array();
        if (!is_array($userList)) {
            $userList = array();
        }
        //enky add
        foreach ($userList as $user) {
            $user_list[] = $user['uid'];
        }
        if (!empty($user_list)) {
            $user_in .= ',' . implode('|', $user_list);
        }
        //从(市->省->全国)取钻石会员
        $cityadd = array();
        $provinceadd = array();
        $countryadd = array();
        foreach ($addarr as $add) {
            if ($count < 6) {
                $id = '';
                //从市取
                if ($add == 'cityadd') {
                    if (!$city || $city == 0) {
                        continue;
                    }
                    $sql_add = "s.city='{$city}' and";
                    $id .= $city;
                }
                //从省取
                if ($add == 'provinceadd') {
                    if (!$province || $province == 0) {
                        continue;
                    }
                    $sql_add = "s.province='{$province}' and";
                    $id .= $province;
                }
                //全国取
                if ($add == 'countryadd') {
                    $sql_add = '';
                    $id .= 'country';
                }
                //取几个钻石会员
                $add_query_sum = 6 - $count;
                //enky need change
                $cl = searchApi('members_women members_man');
                $cond[] = array('is_lock', '1', false);
                $cond[] = array('images_ischeck', '1', false);
                $cond[] = array('gender', $gender, false);
                $cond[] = array('usertype', '1', false);
                $cond[] = array('@id', '20752315|' . $user_in, true);
                //uid
                $cond[] = array('s_cid', '20', false);
                $cond[] = array('city_star', '0', false);
                $cond[] = array('showinformation', '1', false);
                $cond[] = array('pic_num', array(1, 20), false);
                if ($province) {
                    array('province', $province, false);
                }
                if ($city) {
                    array('city', $city, false);
                }
                $limit = array($add_query_sum);
                $res_matches = $cl->getResult($cond, $limit);
                if ($res_matches) {
                    $count_res = count($res_matches);
                    $array_merge = array();
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i])) {
                            $ids[] = $res_matches['matches'][$i]['id'];
                        }
                    }
                    $sql_str = implode(',', $ids);
                    $nickname_res = $_MooClass['MooMySQL']->getAll("select nickname,uid from web_members_search where uid in " . "({$sql_str})");
                    $mainimg_res = $_MooClass['MooMySQL']->getAll("select mainimg from web_members_base where uid in " . "({$sql_str})");
                    $introduce_res = $_MooClass['MooMySQL']->getAll("select introduce from web_members_introduce where uid in " . "({$sql_str})");
                    //合并到sphinx查询出的整理后的数组
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i]['attrs'])) {
                            $res_matches['matches'][$i]['attrs']['nickname'] = $nickname_res[$i]['nickname'];
                            $res_matches['matches'][$i]['attrs']['uid'] = $nickname_res[$i]['uid'];
                            $res_matches['matches'][$i]['attrs']['mainimg'] = $mainimg_res[$i]['mainimg'];
                            $res_matches['matches'][$i]['attrs']['introduce'] = $introduce_res[$i]['introduce'];
                            $bigarr[] = $res_matches['matches'][$i]['attrs'];
                        }
                    }
                    ${$add} = $bigarr;
                } else {
                    $sql = "select s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce from {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid left join {$dbTablePre}members_introduce as i on s.uid=i.uid  where s.uid not in({$user_in})\n\t\t\t\t\t\t\t\t  AND {$sql_add} s.city_star=0 AND s.s_cid = 20  and s.gender={$gender}\n\t\t\t\t\t\t\t\t  AND s.images_ischeck  = 1 AND s.is_lock = 1 AND s.showinformation = 1\n\t\t\t\t\t\t\t\t  AND s.pic_num >=1 AND s.usertype=1 AND i.introduce!='' and s.nickname!=''  LIMIT {$add_query_sum}";
                    $param = "type=query/name=userlist_{$id}_other/sql={$sql}/cachetime=86400";
                    $_MooClass['MooCache']->getBlock($param);
                    ${$add} = $GLOBALS['_MooBlock']["userlist_{$id}_other"];
                }
                //已获取的首页会员uid
                $user_list = array();
                if (!is_array(${$add})) {
                    ${$add} = array();
                }
                //enky add
                foreach (${$add} as $user) {
                    $user_list[] = $user['uid'];
                }
                if (!empty($user_list)) {
                    $user_in .= ',' . implode(',', $user_list);
                }
                //echo $user_in;exit;
                //已有总数
                $count += count(${$add});
            }
        }
        //$countryadd  have data
        $userList = array_merge($userList, $cityadd, $provinceadd, $countryadd);
        //省其它类型会员缓存文件
        //$province_othercachefile = "userlist_{$id}_other".'_'.md5($param).'.data';
    }
    //生成的block缓存文件存库
    /* $city = $city ? $city : 0;
    		$sql = "SELECT * FROM {$dbTablePre}index_cachefile WHERE  province='{$province}' AND city='{$city}'";
    		$cache_arr = $_MooClass['MooMySQL']->getAll($sql);
    		
    		if(empty($cache_arr)){
    			$province_cachefile = isset($province_cachefile)?$province_cachefile:'';
    			$sql = "INSERT INTO {$dbTablePre}index_cachefile SET province='{$province}',city='{$city}',provincestarfile='{$province_cachefile}',citystarfile='{$city_cachefile}',provinceotherfile='{$province_othercachefile}'";
    			$_MooClass['MooMySQL']->query($sql);
    		}  */
    //推荐列表中如果存在,则以推荐列表中的指定的sort替换
    $sql = "SELECT * FROM {$dbTablePre}members_recommend WHERE  province='{$province}' AND city='{$city}' order by sort asc";
    $recommend_list = $_MooClass['MooMySQL']->getAll($sql);
    if (!empty($recommend_list)) {
        foreach ($recommend_list as $list) {
            $sort = $list['sort'] < 1 ? 0 : $list['sort'] - 1;
            if (MOOPHP_ALLOW_FASTDB) {
                $u = MooFastdbGet('members_search', 'uid', $list['uid']);
                $u2 = MooFastdbGet('members_base', 'uid', $list['uid']);
                $u = array_merge($u, $u2);
            } else {
                $sql = "SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid left join {$dbTablePre}members_introduce as i on s.uid=i.uid WHERE s.uid='{$list['uid']}'";
                $u = $_MooClass['MooMySQL']->getOne($sql);
            }
            if ($u) {
                foreach ($userList as $key => $val) {
                    if ($list['uid'] == $val['uid']) {
                        $user_key = $key;
                        break;
                    }
                }
                if (isset($user_key)) {
                    if (isset($userList[$sort])) {
                        $userList[$key] = $userList[$sort];
                    }
                    $userList[$sort] = $u;
                } else {
                    $userList[$sort] = $u;
                }
            }
        }
    }
    // }
    //删除数组中多余的部分
    array_splice($userList, 6);
    $userArr = array();
    $i = 0;
    $imgSrcSmall = $imgSrcMid = $imgSrcUrl = '';
    foreach ($userList as $v) {
        $introduce = '';
        if (isset($v['introduce'])) {
            $introduce = MooCutstr($v['introduce'], 50, '...');
        }
        $imgSrcSmall = MooGetphoto($v['uid'], 'small');
        $imgSrcMid = MooGetphoto($v['uid'], 'mid');
        if ($imgSrcSmall) {
            $imgSrc = $imgSrcMid;
        } elseif ($v['gender'] == '1') {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        } else {
            $imgSrc = "module/index/templates/default/images/se_man.gif";
        }
        if (isset($v['mainimg']) && !empty($v['mainimg']) && isset($v['images_ischeck']) && $v['images_ischeck'] == 1) {
            $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src={$imgSrc} width=\"120\"/> </a>";
        } else {
            if (isset($v['gender']) && $v['gender']) {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_woman.gif\" /> </a> ";
            } else {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_man.gif\" /></a> ";
            }
        }
        if ($v['birthyear']) {
            $age = date('Y') - $v['birthyear'] . '岁';
        } else {
            $age = '年龄保密';
        }
        $userArr[] = array("i" => $i, "uid" => $v['uid'], "mainimg" => $v['mainimg'], "images_ischeck" => $v['images_ischeck'], "gender" => $v['gender'], "introduce" => $introduce, "imgUrl" => $imgUrl, "nickname" => $v['nickname'], "age" => $age, "province" => $v['province'], "city" => $v['city']);
        $i++;
    }
    //===============最新注册会员,按照片数排序 ,男会员=========================
    $newMale = array();
    $param = "type=query/name=new_members_male/sql=SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid  left join {$dbTablePre}members_introduce as i on s.uid=i.uid where  s.gender=0 and s.pic_num>4 and s.images_ischeck=1 and s.is_lock=1 and i.introduce!='' and s.nickname!='' order by s.uid desc limit 3/cachetime=10800";
    $_MooClass['MooCache']->getBlock($param);
    $new_reguser_male = isset($GLOBALS['_MooBlock']['new_members_male']) ? $GLOBALS['_MooBlock']['new_members_male'] : '';
    foreach ($new_reguser_male as $v) {
        $introduce = MooCutstr($v['introduce'], 14, '...');
        $imgSrcSmall = MooGetphoto($v['uid'], 'small');
        $imgSrcMid = MooGetphoto($v['uid'], 'mid');
        if ($imgSrcSmall) {
            $imgSrc = $imgSrcMid;
        } elseif ($v['gender'] == '1') {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        } else {
            $imgSrc = "module/index/templates/default/images/se_man.gif";
        }
        if (isset($v['mainimg']) && !empty($v['mainimg']) && isset($v['images_ischeck']) && $v['images_ischeck'] == 1) {
            $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src={$imgSrc} width=\"120\"/> </a>";
        } else {
            if (isset($v['gender']) && $v['gender']) {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_woman.gif\" /> </a> ";
            } else {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_man.gif\" /></a> ";
            }
        }
        if ($v['birthyear']) {
            $birthyear = date('Y') - $v['birthyear'] . '岁';
        } else {
            $birthyear = '年龄保密';
        }
        if ($v['nickname']) {
            $nickname = MooCutstr($v['nickname'], 15, '');
        } else {
            $nickname = 'ID:' . $v['uid'];
        }
        $newMale[] = array("uid" => $v['uid'], "mainimg" => $v['mainimg'], "images_ischeck" => $v['images_ischeck'], "gender" => $v['gender'], "introduce" => $introduce, "imgUrl" => $imgUrl, "nickname" => $nickname, "birthyear" => $birthyear, "province" => $v['province'], "city" => $v['city']);
    }
    //==================最新注册会员,按照片数排序 ,女会员==========================
    $param = "type=query/name=new_members_female/sql=SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg,i.introduce FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid  left join {$dbTablePre}members_introduce as i on s.uid=i.uid where  s.gender=1 and s.pic_num>4 and s.images_ischeck=1 and s.is_lock=1 order by s.uid desc limit 3/cachetime=10800";
    $_MooClass['MooCache']->getBlock($param);
    $new_reguser_female = isset($GLOBALS['_MooBlock']['new_members_female']) ? $GLOBALS['_MooBlock']['new_members_female'] : '';
    foreach ($new_reguser_female as $v) {
        $introduce = MooCutstr($v['introduce'], 14, '...');
        $imgSrcSmall = MooGetphoto($v['uid'], 'small');
        $imgSrcMid = MooGetphoto($v['uid'], 'mid');
        if ($imgSrcSmall) {
            $imgSrc = $imgSrcMid;
        } elseif ($v['gender'] == '1') {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        } else {
            $imgSrc = "module/index/templates/default/images/se_man.gif";
        }
        if (isset($v['mainimg']) && !empty($v['mainimg']) && isset($v['images_ischeck']) && $v['images_ischeck'] == 1) {
            $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src={$imgSrc} width=\"120\"/> </a>";
        } else {
            if (isset($v['gender']) && $v['gender']) {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_woman.gif\" /> </a> ";
            } else {
                $imgUrl = "<a href=\"index.php?n=space&uid={$v['uid']}\" target=\"_blank\"><img src=\"module/index/templates/default/images/se_man.gif\" /></a> ";
            }
        }
        if ($v['birthyear']) {
            $birthyear = date('Y') - $v['birthyear'] . '岁';
        } else {
            $birthyear = '年龄保密';
        }
        if ($v['nickname']) {
            $nickname = MooCutstr($v['nickname'], 15, '');
        } else {
            $nickname = 'ID:' . $v['uid'];
        }
        $newFemale[] = array("uid" => $v['uid'], "mainimg" => $v['mainimg'], "images_ischeck" => $v['images_ischeck'], "gender" => $v['gender'], "introduce" => $introduce, "imgUrl" => $imgUrl, "nickname" => $nickname, "birthyear" => $birthyear, "province" => $v['province'], "city" => $v['city']);
    }
    //=================钻石会员   地区切换时真爱一生推荐会员涉及的==================================
    $sql = "select count(uid) as num from web_diamond_recommend where  isindex=1  and province='{$province}'";
    $result = $_MooClass['MooMySQL']->getOne($sql);
    $num = $result['num'];
    /* $sql="select count(uid) as num from web_diamond_recommend where  isindex=1 and gender='0' and province='{$province}'";
       $result_male=$_MooClass['MooMySQL']->getOne($sql);
       $num_male=$result_male['num']; */
    if ($num >= 5) {
        //女钻石会员
        $sql = "select uid,birthyear,province,city,nickname from {$dbTablePre}diamond_recommend where isindex=1  and province='{$province}' order by city<>'{$city}' ,city desc,sort desc  limit 10";
        //FEMAIL
        $param = "type=query/name=web_diamond_recommend/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        $arr_diamond = $GLOBALS['_MooBlock']['web_diamond_recommend'];
        //男钻石会员
        /* $sql_male = "select uid,birthyear,province,city,nickname from {$dbTablePre}diamond_recommend where isindex=1 and gender='0' and province='{$province}' order by city<>'{$city}' ,city desc,sort desc limit 10"; //MAIL
           $param = ("type=query/name=web_diamond_recommend/sql=$sql_male/cachetime=86400");
           $_MooClass['MooCache']->getBlock($param);
           $arr_diamond_male = $GLOBALS['_MooBlock']['web_diamond_recommend']; */
    } else {
        $diamond_filename = "data/cache/diamond_intro.php";
        if (!file_exists($diamond_filename)) {
            //女钻石会员
            $sql = "select m.uid,m.birthyear,m.province,m.city,m.nickname,b.mainimg,m.images_ischeck,i.introduce from {$dbTablePre}members_search m left join {$dbTablePre}members_base as b on m.uid=b.uid left join {$dbTablePre}members_introduce as i on m.uid=i.uid left join {$dbTablePre}members_choice c on m.uid=c.uid where m.s_cid='20' and m.usertype='1' and i.introduce_pass='******' and m.is_lock='1' and m.images_ischeck='1'";
            $sql = $sql . " order by m.pic_num desc,m.bgtime desc limit 10";
            $arr_diamond = $_MooClass['MooMySQL']->getAll($sql);
            foreach ($arr_diamond as $k => $v) {
                $diamond_str .= $v['uid'] . ',';
            }
            //男钻石会员
            /* $sql_male = "select m.uid,m.birthyear,m.province,m.city,m.nickname,b.mainimg,m.images_ischeck,i.introduce from {$dbTablePre}members_search m left join {$dbTablePre}members_base as b on m.uid=b.uid left join  {$dbTablePre}members_introduce as i on m.uid=i.uid left join {$dbTablePre}members_choice c on m.uid=c.uid where m.s_cid='20' and m.usertype='1' and i.introduce_pass='******' and m.is_lock='1' and m.images_ischeck='1' and m.gender='0'";
               $sql = $sql_male . " order by m.pic_num desc,m.bgtime desc limit 10";
               $arr_diamond_male = $_MooClass['MooMySQL']->getAll($sql);
               foreach($arr_diamond_male as $k=>$v){
                   $diamond_str_male .= $v['uid'].','; 
               } */
            //$diamond_str=$diamond_str_female.$diamond_str_male;
            file_put_contents($diamond_filename, $diamond_str);
        } else {
            $arr_diamond = file($diamond_filename);
            if ($arr_diamond) {
                $star_user = trim($arr_diamond[0], ',');
                $star_user = explode(',', $star_user);
                if (count($star_user) == 10) {
                    $star = $star_user[0] . ',' . $star_user[1] . ',' . $star_user[2] . ',' . $star_user[3] . ',' . $star_user[4] . ',' . $star_user[5] . ',' . $star_user[6] . ',' . $star_user[7] . ',' . $star_user[8] . ',' . $star_user[9];
                    //女钻石会员 enky need change
                    $sql = "select m.uid,m.birthyear,m.province,m.city,m.nickname,b.mainimg,m.images_ischeck,i.introduce from {$dbTablePre}members_search m left join {$dbTablePre}members_base as b on m.uid=b.uid left join {$dbTablePre}members_introduce as i on m.uid=i.uid  left join {$dbTablePre}members_choice c on m.uid=c.uid where m.uid in({$star})  limit 10";
                    //FEMAIL
                    $param = "type=query/name=web_star_recommend/sql={$sql}/cachetime=86400";
                    $_MooClass['MooCache']->getBlock($param);
                    $arr_diamond = $GLOBALS['_MooBlock']['web_star_recommend'];
                    /*  $star_male=$star_user[10].','.$star_user[11].','.$star_user[12].','.$star_user[13].','.$star_user[14].','.$star_user[15].','.$star_user[16].','.$star_user[17].','.$star_user[18].','.$star_user[19];
                        //男钻石会员 enky need change
                        $sql_male = "select m.uid,m.birthyear,m.province,m.city,m.nickname,b.mainimg,m.images_ischeck,i.introduce from {$dbTablePre}members_search m left join {$dbTablePre}members_base as b on m.uid=b.uid left join {$dbTablePre}members_introduce as i on m.uid=i.uid  left join {$dbTablePre}members_choice c on m.uid=c.uid where m.uid in($star_male) limit 10"; //MAIL
                        $param = ("type=query/name=web_star_recommend/sql=$sql_male/cachetime=86400");
                        $_MooClass['MooCache']->getBlock($param);
                        $arr_diamond_male = $GLOBALS['_MooBlock']['web_star_recommend']; */
                }
            }
        }
    }
    $diamond = array();
    foreach ($arr_diamond as $v) {
        if (MooGetphoto($v['uid'], 'middle')) {
            $imgSrc = MooGetphoto($v['uid'], 'mid');
        } else {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        }
        if ($v['nickname']) {
            $nickname = MooCutstr($v['nickname'], 6, '');
        } else {
            $nickname = "ID:" . $v['uid'];
        }
        if ($v['birthyear'] == '') {
            $age = iconv('gbk', 'utf-8', "年龄:保密");
        } else {
            $age = date('Y') - $v['birthyear'] . "岁";
        }
        foreach ($provice_list as $key => $val) {
            if ($v['province'] == $key) {
                $PROVINCE = $val;
                break;
            }
        }
        foreach ($city_list as $key => $val) {
            if ($v['city'] == $key) {
                $CITY = $val;
                break;
            }
        }
        $diamond[] = array("uid" => $v['uid'], "imgSrc" => $imgSrc, "nickname" => $nickname, "age" => $age, "province" => $PROVINCE, "city" => $CITY);
    }
    //========================高级会员=============================
    $param = "type=query/name=members_advance/sql=SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid  where s.s_cid='30' and  s.images_ischeck=1 and s.is_lock=1 and s.showinformation=1 order by s.uid desc limit 8/cachetime=86400";
    $_MooClass['MooCache']->getBlock($param);
    $members_advance = isset($GLOBALS['_MooBlock']['members_advance']) ? $GLOBALS['_MooBlock']['members_advance'] : '';
    $advance = array();
    foreach ($members_advance as $v) {
        if (MooGetphoto($v['uid'], 'middle')) {
            $imgSrc = MooGetphoto($v['uid'], 'mid');
        } else {
            $imgSrc = "module/index/templates/default/images/se_woman.gif";
        }
        if ($v['nickname']) {
            $nickname = MooCutstr($v['nickname'], 6, '');
        } else {
            $nickname = "ID:" . $v['uid'];
        }
        if ($v['birthyear'] == '') {
            $age = iconv('gbk', 'utf-8', "年龄:保密");
        } else {
            $age = date('Y') - $v['birthyear'] . "岁";
        }
        foreach ($provice_list as $key => $val) {
            if ($v['province'] == $key) {
                $PROVINCE = $val;
                break;
            }
        }
        foreach ($city_list as $key => $val) {
            if ($v['city'] == $key) {
                $CITY = $val;
                break;
            }
        }
        $advance[] = array("uid" => $v['uid'], "imgSrc" => $imgSrc, "nickname" => $nickname, "age" => $age, "province" => $PROVINCE, "city" => $CITY);
    }
    //========================成功案例=============================
    $storyList = array();
    $param = "type=query/name=story/sql=select s.sid,s.uid,s.title,s.content,s.name1,s.name2,s.story_date,sp.img from `{$dbTablePre}story` as s left join  `{$dbTablePre}story_pic` as sp on s.is_index=sp.mid where sp.syscheck=1 and s.syscheck=1 and s.recommand= '1' order by s.story_date desc,sp.img desc limit 0, 4/cachetime=86400";
    $_MooClass['MooCache']->getBlock($param);
    $story = $GLOBALS['_MooBlock']['story'];
    foreach ($story as $v) {
        $picsmall = MooGetstoryphoto($v['sid'], $v['uid'], 'medium');
        if ($picsmall) {
            $imgSrc = "<img src=\"" . $picsmall . "\" width=\"211\" height=\"143\" /> ";
        } else {
            $imgSrc = "<img src=\"module/index/templates/default/images/story_sample.jpg\" width=\"211\" height=\"143\" />";
        }
        $title = MooCutstr($v['title'], 18, $dot = ' ');
        $name1 = MooCutstr($v['name1'], 8, '');
        $name1 = getSex($v['uid']) ? "她" . $name1 : "他" . $name1;
        $name2 = MooCutstr($v['name2'], 8, '');
        $name2 = getSex($v['uid']) ? '她' . $name2 : '他' . $name2;
        $date = Date('Y-m-d', $v['story_date']);
        $content = MooCutstr($v['content'], 50, $dot = ' ...');
        $storyList[] = array("sid" => $v['sid'], "imgSrc" => $imgSrc, "title" => $title, "name1" => $name1, "name2" => $name2, "date" => $date, "content" => $content);
    }
    // print_r($storyList);exit;
    MooPlugins('ipdata');
    $ip = GetIP();
    //$ip = '119.145.41.181';
    $finally_ip = convertIp($ip);
    //$news_ip =iconv('gbk','utf-8',file_get_contents('http://fw.qq.com/ipaddress'));
    //$finally_ip = $news_ip;
    //echo $finally_ip;
    if (preg_match('/(广东|广州|深圳|佛山|珠海|东莞|汕头|韶关|江门|湛江|茂名|肇庆|惠州|梅州|汕尾|河源|清远|阳江|潮州|揭阳|云浮)/', $finally_ip)) {
        $finally_address = 1;
    }
    $time = time();
    //活动时间
    $activitytime1 = "2011-02-01 00:30:00";
    $activitytime2 = "2011-02-08";
    if ($time >= strtotime($activitytime1) && $time < strtotime($activitytime2)) {
        $appear = "1";
    }
    // note 与相亲网首页错开会员
    $api = MooGetGPC('api', 'string', "G");
    if ($api == '0019') {
        $d = '';
        foreach ($userList as $v) {
            if ($v['uid'] < 30000000) {
                $apistr .= $d . $v['uid'];
                $d = ',';
            }
        }
        exit($apistr);
    }
    $text_list = text_show();
    //echo $province;
    require MooTemplate('public/index_test', 'module');
}
Пример #29
0
function simulateSend()
{
    global $userid, $_MooClass, $timestamp;
    $user = array_merge(MooGetData('members_login', 'uid', $userid), MooMembersData($userid));
    //ob_clean();
    $json = array();
    //=======================模拟发送秋波,关注,鲜花===========================
    //男女匹配
    if ($user['gender'] == 1) {
        // 年龄段分析
        $start_year = $user['birthyear'] - 2;
        $end_year = $user['birthyear'] + 10;
        $index = 'members_man';
        $gender = 0;
    } else {
        // 年龄段分析
        $start_year = $user['birthyear'] - 10;
        $end_year = $user['birthyear'] + 2;
        $index = 'members_women';
        $gender = 1;
    }
    //在sphinx中搜索
    $sp = searchApi($index);
    //满足省市
    $sp->getResultOfReset(array(array("is_lock", 1), array("images_ischeck", 1), array("province", $user['province']), array("city", $user['city']), array("gender", $gender), array("usertype", 3), array("birthyear", array($start_year, $end_year))), array("offset" => 0, "limit" => 20));
    $member_list = $sp->getIds();
    $member_key = array_rand($member_list, rand(1, 5));
    $member_list_ = array();
    foreach ($member_key as $v) {
        $member_list_[] = $member_list[$v];
    }
    $last_login_time = $user['last_login_time'] ? $user['last_login_time'] : $timestamp;
    $opaction = array('1' => '礼物', '2' => '秋波', '3' => '关注');
    $_uidlist_ = '';
    $_result_ = array();
    $_uidlist_ = implode(',', $member_list_);
    if ($_uidlist_) {
        $_result_ = $_MooClass['MooMySQL']->getAll("SELECT screenid FROM web_screen WHERE mid='{$userid}' and uid in ({$_uidlist_})");
    }
    if (count($_result_) > 0) {
        exit;
    }
    foreach ($member_list_ as $senduid) {
        $key = array_rand($opaction, 1);
        $sendtime = $last_login_time - rand(1000, 259200);
        $json[$senduid] = $key . ',' . $opaction[$key];
        if ($key == '1') {
            //$rosenum_check =  $_MooClass['MooMySQL']->getOne("SELECT rosenumber FROM web_members_base  WHERE `uid`='{$userid}'  LIMIT 1",true);
            //if($rosenum_check['rosenumber'] > 0) {
            $rose = $_MooClass['MooMySQL']->getOne("SELECT rid FROM web_service_rose WHERE receiveuid = '{$userid}' AND senduid = '{$senduid}' ORDER BY rid DESC LIMIT 1");
            if (isset($rose['rid'])) {
                $rid = $rose['rid'];
                //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
                $_MooClass['MooMySQL']->query("UPDATE web_service_rose SET  receivenum = receivenum + 1,sendtime = '{$sendtime}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
            } else {
                //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
                $_MooClass['MooMySQL']->query("INSERT INTO web_service_rose SET receivenum = 1, sendtime = '{$sendtime}',receivetime='{$timestamp}',senduid  = '{$senduid}',receiveuid = '{$userid}' ");
            }
            //note 发送一朵玫瑰,自己就要减少一朵玫瑰
            //$_MooClass['MooMySQL']->query("UPDATE web_members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$userid}'");
            //if(MOOPHP_ALLOW_FASTDB){
            //	$user_rosenum =  $_MooClass['MooMySQL']->getOne("SELECT rosenumber FROM web_members_base  WHERE `uid`='{$userid}'  LIMIT 1",true);
            //	$value['rosenumber']= $user_rosenum['rosenumber'];
            //	MooFastdbUpdate('members_base','uid',$userid,$value);
            //}
            //}
        } elseif ($key == '2') {
            $leer = $_MooClass['MooMySQL']->getOne("SELECT lid FROM web_service_leer WHERE receiveuid = '{$userid}' AND senduid = '{$senduid}' ", true);
            if (isset($leer['lid'])) {
                //已经发送过秋波
                $lid = $leer['lid'];
                //增加发送秋波的次数
                $_MooClass['MooMySQL']->query("UPDATE web_service_leer SET receivenum = receivenum + 1,`stat`='0',sendtime = '{$sendtime}',receivetime = '{$timestamp}',receive_del =0,is_read=0 WHERE lid = '{$lid}'");
            } else {
                //note 发送新的秋波,写入数据库 发送者,接受者,发送时间
                $_MooClass['MooMySQL']->query("INSERT INTO web_service_leer SET sendtime = '{$sendtime}',receivetime = '{$timestamp}',receivenum = '1', num = '1', senduid  = '{$senduid}',receiveuid = '{$userid}'");
            }
        } elseif ($key == '3') {
            //note 加为意中人,新插入一行记录
            $friend = $_MooClass['MooMySQL']->getOne("SELECT fid FROM web_service_friend WHERE friendid = '{$userid}' AND  uid= '{$senduid}' ", true);
            if (isset($friend['fid'])) {
                $fid = $friend['fid'];
                $_MooClass['MooMySQL']->query("update web_service_friend SET friendid  = '{$userid}',uid = '{$senduid}',sendtime='{$sendtime}' where fid='{$fid}'");
            } else {
                $_MooClass['MooMySQL']->query("Insert INTO web_service_friend SET friendid  = '{$userid}',uid = '{$senduid}',sendtime='{$sendtime}'");
            }
        }
    }
    //$json=array('30000027'=>'2,秋波','30000007'=>'1,鲜花','30000008'=>'3,关注');
    echo json_encode($json);
    exit;
}
Пример #30
0
function index_index1()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr, $memcached, $uuid;
    $sql_condition_province = $sql_condition_city = 'gender';
    $province = '';
    $currentdistrict = '0';
    $arr_diamond_female = $arr_diamond_male = null;
    $provice_list = $city_list = $province_othercachefile = null;
    $s_cid = 40;
    $uid = $_GET['uid'] = isset($_GET['uid']) ? $_GET['uid'] : '';
    if ($uid) {
        $userid = $mem_uid = $memcached->get('uid_' . $uid);
        $user_arr = MooMembersData($userid);
    }
    if ($userid) {
        $and_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : '';
        $checkuuid = check_uuid($and_uuid, $userid);
        if (!$checkuuid) {
            //$error = "uuid_error";
            //echo return_data($error,false);exit;
        }
    }
    $sex = !MooGetGPC('h', 'integer', 'G') ? 0 : 1;
    //note 性别
    $workprovince = MooGetGPC('workprovince', 'integer', 'G');
    //工作省份
    $workcity = MooGetGPC('workcity', 'integer', 'G');
    //工作城市
    //$workprovince = $user_arr['province']?$user_arr['province']:0;
    //$workcity = $user_arr['city']?$user_arr['city']:0;
    if (in_array($workprovince, array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $workcity = $workprovince;
        $workprovince = 10101000;
    }
    $age1 = MooGetGPC('age1', 'integer', 'G');
    //最小年龄
    $age2 = MooGetGPC('age2', 'integer', 'G');
    //最大年龄
    $userList = $userList2 = array();
    $index_total_user = 24;
    //首页总用户数
    //note 当前年份
    $year = date('Y');
    //登录用户查找性别
    $sql_gender = '';
    //性别取反
    if ($userid) {
        $gender = $user_arr['gender'] == 1 ? 0 : 1;
        $sql_gender = " and s.gender='{$gender}'";
        $sql_condition_province .= $sql_gender;
        $sql_condition_city .= " and s.gender='{$gender}'";
    } else {
        if ($_GET['gender'] == 0 || $_GET['gender'] == 1) {
            $gender = $_GET['gender'];
            $sql_gender = " and s.gender='{$gender}'";
            $sql_condition_province .= $sql_gender;
            $sql_condition_city .= " and s.gender='{$gender}'";
        }
    }
    //	get_integrity();
    $date_time = date('d');
    $month_time = date('m');
    $reguser_num = 30000 + $month_time * 1100 + $date_time * 191;
    /*
    		//默认进入
    		//包含配置文件
    		include_once("./module/crontab/crontab_config.php");
    		$cur_ip = GetIP();
    		MooPlugins('ipdata');
    		$ip_arr = convertIp($cur_ip);
    		//得到省份对应的数值,查库
    		$province = $city = "";
    		foreach($provice_list as $key => $val){
    			if(strstr($ip_arr,$val)){
    				$province = $key;
    				$currentdistrict=$val;
    				break;
    			}
    		}
    		if(isset($_GET['province'])){
    			foreach($provice_list as $key => $val){
    				if($_GET['province']==$key){
    					$currentdistrict=$val;
    					$province = $key;
    					break;
    				}
                }
    	    }
    	    $test = array();
    	    if(isset($currentdistrict)){
    			$index_img_num = 5;
    			$index_img = index_img($currentdistrict,$index_img_num);
    			$small_img_num = 3;
    			$small_img = small_img($currentdistrict,$small_img_num,$province);
    			$test = test($currentdistrict);
    	    }
    		//得到市对应的城市代号
    		foreach($city_list as $city_key => $city_val){
    		
    			if(strstr($ip_arr,$city_val)){
    				$city = $city_key;
    				break;
    			}
    		}
    */
    $userList = array();
    //查市城市之星
    //note 修正广东省深圳和广州的区域查询
    if (in_array($province, array(10101201, 10101002))) {
        $city = $province;
        $province = 10101000;
    }
    $sql_city = "s.city='{$city}'";
    //修正直辖市查询
    if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
        $city = '0';
    }
    if ($city == 0) {
        $sql_city = "s.province='{$province}'";
    }
    if (!empty($city) || !empty($province)) {
        //默认没有进入  选择省后进入
        $sql = "SELECT s.uid,b.mainimg,s.gender FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base b on s.uid=b.uid WHERE s.images_ischeck=1 {$sql_gender} and s.s_cid='20' or ({$sql_city} AND s.is_lock=1 AND s.images_ischeck=1 and s.nickname!='' AND s.showinformation=1 AND s.city_star>=1 AND s.usertype=1) AND s.uid!=20752315 order by s.s_cid limit 32";
        $param = "type=query/name=userlist_{$city}9{$gender}_citystar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        //
        $userList = $GLOBALS['_MooBlock']["userlist_{$city}9{$gender}_citystar"];
        //市缓存文件
        $city_cachefile = "userlist_{$city}9{$gender}_citystar" . '_' . md5($param) . '.data';
    }
    //市无城市之星,从省取城市之星
    if (empty($userList)) {
        $sql = "select s.uid,b.mainimg,s.gender from  {$dbTablePre}members_search as s left join {$dbTablePre}members_base b on s.uid=b.uid WHERE s.province='{$province}'\n\t\t\t          AND s.is_lock=1  \n\t\t\t          {$sql_gender} \n\t\t\t          AND s.images_ischeck = 1 AND s.showinformation=1 \n\t\t\t          and s.city_star>=1 and s.usertype=1 AND s.uid!=20752315 LIMIT 32";
        $param = "type=query/name=userlist_{$province}9{$gender}_provincestar/sql={$sql}/cachetime=86400";
        $_MooClass['MooCache']->getBlock($param);
        $userList = $GLOBALS['_MooBlock']["userlist_{$province}9{$gender}_provincestar"];
        //省缓存文件
        $province_cachefile = "userlist_{$province}9{$gender}_provincestar" . '_' . md5($param) . '.data';
    }
    //城市之星不够取钻石会员(市->省->全国)
    $count = count($userList);
    if ($count < 32) {
        //默认进入
        $addarr = array('cityadd', 'provinceadd', 'countryadd');
        $user_in = '1747188|2154375|1600591|2159633|20782701|20785837|20561126|20305660|20910184';
        //城市之星uid
        $user_list = array();
        if (!is_array($userList)) {
            $userList = array();
        }
        //enky add
        foreach ($userList as $user) {
            $user_list[] = $user['uid'];
        }
        if (!empty($user_list)) {
            $user_in .= ',' . implode('|', $user_list);
        }
        //从(市->省->全国)取钻石会员
        $cityadd = array();
        $provinceadd = array();
        $countryadd = array();
        foreach ($addarr as $add) {
            if ($count < 32) {
                $id = '';
                //从市取
                if ($add == 'cityadd') {
                    if (!$city || $city == 0) {
                        continue;
                    }
                    $sql_add = "s.city='{$city}' and";
                    $id .= $city;
                }
                //从省取
                if ($add == 'provinceadd') {
                    if (!$province || $province == 0) {
                        continue;
                    }
                    $sql_add = "s.province='{$province}' and";
                    $id .= $province;
                }
                //全国取
                if ($add == 'countryadd') {
                    $sql_add = '';
                    $id .= 'country';
                }
                //取几个钻石会员
                $add_query_sum = 32 - $count;
                $cl = searchApi('members_women members_man');
                $cond[] = array('is_lock', '1', false);
                $cond[] = array('images_ischeck', '1', false);
                $cond[] = array('usertype', '1', false);
                $cond[] = array('@id', '20752315|' . $user_in, true);
                //uid
                $cond[] = array('s_cid', '20', false);
                $cond[] = array('city_star', '0', false);
                $cond[] = array('showinformation', '1', false);
                $cond[] = array('pic_num', array(1, 20), false);
                if ($province) {
                    array('province', $province, false);
                }
                if ($city) {
                    array('city', $city, false);
                }
                $limit = array($add_query_sum);
                $res_matches = $cl->getResult($cond, $limit);
                if ($res_matches) {
                    $count_res = count($res_matches);
                    $array_merge = array();
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i])) {
                            $ids[] = $res_matches['matches'][$i]['id'];
                        }
                    }
                    $sql_str = implode(',', $ids);
                    $nickname_res = $_MooClass['MooMySQL']->getAll("select nickname,uid from web_members_search where uid in " . "({$sql_str})");
                    $mainimg_res = $_MooClass['MooMySQL']->getAll("select mainimg from web_members_base where uid in " . "({$sql_str})");
                    //合并到sphinx查询出的整理后的数组
                    for ($i = 0; $i < $count_res; $i++) {
                        if (!empty($res_matches['matches'][$i]['attrs'])) {
                            $res_matches['matches'][$i]['attrs']['nickname'] = $nickname_res[$i]['nickname'];
                            $res_matches['matches'][$i]['attrs']['uid'] = $nickname_res[$i]['uid'];
                            $res_matches['matches'][$i]['attrs']['mainimg'] = $mainimg_res[$i]['mainimg'];
                            $bigarr[] = $res_matches['matches'][$i]['attrs'];
                        }
                    }
                    ${$add} = $bigarr;
                } else {
                    $sql = "select s.uid,b.mainimg,s.gender from {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid  where s.uid not in({$user_in})\n\t\t\t\t\t          AND {$sql_add} s.city_star=0 AND s.s_cid = 20 \n\t\t\t\t\t          AND s.images_ischeck  = 1 {$sql_gender} AND s.is_lock = 1 AND s.showinformation = 1\n\t\t\t\t\t          AND s.pic_num >=1 AND s.usertype=1 AND s.uid!=20752315 \n\t\t\t\t\t          LIMIT {$add_query_sum}";
                    $param = "type=query/name=userlist_{$id}9{$gender}_other/sql={$sql}/cachetime=86400";
                    $_MooClass['MooCache']->getBlock($param);
                    ${$add} = $GLOBALS['_MooBlock']["userlist_{$id}9{$gender}_other"];
                }
                //已获取的首页会员uid
                $user_list = array();
                if (!is_array(${$add})) {
                    ${$add} = array();
                }
                //enky add
                foreach (${$add} as $user) {
                    $user_list[] = $user['uid'];
                }
                if (!empty($user_list)) {
                    $user_in .= ',' . implode(',', $user_list);
                }
                //echo $user_in;exit;
                //已有总数
                $count += count(${$add});
            }
        }
        //$countryadd  have data
        $userList = array_merge($userList, $cityadd, $provinceadd, $countryadd);
        //省其它类型会员缓存文件
        $province_othercachefile = "userlist_{$id}9{$gender}_other" . '_' . md5($param) . '.data';
    }
    //生成的block缓存文件存库
    $city = $city ? $city : 0;
    $sql = "SELECT * FROM {$dbTablePre}index_cachefile WHERE province='{$province}9{$gender}' AND city='{$city}{$gender}'";
    $cache_arr = $_MooClass['MooMySQL']->getAll($sql);
    if (empty($cache_arr)) {
        $province_cachefile = isset($province_cachefile) ? $province_cachefile : '';
        $sql = "INSERT INTO {$dbTablePre}index_cachefile SET province='{$province}9{$gender}',city='{$city}{$gender}',provincestarfile='{$province_cachefile}',citystarfile='{$city_cachefile}',provinceotherfile='{$province_othercachefile}'";
        $_MooClass['MooMySQL']->query($sql);
    }
    /*
    		//new
    		//推荐列表中如果存在,则以推荐列表中的指定的sort替换
    		$sql = "SELECT * FROM {$dbTablePre}members_recommend WHERE province='{$province}' AND city='$city' order by sort asc";
    		$recommend_list = $_MooClass['MooMySQL']->getAll($sql);
    		
    		if(!empty($recommend_list)){
    			foreach($recommend_list as $list){
    				$sort = $list['sort'] < 1 ? 0 : $list['sort']-1;
    				if(MOOPHP_ALLOW_FASTDB){
    					$u = MooFastdbGet('members_search','uid',$list['uid']);
    					$u2 = MooFastdbGet('members_base','uid',$list['uid']);
    					if (is_array($u) && is_array($u2)){
    					   $u = array_merge($u,$u2);
    					}
    				}else{
    					$sql = "SELECT s.uid,s.nickname,s.gender,s.images_ischeck,s.province,s.city,s.birthyear,s.s_cid,s.city_star,b.mainimg FROM {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid WHERE s.uid='{$list['uid']}'";
    					$u = $_MooClass['MooMySQL']->getOne($sql,true);
    				}
    				if($u) {
    					foreach($userList as $key => $val) {
    						if($list['uid'] == $val['uid']) {
    							$user_key = $key;
    							break;
    						}
    					}
    					if(isset($user_key)) {
    						if(isset($userList[$sort])) {
    							$userList[$key] = $userList[$sort];
    						}
    						$userList[$sort] = $u;
    					} else {
    						$userList[$sort] = $u;
    					}
    				}
    			}
    			
    		}
    			
    	
    	//new over
    	 * */
    //删除数组中多余的部分
    array_splice($userList, 12);
    foreach ($userList as $key => $value) {
        $mainimg = MooGetphoto($value['uid'], $style = "com");
        $users[] = array('uid' => $value['uid'], 'mainimg' => $mainimg, 'gender' => $value['gender']);
    }
    //echo return_data($users);
    foreach ($users as $val) {
        $sha[] = $val['uid'];
    }
    $sha_in = implode(',', $sha);
    $sha_ar = $_MooClass['MooMySQL']->getAll("select nickname from web_members_search where uid in " . "({$sha_in})");
    foreach ($sha_ar as $va) {
        echo $va['nickname'] . '<br />';
    }
    exit;
}