Ejemplo n.º 1
0
/**
@param (忘记密码)通过地址栏用户名和新密码登陆
@param return null
*/
function find_pwd()
{
    global $_MooClass, $dbTablePre, $userid, $_MooCookie;
    //	if($userid){
    //		return;
    //	}
    $uid = MooGetGPC('uid', 'string', G);
    $pwd = MooGetGPC('upwd', 'string', G);
    /*	echo md5($uid).'<br>';
    	echo md5($pwd);
    	print_r($_COOKIE);
    	exit;
    */
    if ($_MooCookie['findpwd'] == md5($pwd) && md5($uid) == $_MooCookie['finduser']) {
        $newpwd = md5(base64_decode($pwd));
        //note 修改密码
        //$_MooClass['MooMySQL']->query("update {$dbTablePre}members set password = '******' where uid = '{$uid}'");
        //if(MOOPHP_ALLOW_FASTDB){
        //			MooFastdbUpdate('members','uid',$uid);
        //		}
        MooSetCookie('auth', MooAuthCode("{$uid}\t{$newpwd}", 'ENCODE'), 86400);
        //note 写入session表需要的字段值
        $online_ip = GetIP();
        $lastactive = $GLOBALS['timestamp'];
        //$uid = $user['uid'];
        //note 更新用户的最近登录ip和最近登录时间
        $updatesqlarr = array('lastip' => $online_ip, 'lastvisit' => $lastactive, 'password' => $newpwd);
        $wheresqlarr = array('uid' => $uid);
        updatetable("members_search", $updatesqlarr, $wheresqlarr);
        if (MOOPHP_ALLOW_FASTDB) {
            $val = array();
            $val['lastip'] = $online_ip;
            $val['lastvisit'] = $lastactive;
            $val['password'] = $newpwd;
            MooFastdbUpdate('members_search', 'uid', $uid, $val);
            //!!
        }
        //note 先删除表里面已存在对应用户的session
        //$_MooClass['MooMySQL']->query("DELETE FROM `{$dbTablePre}membersession` WHERE `uid` ='$uid'");
        //$_MooClass['MooMySQL']->query("REPLACE INTO `{$dbTablePre}membersession` SET `username`= '$user[username]',`password`='$user[password]',`ip` = '$online_ip',`lastactive` = '$lastactive',`uid` = '$uid'");
        return 1;
    }
    return 0;
}
Ejemplo n.º 2
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");
    }
}
Ejemplo n.º 3
0
function ajax_sendmes()
{
    $sender = MooGetGPC('sender', 'integer', 'P');
    $receiver = MooGetGPC('receiver', 'integer', 'P');
    $mes = MooGetGPC('mes', 'string', 'P');
    $time = time();
    $sql = "INSERT INTO {$GLOBALS['dbTablePre']}service_chat(s_uid,s_fromid,s_content,s_time,s_status,is_server,dealstate)\n\t\t\tVALUE({$receiver},{$sender},'{$mes}',{$time},0,{$GLOBALS['adminid']},1)";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    //伪造会员在线
    $time = time();
    $sql = "UPDATE {$GLOBALS['dbTablePre']}members_login SET lastvisit = {$time} WHERE uid = {$sender}";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        MooFastdbUpdate('members_login', 'uid', $sender);
    }
    //写日志
    serverlog(4, $GLOBALS['dbTablePre'] . 'service_chat', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$sender}的身份与会员{$receiver}聊天", $GLOBALS['adminid']);
    echo 'ok';
    exit;
}
Ejemplo n.º 4
0
function check_member_voice()
{
    $uid = MooGetGPC('uid', 'string');
    $sql = "select a.birthyear,a.gender,b.uid,b.toshoot_voice_check,b.toshoot_voice_url from {$GLOBALS['dbTablePre']}certification b left join {$GLOBALS['dbTablePre']}members a on a.uid=b.uid where b.uid={$uid}";
    $member_voice = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $value = array();
    //录音存储路径
    $path_url = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/'))) . '://' . $_SERVER['HTTP_HOST'];
    $voice_path = $path_url . '/' . $member_voice['toshoot_voice_url'] . '/voi_' . $uid . '.flv';
    if ($_POST) {
        $is_pass = MooGetGPC('pass', 'string');
        $is_onpass = MooGetGPC('nopass', 'string');
        if ($is_onpass) {
            if ($member_voice['toshoot_voice_check'] == 2) {
                $sql = "update {$GLOBALS['dbTablePre']}certification set toshoot_voice_check='1' where uid={$uid}";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            }
            if (MOOPHP_ALLOW_FASTDB) {
                $value['toshoot_video_check'] = 1;
                MooFastdbUpdate('certification', 'uid', $uid, $value);
            }
            sendusermessage($uid, "尊敬的红娘会员,您的录音不符合要求,请重新录音!", "录音审核");
            echo "<script>alert('审核不通过!')</script>";
            exit;
        } elseif ($is_pass) {
            $sql = "update {$GLOBALS['dbTablePre']}certification set toshoot_voice_check='2' where uid={$uid}";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            if (MOOPHP_ALLOW_FASTDB) {
                $value['toshoot_video_check'] = 2;
                MooFastdbUpdate('certification', 'uid', $uid, $value);
            }
            sendusermessage($uid, "尊敬的红娘会员,您的录音已经通过红娘的审核!", "录音审核");
            echo "<script>alert('审核通过!');window.history.go(-1);</script>";
            exit;
        }
    }
    require_once adminTemplate('check_member_voice');
}
Ejemplo n.º 5
0
/**
@param 给会员加鲜花
@param $uid 会员ID
@param $num 默认加一朵鲜花
@param return null
*/
function MooAddRose($uid, $num = 1)
{
    global $_MooClass, $dbTablePre;
    if ($uid) {
        $_MooClass['MooMySQL']->query("update {$dbTablePre}members_base set rosenumber = rosenumber+{$num} where uid = {$uid} and is_lock = 1");
        if (MOOPHP_ALLOW_FASTDB) {
            $user_inf = MooFastdbGet('members_base', 'uid', $uid);
            $value['rosenumber'] = $user_inf['rosenumber'] + $num;
            MooFastdbUpdate('members_base', 'uid', $uid, $value);
        }
    }
}
Ejemplo n.º 6
0
Archivo: ajax.php Proyecto: noikiy/zays
function reg_modifytel()
{
    global $userid, $dbTablePre, $_MooClass;
    $tel_val = MooGetGPC('tel_val', 'string', 'G');
    $sql = "update {$dbTablePre}members_search set telphone='{$tel_val}' where uid='{$userid}'";
    if ($_MooClass['MooMySQL']->query($sql)) {
        $tel['telphone'] = $tel_val;
        if (MooFastdbUpdate('members_search', 'uid', $userid, $tel)) {
            echo 'ok';
        }
    }
}
Ejemplo n.º 7
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('操作不合法');
    }
}
Ejemplo n.º 8
0
Archivo: ajax.php Proyecto: noikiy/zays
function make($uid)
{
    global $_MooClass, $dbTablePre, $timestamp, $memcached, $_MooCookie, $user_arr;
    $province = isset($_MooCookie['province']) ? $_MooCookie['province'] : '';
    $city = isset($_MooCookie['city']) ? $_MooCookie['city'] : '';
    // 增加一处判断 cookie 没有记录的时候直接从 user_arr 获取城市信息
    if (!empty($user_arr) && (empty($province) || empty($city))) {
        $province = empty($province) ? empty($user_arr['province']) ? empty($user_arr['hometownprovince']) ? '' : $user_arr['hometownprovince'] : $user_arr['province'] : $province;
        $city = empty($city) ? empty($user_arr['city']) ? empty($user_arr['hometowncity']) ? '' : $user_arr['hometowncity'] : $user_arr['city'] : $city;
    }
    if (empty($province) && empty($city)) {
        return 0;
    }
    //exit ();
    $time = time();
    $randdo = rand(1, 15);
    if ($randdo > 8) {
        return 0;
    }
    // note 当前会员工作地
    if (MOOPHP_ALLOW_FASTDB) {
        $current_user = MooFastdbGet('members_search', 'uid', $uid);
    } else {
        $current_user = $_MooClass['MooMySQL']->getOne("select province,city,gender,birthyear,s_cid from {$dbTablePre}members_search where uid='{$uid}'");
    }
    // note 与当前会员在同一工作地或同一省的会员
    $fgender = $current_user['gender'] == '0' ? '1' : '0';
    // 取当前用户相反性别
    if ($fgender == 1) {
        // 2.2.1男找女:年龄小于自己的优先,向下无限制(限制在12岁),向上在5岁以内;
        // $age1 = $current_user['birthyear']-1;
        $age1 = $current_user['birthyear'] - 5;
        $age2 = $current_user['birthyear'] + 12;
    } else {
        // 2.2.2女找男:年龄大于自己的优先,向上20岁以内,向下3岁以内;
        $age1 = $current_user['birthyear'] - 20;
        $age2 = $current_user['birthyear'] + 3;
    }
    // note 修正广东省深圳和广州的区域查询
    if (in_array($province, array(10101201, 10101002))) {
        $city = $province;
        $province = 10101000;
    }
    // 修正直辖市查询
    if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
        $city = '0';
    }
    if ($fgender == '0' || $fgender == '1') {
        // girl search boy
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search   WHERE gender='{$fgender}' and  province='{$province}' and is_lock=1  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1  " . (!empty($current_user) && $current_user['s_cid'] < 40 ? ' and usertype=1' : '  and usertype=3');
        // and
        // usertype=1
    }
    if (MOOPHP_ALLOW_FASTDB) {
        global $fastdb;
        $md5_sql1 = md5($sql);
        $user = unserialize($fastdb->get($md5_sql1));
        if (!$user || $user['last_time'] < time()) {
            $user = $_MooClass['MooMySQL']->getOne($sql);
            $user['last_time'] = time() + 3600 * 24 * 7;
            $fastdb->set($md5_sql1, serialize($user));
        }
    } else {
        $user = $_MooClass['MooMySQL']->getOne($sql);
    }
    $rand = $user['num'];
    $rand = mt_rand(0, $rand);
    $arrUser = array();
    /*if ($user ['num'] > 60) { // exceed 60
    		if ($fgender == '0' || $fgender == '1') { // girls find boys
    			$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1  left join {$dbTablePre}members_base m on mes1.uid=m.uid  WHERE mes1.gender='{$fgender}' and  mes1.province='{$province}' and mes1.is_lock=1  and mes1.birthyear>='$age1' AND mes1.birthyear<='$age2' and mes1.images_ischeck=1  and mes1.showinformation=1 " . ((! empty ( $current_user ) && $current_user ['s_cid'] < 40) ? ' and mes1.usertype=1' : '  and mes1.usertype=3') . " order by  mes1.city<>'{$city}',mes1.city desc LIMIT {$rand},1"; // and
    			                                                                                                                                                                                                                                                                                                                                                                                                                                                                               // mes1.usertype=1
    		}
    		
    		 $arrUser = $_MooClass['MooMySQL']->getOne($sql,true);
    	} else { //
    		if ($fgender == '0' || $fgender == '1') { // girls find boys
    			$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 left join {$dbTablePre}members_base m on mes1.uid=m.uid  WHERE mes1.gender='{$fgender}' and  mes1.is_lock=1 and  mes1.birthyear>='$age1' AND mes1.birthyear<='$age2'  and mes1.images_ischeck=1  and mes1.showinformation=1 " . ((! empty ( $current_user ) && $current_user ['s_cid'] < 40) ? ' and mes1.usertype=1' : '  and mes1.usertype=3') . " order by mes1.province<>'{$province}',mes1.city<>'{$city}',mes1.province desc,mes1.city desc LIMIT {$rand},1"; // and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // mes1.usertype=1
    		}
    	
    	}*/
    //echo 'aaa';exit;
    $cl = searchApi('members_man members_women');
    //print_r($cl);
    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('city', $city, 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);
            }
            $cl->SetMatchMode(SPH_MATCH_EXTENDED);
            //设置模式
            $cl->SetRankingMode(SPH_RANK_PROXIMITY);
            //设置评分模式
            $cl->SetFieldWeights(array('province' => 1, 'city' => 2));
            //设置字段的权重,如果city命中,那么权重算2
            //$cl->SetSortMode ('SPH_SORT_EXPR','@weight');//按照权重排序
            $sort = '@weight';
            //$sort = 'city desc';
            $rs_total = $cl->getResultOfReset($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResultOfReset($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);
            }
            $cl->SetMatchMode(SPH_MATCH_EXTENDED);
            //设置模式
            $cl->SetRankingMode(SPH_RANK_PROXIMITY);
            //设置评分模式
            $cl->SetFieldWeights(array('province' => 1, 'city' => 2));
            //设置字段的权重,如果city命中,那么权重算2
            //$cl->SetSortMode ('SPH_SORT_EXPR','@weight');//按照权重排序
            $sort = '@weight';
            $limit = array($rand, 1);
            //$sort = 'province desc,city desc';
            $rs_total = $cl->getResultOfReset($cond, $limit, $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $rs = $cl->getResultOfReset($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)) {
        if (MOOPHP_ALLOW_FASTDB) {
            $user = MooFastdbGet('members_login', 'uid', $arrUser['uid']);
        } else {
            $user = $_MooClass['MooMySQL']->getOne('SELECT `lastvisit` FROM `' . $dbTablePre . 'members_login` WHERE uid=' . $arrUser['uid']);
        }
        if ($user['lastvisit'] < $GLOBALS['timestamp'] - 600) {
            $nowtime = $GLOBALS['timestamp'];
        } else {
            $nowtime = rand(1, 100) > 70 ? $GLOBALS['timestamp'] : $GLOBALS['timestamp'] - rand(60, 120) * 60;
        }
        $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
        if (MOOPHP_ALLOW_FASTDB) {
            MooFastdbUpdate('members_login', 'uid', $arrUser['uid'], array('lastvisit' => $nowtime));
        }
        $result = $_MooClass['MooMySQL']->getOne("SELECT `vid` FROM `{$dbTablePre}service_visitor` WHERE uid='{$arrUser['uid']}' AND visitorid='{$uid}' AND `who_del`!=2", true);
        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['uid'];
    } else {
        return 0;
    }
}
Ejemplo n.º 9
0
function material_upinfo_submit()
{
    global $_MooClass, $dbTablePre, $userid, $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 = MooMembersData($userid);
    //checkAuthMod('index.php?n=material');//客服模拟登录操作没有修改权限
    $validation = MooAutoLoad('MooValidation');
    $uid = $userid;
    //$user_rank_id=get_userrank($userid);
    //var_dump($user_rank_id);
    //$update1_arr = $update2_arr = $update3_arr = array();
    //note members表字段
    $members_search = array();
    $members_base = array();
    $members_choice = array();
    $members_introduce = array();
    $birthyear = MooGetGPC('year', 'string', 'P');
    $members_search['birthyear'] = $birthyear;
    $birthmonth = MooGetGPC('month', 'string', 'P');
    $birthday = MooGetGPC('days', 'string', 'P');
    $members_search['updatetime'] = time();
    $members_search['nickname'] = safeFilter(MoogetGPC('nickname', 'string', 'P'));
    $members_search['telphone'] = MoogetGPC('telphone', 'string', 'P');
    $members_search['marriage'] = MoogetGPC('marriage1', 'integer', 'P');
    $members_search['height'] = MoogetGPC('height', 'integer', 'P');
    $members_search['salary'] = MoogetGPC('salary', 'integer', 'P');
    $members_search['education'] = MoogetGPC('education1', 'integer', 'P');
    $members_search['children'] = MoogetGPC('children1', 'integer', 'P');
    $members_search['house'] = MoogetGPC('house', 'integer', 'P');
    $members_base['oldsex'] = MoogetGPC('oldsex', 'integer', 'P');
    $members_search['province'] = MoogetGPC('province', 'integer', 'P');
    $members_search['city'] = MoogetGPC('city', 'integer', 'P');
    if (in_array($members_search['province'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_search['city'] = $members_search['province'];
        $members_search['province'] = 10101000;
    }
    //note choice表字段
    $gender = $_MooClass['MooMySQL']->getOne("select gender from {$dbTablePre}members_search WHERE uid='{$uid}'", true);
    if ($gender['gender'] == 0) {
        $members_choice['gender'] = 1;
    } else {
        $members_choice['gender'] = 0;
    }
    //$update2_arr['sex'] = MoogetGpc('sex','integer','p');
    $members_choice['age1'] = MoogetGPC('age1', 'integer', 'P');
    $members_choice['age2'] = MoogetGPC('age2', 'integer', 'P');
    $members_choice['workprovince'] = MoogetGPC('workProvince', 'integer', 'P');
    $members_choice['workcity'] = MoogetGPC('workCity', 'integer', 'P');
    if (in_array($members_choice['workprovince'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_choice['workcity'] = $members_choice['workprovince'];
        $members_choice['workprovince'] = 10101000;
    }
    $members_choice['marriage'] = MoogetGPC('marriage2', 'integer', 'P');
    $members_choice['education'] = MoogetGPC('education2', 'integer', 'P');
    $members_choice['children'] = MoogetGPC('children2', 'integer', 'P');
    $members_choice['salary'] = MoogetGPC('salary1', 'integer', 'P');
    $members_choice['height1'] = MoogetGPC('height1', 'integer', 'P');
    $members_choice['height2'] = MoogetGPC('height2', 'integer', 'P');
    $members_choice['hasphoto'] = MoogetGPC('hasphoto', 'integer', 'P');
    $members_choice['nature'] = MoogetGPC('nature2', 'integer', 'P');
    $members_choice['body'] = MoogetGPC('body2', 'integer', 'P');
    $members_choice['weight1'] = MoogetGPC('weight1', 'integer', 'P');
    $members_choice['weight2'] = MoogetGPC('weight2', 'integer', 'P');
    $members_choice['occupation'] = MoogetGPC('occupation2', 'integer', 'P');
    $members_choice['nation'] = MoogetGPC('stock2', 'integer', 'P');
    $members_choice['hometownprovince'] = MoogetGPC('hometownProvince2', 'integer', 'P');
    $members_choice['hometowncity'] = MoogetGPC('hometownCity2', 'integer', 'P');
    if (in_array($members_choice['hometownprovince'], array(10101201, 10101002))) {
        //note 修正广东省深圳和广州的区域查询 2010-09-04
        $members_choice['hometowncity'] = $members_choice['hometownProvince'];
        $members_choice['hometownprovince'] = 10101000;
    }
    $members_choice['wantchildren'] = MoogetGPC('wantchildren2', 'integer', 'P');
    $members_choice['smoking'] = MoogetGPC('issmoking', 'integer', 'P');
    $members_choice['drinking'] = MoogetGPC('isdrinking', 'integer', 'P');
    $members_introduce['introduce_check'] = safeFilter(trim(MoogetGPC('introduce', 'string', 'P')));
    $rs = $user_arr;
    //note 验证状态
    if (MOOPHP_ALLOW_FASTDB) {
        $sta = MooFastdbGet('certification', 'uid', $uid);
    } else {
        $sta = $_MooClass['MooMySQL']->getOne("select telphone from {$dbTablePre}certification WHERE uid='{$uid}'", true);
    }
    $where_arr = array('uid' => $uid);
    foreach ($members_search as $key => $val) {
        //无手机号吗
        if ($key == 'telphone' && $val == '') {
            continue;
        }
        $memberssearch[$key] = $val;
    }
    //	foreach ($members_base as $key=>$val){
    //		$membersbase[$key]=$val;
    //	}
    if (count($members_base) >= 1 || count($memberssearch) >= 1) {
        $members_search['updatetime'] = time();
        if (!rtrim($members_search['nickname'])) {
            $error = "昵称必填";
            echo return_data($error, false);
            exit;
        }
        if (preg_match('/^(1[345]\\d{9})|(18[024-9]\\d{8})|(010-?\\d{8})|(02)[012345789]-?\\d{8}|(0[3-9]\\d{2,2}-?\\d{7,8})|(.*@.*)$/', $members_search['nickname'])) {
            //MooMessage("昵称不符合规范!", "javascript:history.go(-1)");
            $error = "昵称不符合规范!";
            echo return_data($error, false);
            exit;
        }
        //echo 'sss';exit;
        str_length($members_search['nickname']);
        //note 昵称截取
        $members_search['nickname'] = MooCutstr($members_search['nickname'], 18, $dot = '');
        if ($members_search['telphone'] && !preg_match('/^((1[345]\\d{9})|(18[0-9]\\d{8}))$/', $members_search['telphone'])) {
            //MooMessage('请输入正确的手机号码','javascript:history.go(-1)');
            $error = "请输入正确的手机号码";
            echo return_data($error, false);
            exit;
        }
        //$birth=strtotime("$birthyear/$birthmonth/$birthday");
        $birth = "{$birthyear}-{$birthmonth}-{$birthday}";
        $members_base['birth'] = $birth;
        updatetable('members_base', $members_base, $where_arr);
        updatetable('members_search', $memberssearch, $where_arr);
        if (MOOPHP_ALLOW_FASTDB) {
            MooFastdbUpdate('members_base', 'uid', $uid, $members_base);
            MooFastdbUpdate('members_search', 'uid', $uid, $memberssearch);
        }
        //searchApi("members_man members_women")->UpdateAttributes(array($uid=>$members_search));
    }
    //提交会员动态makui
    UpdateMembersSNS($uid, '修改了资料');
    //内心独白必填
    //if(rtrim($update2_arr['introduce_check'] != '')){
    $members_introduce['introduce'] = '';
    $members_introduce['introduce_pass'] = '******';
    //if(isset($members_choice)){
    $members_choice['updatetime'] = time();
    updatetable('members_choice', $members_choice, $where_arr);
    //}
    updatetable('members_introduce', $members_introduce, $where_arr);
    if (MOOPHP_ALLOW_FASTDB) {
        $members_choice['uid'] = $uid;
        $members_introduce['uid'] = $uid;
        //print_r($update2_arr);exit;
        if (isset($members_choice)) {
            $members_choice['updatetime'] = time();
            MooFastdbUpdate('members_choice', 'uid', $uid, $members_choice);
        }
        MooFastdbUpdate('members_introduce', 'uid', $uid, $members_introduce);
    }
    //searchApi("members_man members_women")->UpdateAttributes(array($uid=>$members_choice));
    if (MOOPHP_ALLOW_FASTDB) {
        $userchoice = MooFastdbGet('members_choice', 'uid', $uid);
        $introduce = MooFastdbGet('members_introduce', 'uid', $uid);
        $userchoice = array_merge($userchoice, $introduce);
    } else {
        $userchoice = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}members_choice mc left join {$dbTablePre}members_introduce mi WHERE mc.uid=mi.uid AND uid = '{$uid}'", true);
    }
    //}else{
    //	MooMessage("内心独白必填!", "index.php?n=material&h=upinfo");
    //}
    /*
    //低质量会员自动分配
    if($user_rank_id == 0){
    	//以下信息都没选,都规为垃圾会员,自动分配给普通客服
    	if($update1_arr['height']=='-1' || $update1_arr['salary']=='-1' || $update1_arr['children']=='-1' || $update1_arr['oldsex']=='-1' || $update2_arr['age1']=='-1' || $update2_arr['age2']=='-1' || $update2_arr['marriage'] == '-1' || $update2_arr['children'] == '-1' || $update2_arr['body'] == '-1'){
    		invalid_user_allotserver($uid);
    	}
    }
    */
    if ($rs['telphone'] == $members_search['telphone'] || $sta['telphone'] == '' || $members_search['telphone'] == '') {
        $error = "修改成功";
        echo return_data($error, true);
        exit;
    } else {
        //重新手机认证
        $sql = "update {$dbTablePre}certification  set telphone='' where uid='{$uid}'";
        $_MooClass['MooMySQL']->query($sql);
        $certif_arr['telphone'] = '';
        MooFastdbUpdate('certification', 'uid', $uid, $certif_arr);
        if (MOOPHP_ALLOW_FASTDB) {
            if (MOOPHP_ALLOW_FASTDB) {
                $certification_1 = MooFastdbGet('certification', 'uid', $userid);
            } else {
                $certification_1 = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}certification  WHERE uid = '{$userid}'", true);
            }
        }
        //Message("您的手机信息有变动请再次通过我们的验证",'index.php?n=myaccount&h=telphone');
        $error = "您的手机信息有变动请再次通过我们的验证";
        echo return_data($error, true);
        exit;
    }
    //note 快速常用搜索表更新
    //fastsearch_update($userid,'1');
    //note 快速高级搜索表更新
    //fastsearch_update($userid,'2');
}
Ejemplo n.º 10
0
function interest()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr;
    $members_base['fondactivity'] = ArrToStr(MoogetGPC('fondactions', 'array', 'P'));
    $members_base['fondsport'] = ArrToStr(MoogetGPC('fondsports', 'array', 'P'));
    $members_base['fondmusic'] = ArrToStr(MoogetGPC('fondmusics', 'array', 'P'));
    $members_base['fondprogram'] = ArrToStr(MoogetGPC('fondprograms', 'array', 'P'));
    //memberfield表
    foreach ($members_base as $key => $val) {
        //if($val){
        $membersbase[$key] = $val;
        //}
    }
    $where_arr = array('uid' => $userid);
    if (count($membersbase) >= 1) {
        updatetable('members_base', $membersbase, $where_arr);
        //note 快速常用搜索表更新
        //fastsearch_update($userid,'1');
        //note 快速高级搜索表更新
        //fastsearch_update($userid,'2');
        if (MOOPHP_ALLOW_FASTDB) {
            MooFastdbUpdate('members_base', 'uid', $userid, $membersbase);
        }
    }
    //note 分配客服
    //allotserver($userid);
    MooMessage("操作已完成", 'index.php?n=material');
}
Ejemplo n.º 11
0
Archivo: rose.php Proyecto: noikiy/zays
function send_rose()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    $query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $_MooClass['MooMySQL']->numRows($query);
    //note 自己不能给自己发送玫瑰,直接转到玫瑰列表页面
    if ($userid == $sendtoid) {
        MooMessage('自己不可以给自己送鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //客服不能模拟操作
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,送鲜花失败', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //note 要做性别过滤,异性的发送玫瑰,直接转到玫瑰列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('不可给同性发送鲜花', 'javascript:history.go(-1);');
        exit;
    }
    //note 如果自己没有玫瑰花了,就提示没有玫瑰花了
    if ($user['rosenumber'] <= 0) {
        MooMessage('您没有鲜花了,获取更多鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    if (MOOPHP_ALLOW_FASTDB) {
        $res = MooFastdbGet('members_search', 'uid', $sendtoid);
        $res_b = MooFastdbGet('members_base', 'uid', $sendtoid);
        $res = array_merge($res, $res_b);
    } else {
        $res = $_MooClass['MooMySQL']->getOne("select s.telphone,b.is_phone,s.username from {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid  where s.uid='{$sendtoid}'");
    }
    $send_user_info = $_MooClass['MooMySQL']->getAll("select b.*,c.*,a.* from `{$dbTablePre}members_search` a left join {$dbTablePre}members_base c on a.uid=c.uid  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '{$userid}'");
    $send_user_info = $send_user_info[0];
    //头像路径
    $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $provice_list[$send_user_info['province']];
    //省
    $city = $city_list[$send_user_info['city']];
    //市
    $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
    //身高
    ob_start();
    require_once MooTemplate('public/mail_space_rosetpl', 'module');
    //模板
    $body = ob_get_clean();
    MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    if (empty($uid)) {
        MooMessage('您还没有登录', 'index.php?n=login');
    }
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ORDER BY rid DESC LIMIT 1");
    if ($user['rosenumber'] > 0) {
        if ($leer['rid']) {
            $rid = $leer['rid'];
            //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
            $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
        } else {
            //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$uid}',receiveuid = '{$sendtoid}' ");
        }
        //note 发送一朵玫瑰,自己就要减少一朵玫瑰
        //enkytest
        //enkytestend
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$uid}'");
        if (MOOPHP_ALLOW_FASTDB) {
            $user_rosenum = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1");
            $value['rosenumber'] = $user_rosenum['rosenumber'];
            MooFastdbUpdate('members_base', 'uid', $userid, $value);
        }
    }
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_rose_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_rose_count = isset($leer['rid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_rose_date) {
        $today_rose_count = 1;
    }
    if ($res['is_phone']) {
        SendMsg($res['telphone'], "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花,请及时把握您的缘分!4006780405");
    }
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了鲜花';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    MooMessage('发送鲜花成功' . $note, "index.php?n=service&h=rose&t=isendrose", "05");
    require MooTemplate('public/service_rose_sendrose', 'module');
}
Ejemplo n.º 12
0
function ajax_sellsendactive()
{
    $type = MooGetGPC('type', 'string', 'G');
    $sendid = MooGetGPC('from', 'integer', 'G');
    $receiveuid = MooGetGPC('to', 'integer', 'G');
    if ($type == '' || $sendid == '' || $receiveuid == '' || $sendid == 0 || $receiveuid == 0) {
        echo 'errors';
    }
    $nowtime = time();
    $user = MooMembersData($receiveuid);
    $senduser = MooMembersData($sendid);
    /*if(MOOPHP_ALLOW_FASTDB){
          $user = MooFastdbGet('members','uid',$receiveuid);
          $senduser = MooFastdbGet('members','uid',$sendid);
      }else{
          $sql = "SELECT username,telphone FROM {$GLOBALS['dbTablePre']}members WHERE `uid`='".$receiveuid."'";
          $user=$GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
          $sql = "SELECT gender FROM {$GLOBALS['dbTablePre']}members WHERE `uid`='".$sendid."'";
          $senduser=$GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
      }*/
    $gender = $senduser['gender'] == 1 ? "女" : "男";
    switch ($type) {
        case 'commission':
            //$sql = "SELECT mid,sendtime FROM {$GLOBALS['dbTablePre']}service_contact WHERE you_contact_other='$sendid' AND other_contact_you = '$userid' and receive_del=0 and send_del=0 and is_server=0";
            $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}service_contact WHERE you_contact_other = '{$receiveuid}' AND other_contact_you = '{$sendid}' ";
            $com = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            if (empty($com)) {
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}service_contact SET `you_contact_other`='" . $receiveuid . "',`other_contact_you`='" . $sendid . "',`stat`=1,`syscheck`=1,`sendtime`='" . $nowtime . "',`is_server`=1";
                $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                echo 'ok';
                exit;
            } else {
                echo 'having';
                exit;
            }
            //更改最后活动时间,上线
            $sql = "UPDATE {$GLOBALS['dbTablePre']}members_login SET lastvisit='{$GLOBALS['timestamp']}' WHERE uid='{$sendid}'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            if (MOOPHP_ALLOW_FASTDB) {
                $value['lastvisit'] = $GLOBALS['timestamp'];
                MooFastdbUpdate('members_login', 'uid', $sendid, $value);
            }
            //发e-mail提醒(委托)-------开始////////////////////////////////////////////
            include_once "./include/crontab_config.php";
            $send_user_info = array_merge(MooGetData('members_choice', 'uid', $sendid), MooMembersData($sendid));
            /*$send_user_info = $GLOBALS['_MooClass']['MooMySQL']->getAll("select * from `{$GLOBALS['dbTablePre']}members` a  left join  {$GLOBALS['dbTablePre']}choice b  on a.uid=b.uid  where a.uid = '$sendid'");
              $send_user_info = $send_user_info[0];*/
            //头像路径
            $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
            if (file_exists($path)) {
                $img_path = $path;
            } else {
                if ($send_user_info['gender'] == 1) {
                    $img_path = "/public/images/service_nopic_woman.gif";
                } else {
                    $img_path = "/public/images/service_nopic_man.gif";
                }
            }
            $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
            //发送者用户名
            $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
            //发送者性别
            $province = $provice_list[$send_user_info['province']];
            //省
            $city = $city_list[$send_user_info['city']];
            //市
            $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
            //身高
            ob_start();
            require_once adminTemplate('mail/mail_space_commissiontpl');
            $body = ob_get_clean();
            MooSendMail($user['username'], "真爱一生网系统温馨提示", $body, "", false, $receiveuid);
            //--------->发送邮件提醒  结束///////////////////////////////////////////
            //fangin暂时屏蔽
            Push_message_intab($receiveuid, $user['telphone'], "委托", "尊敬的会员您好!" . $sendid . "," . $gender . ",委托我们联系您,请及时登录www.zhenaiyisheng.cc查收,把握您的缘分。【真爱一生网】", $sendid);
            //写日志
            serverlog(3, $GLOBALS['dbTablePre'] . 'service_contact', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$sendid}的身份向{$receiveuid}会员发送委托", $GLOBALS['adminid'], $receiveuid);
            echo 'ok';
            exit;
            break;
        case 'leer':
            $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}service_leer WHERE senduid = '{$sendid}' AND receiveuid= '{$receiveuid}' ";
            $leer = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            if (!empty($leer)) {
                $lid = $leer['lid'];
                //note 如果已经发送过秋波,就增加发送秋波的次数
                $sql = "UPDATE {$GLOBALS['dbTablePre']}service_leer SET fakenum = fakenum + 1,num = num + 1,receivenum = receivenum + 1,sendtime = '{$nowtime}',receivetime = '{$nowtime}',receive_del = '0' WHERE lid = '{$lid}'";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //note 如果已经收到这个人的秋波,已经拒绝,现在改变注意,又发送秋波给这个人,拒绝状态2更改为0
                if ($leer['receive_del'] == 1 || $leer['stat'] == 2) {
                    $sql = "UPDATE {$GLOBALS['dbTablePre']}service_leer SET stat = '0',receive_del = 0 WHERE senduid = '{$sendid}' AND receiveuid = '{$receiveuid}' AND stat = '2'";
                    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                }
            } else {
                //note 发送新的秋波,写入数据库 发送者,接受者,发送时间
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}service_leer SET sendtime = '{$nowtime}',receivetime = '{$nowtime}',fakenum = '1', receivenum = '1', num = '1', senduid  = '{$sendid}',receiveuid = '{$receiveuid}',is_server=1";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            }
            //更改最后活动时间,上线
            $sql = "UPDATE {$GLOBALS['dbTablePre']}members_login SET lastvisit='{$GLOBALS['timestamp']}' WHERE uid='{$sendid}'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            if (MOOPHP_ALLOW_FASTDB) {
                $value['lastvisit'] = $GLOBALS['timestamp'];
                MooFastdbUpdate('members_login', 'uid', $sendid, $value);
            }
            //发e-mail提醒(委托)-------开始////////////////////////////////////////////
            include_once "./include/crontab_config.php";
            $send_user_info = array_merge(MooGetData('members_choice', 'uid', $sendid), MooMembersData($sendid));
            /*$send_user_info = $GLOBALS['_MooClass']['MooMySQL']->getAll("select * from `{$GLOBALS['dbTablePre']}members` a  left join  {$GLOBALS['dbTablePre']}choice b  on a.uid=b.uid  where a.uid = '$sendid'");
              $send_user_info = $send_user_info[0];*/
            //头像路径
            $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
            if (file_exists($path)) {
                $img_path = $path;
            } else {
                if ($send_user_info['gender'] == 1) {
                    $img_path = "/public/images/service_nopic_woman.gif";
                } else {
                    $img_path = "/public/images/service_nopic_man.gif";
                }
            }
            $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
            //发送者用户名
            $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
            //发送者性别
            $province = $provice_list[$send_user_info['province']];
            //省
            $city = $city_list[$send_user_info['city']];
            //市
            $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
            //身高
            ob_start();
            require_once adminTemplate('mail/mail_space_leertpl');
            $body = ob_get_clean();
            MooSendMail($user['username'], "真爱一生网系统温馨提示", $body, "", false, $receiveuid);
            //--------->发送邮件提醒  结束///////////////////////////////////////////
            //fangin暂时屏蔽
            Push_message_intab($receiveuid, $user['telphone'], "秋波", "尊敬的会员您好!ID" . $sendid . "," . $gender . ",给您发送秋波,请及时登录www.zhenaiyisheng.cc查收,把握您的缘分。【真爱一生网】", $sendid);
            //写日志
            serverlog(3, $GLOBALS['dbTablePre'] . 'service_leer', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$sendid}的身份向{$receiveuid}会员发送秋波", $GLOBALS['adminid'], $receiveuid);
            echo 'ok';
            exit;
            break;
        case 'rose':
            $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}service_rose WHERE senduid = '{$sendid}' AND receiveuid= '{$receiveuid}' ";
            $rose = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            if (!empty($rose)) {
                $rid = $rose['rid'];
                //note 如果已经发送过鲜花,就增加发送鲜花的次数
                $sql = "UPDATE {$GLOBALS['dbTablePre']}service_rose SET fakenum = fakenum + 1,num = num + 1,receivenum = receivenum + 1,sendtime = '{$nowtime}',receivetime = '{$nowtime}',receive_del = '0' WHERE rid = '{$rid}'";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //note 如果用户已经将该鲜花记录删除,则要改变删除状态,不然鲜花不会在前台显示
                if ($rose['receive_del'] == 1) {
                    $sql = "UPDATE {$GLOBALS['dbTablePre']}service_leer SET receive_del = 0 WHERE senduid = '{$sendid}' AND receiveuid = '{$receiveuid}'";
                    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                }
            } else {
                //note 发送新的鲜花,写入数据库 发送者,接受者,发送时间
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}service_rose SET sendtime = '{$nowtime}',receivetime = '{$nowtime}',fakenum = '1', receivenum = '1', num = '1', senduid  = '{$sendid}',receiveuid = '{$receiveuid}',is_server=1";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            }
            //更改最后活动时间,上线
            $sql = "UPDATE {$GLOBALS['dbTablePre']}members_login SET lastvisit='{$GLOBALS['timestamp']}' WHERE uid='{$sendid}'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            if (MOOPHP_ALLOW_FASTDB) {
                $value['lastvisit'] = $GLOBALS['timestamp'];
                MooFastdbUpdate('members_login', 'uid', $sendid, $value);
            }
            //发e-mail提醒--->开始///////////////////////////////////
            include_once "./include/crontab_config.php";
            $send_user_info = array_merge(MooGetData('members_choice', 'uid', $sendid), MooMembersData($sendid));
            /*$send_user_info = $GLOBALS['_MooClass']['MooMySQL']->getAll("select * from `{$GLOBALS['dbTablePre']}members` a  left join  {$GLOBALS['dbTablePre']}choice b  on a.uid=b.uid  where a.uid = '$sendid'");
              $send_user_info = $send_user_info[0];*/
            //头像路径
            $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
            if (file_exists($path)) {
                $img_path = $path;
            } else {
                if ($send_user_info['gender'] == 1) {
                    $img_path = "/public/images/service_nopic_woman.gif";
                } else {
                    $img_path = "/public/images/service_nopic_man.gif";
                }
            }
            $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
            //发送者用户名
            $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
            //发送者性别
            $province = $provice_list[$send_user_info['province']];
            //省
            $city = $city_list[$send_user_info['city']];
            //市
            $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
            //身高
            ob_start();
            require_once adminTemplate('mail/mail_space_rosetpl');
            $body = ob_get_clean();
            MooSendMail($user['username'], "真爱一生网系统温馨提示", $body, "", false, $receiveuid);
            //----->发送email-->结束/////////////////////////
            //fangin暂时屏蔽
            Push_message_intab($receiveuid, $user['telphone'], "鲜花", "尊敬的会员您好!ID" . $sendid . "," . $gender . ",给您发送鲜花,请及时登录www.zhenaiyisheng.cc查收,把握您的缘分。【真爱一生网】", $sendid);
            //写日志
            serverlog(3, $GLOBALS['dbTablePre'] . 'service_rose', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$sendid}的身份向{$receiveuid}会员发送鲜花", $GLOBALS['adminid'], $receiveuid);
            echo 'ok';
            exit;
            break;
        default:
            echo "errors";
            break;
    }
    exit;
}
Ejemplo n.º 13
0
Archivo: ajax.php Proyecto: noikiy/zays
function ajax_check_school()
{
    global $_MooClass, $dbTablePre;
    $uid = MooGetGPC('uid', 'integer', 'P');
    $pass = MooGetGPC('pass', 'integer', 'P');
    if (empty($uid)) {
        exit('0');
    }
    $school = trim(MooGetGPC('school', 'string', 'P'));
    if (!empty($school)) {
        $sql = "UPDATE {$dbTablePre}members_base SET finishschool='{$school}' WHERE uid='{$uid}'";
        $value['finishschool'] = $school;
    } else {
        $sql = "UPDATE {$dbTablePre}members_base SET isschool='{$pass}' WHERE uid='{$uid}'";
        $value['isschool'] = $pass;
    }
    //echo $sql;exit;
    $query = $_MooClass['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        MooFastdbUpdate('members_base', 'uid', $uid, $value);
    }
    if ($query) {
        serverlog(4, $GLOBALS['dbTablePre'] . 'members_base', "{$GLOBALS['adminid']}号客服审核会员{$uid}的毕业院校", $GLOBALS['adminid'], $uid);
        echo '1';
    } else {
        echo '0';
    }
}
Ejemplo n.º 14
0
function other_add_rose()
{
    if (empty($_POST)) {
        require_once adminTemplate('other_add_rose');
    } else {
        $uid = MooGetGPC('uid', 'integer', 'P');
        $rosenumber = MooGetGPC('rosenumber', 'integer', 'P');
        //enky add 防止人为输入过大,输入过大则设置为10万
        if ($rosenumber > 100000) {
            $rosenumber = 100000;
        }
        //add end
        if (empty($uid) || empty($rosenumber)) {
            exit(json_encode(array('flag' => 0, 'msg' => '请确认鲜花熟练或者用户')));
        } else {
            if ($GLOBALS['_MooClass']['MooMySQL']->query('UPDATE `' . $GLOBALS['dbTablePre'] . 'members_base` SET `rosenumber`=`rosenumber`+(' . $rosenumber . ') WHERE `uid`=' . $uid)) {
                MooFastdbUpdate('members_base', 'uid', $uid);
                exit(json_encode(array('flag' => 1, 'msg' => '花朵赠送成功')));
            } else {
                exit(json_encode(array('flag' => 0, 'msg' => '花朵赠送失败')));
            }
        }
    }
}
Ejemplo n.º 15
0
function changePWD($uid)
{
    global $_MooClass, $dbTablePre, $user_arr;
    //note 将作为新密码
    $newpwd = rand(100000, 999999);
    //修改密码至表中
    if ($_MooClass['MooMySQL']->query("update web_members_search set password='******' where uid='{$uid}'")) {
        if (MOOPHP_ALLOW_FASTDB) {
            $new_user_arr = array();
            $new_user_arr['password'] = md5($newpwd);
            MooFastdbUpdate('members_search', 'uid', $uid, $new_user_arr);
        }
        return $newpwd;
    } else {
        return 0;
    }
}
Ejemplo n.º 16
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;
    }
}
Ejemplo n.º 17
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;
}
Ejemplo n.º 18
0
Archivo: ajax.php Proyecto: noikiy/zays
function applyBind()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr, $timestamp, $memcached;
    $sendtouid = MooGetGPC('uid', 'integer', 'P');
    $userid = $user_arr['uid'];
    $serverid = Moo_is_kefu();
    if ($serverid && $user_arr['usertype'] != 3) {
        exit('simulate');
    }
    if ($sendtouid == $userid) {
        exit('sameone');
    }
    if (MooGetScreen($userid, $sendtouid)) {
        exit('shield');
    }
    $sendToUser = MooMembersData($sendtouid);
    if (isset($sendToUser['gender']) && $sendToUser['gender'] == $user_arr['gender']) {
        exit('gender');
    }
    if (isset($sendToUser['showinformation']) && $sendToUser['showinformation'] != 1) {
        exit('closeInfo');
    }
    if ($user_arr['isbind'] > 0) {
        exit('you');
    }
    if ($sendToUser['isbind'] > 0) {
        exit('other');
    }
    $isBind = $memcached->get('sendBind' . $userid . '-' . $sendtouid);
    if (!empty($isBind)) {
        exit('alreadySended');
    }
    //是否有手机号码
    if (MOOPHP_ALLOW_FASTDB) {
        $_R_ = MooFastdbGet('certification', 'uid', $userid);
    } else {
        $sql = "SELECT telphone FROM {$dbTablePre}certification WHERE uid='{$userid}'";
        $_R_ = $_MooClass['MooMySQL']->getOne($sql, true);
    }
    if (empty($_R_['telphone']) && empty($serverid)) {
        exit('telNo');
    }
    $sql = "select id from web_members_bind where a_uid='{$userid}' and b_uid='{$sendtouid}' and bind=1 limit 1";
    $br = $_MooClass['MooMySQL']->getOne($sql);
    if (!empty($br['id'])) {
        exit('alreadyBinded');
    }
    $content = MooGetGPC('content', 'string', 'P');
    $time = MooGetGPC('time', 'integer', 'P');
    $sql = "INSERT INTO {$dbTablePre}members_bind SET a_uid='{$userid}',b_uid='{$sendtouid}',apply_con='{$content}',dateline='{$timestamp}',apply_ltime='{$time}'";
    $query = $_MooClass['MooMySQL']->query($sql);
    $bind_id = $_MooClass['MooMySQL']->insertId();
    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET bind_id=" . $bind_id . " WHERE uid=" . $userid);
    //预先更新申请人的bind_id,
    if (MOOPHP_ALLOW_FASTDB) {
        $value = array();
        $value['bind_id'] = $bind_id;
        MooFastdbUpdate("members_base", 'uid', $userid, $value);
    }
    $memcached->set('sendBind' . $userid . '-' . $sendtouid, 1, 0, 86400);
    $gender = $user_arr['gender'] == 1 ? "美女" : "帅哥";
    //*************提醒所属客服*************
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $userid . ' 委托红娘绑定 ' . $sendtouid;
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='绑定',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    $pattern = '/^((1[345]\\d{9})|(18[0-9]\\d{8}))$/';
    if (isset($sendToUser['usertype']) && $sendToUser['usertype'] == 1 && preg_match($pattern, $sendToUser['telphone'])) {
        Push_message_intab($sendtouid, $sendToUser['telphone'], "绑定", "尊敬的会员您好!ID:{$userid}的{$gender}已给委托红娘绑定您,登录www.zhenaiyisheng.cc收获缘分!幸福热线:4008787920", $userid);
    }
}
Ejemplo n.º 19
0
Archivo: leer.php Proyecto: noikiy/zays
function sendnewfl()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid, $memcached, $_MooCookie, $GLOBALS;
    //是否合法登录
    $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;
    }
    $sendtoid = MooGetGPC('sendtoid', 'integer', 'P');
    //
    $user_arr = MooMembersData($userid);
    $uid = $userid;
    $return = array();
    $is_first_send = true;
    $query = $_MooClass['MooMySQL']->getOne("SELECT count(1) as c FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $query['c'];
    //note 自己不能给自己发送秋波,直接转到秋波列表页面
    if ($sendtoid == $userid) {
        $error = "自己不可以给自己发过送鲜花";
        echo return_data($error, false);
        exit;
    }
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid && $user_arr['usertype'] != 3) {
        //只能模拟全权会员
        $error = "对不起您不能模拟操作";
        echo return_data($error, false);
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        $error = "因特殊原因,送鲜花失败";
        echo return_data($error, false);
        exit;
    }
    //note 要做性别过滤,异性的发送秋波,直接转到秋波列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        $error = "同性之间不可互发鲜花";
        echo return_data($error, false);
        exit;
        exit;
    }
    if ($user['rosenumber'] <= 0) {
        $error = '您没有鲜花了,获取更多鲜花';
        echo return_data($error, false);
        exit;
    }
    //
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    $res = MooMembersData($sendtoid);
    $send_user_info = array_merge(MooGetData('members_choice', 'uid', $userid), MooMembersData($userid));
    //头像路径
    $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $send_user_info['province'] ? $provice_list[$send_user_info['province']] : '';
    //省
    $city = $send_user_info['city'] ? $city_list[$send_user_info['city']] : '';
    //市
    $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
    //身高
    ob_start();
    //require_once MooTemplate('public/mail_space_rosetpl', 'module'); //模板
    $body = ob_get_clean();
    if ($res['usertype'] != 3) {
        MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    }
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    //if(empty($uid)){
    //	MooMessage('您还没有登录','index.php?n=login');
    //}
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ORDER BY rid DESC LIMIT 1");
    //库中验证鲜花数
    //$rosenum_check =  $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1",true);
    //if($rosenum_check['rosenumber'] > 0) {
    if ($leer['rid']) {
        $is_first_send = false;
        $rid = $leer['rid'];
        //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
    } else {
        //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$uid}',receiveuid = '{$sendtoid}' ");
    }
    //note 发送一朵玫瑰,自己就要减少一朵玫瑰
    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$uid}'");
    if (MOOPHP_ALLOW_FASTDB) {
        $user_rosenum = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1", true);
        $value['rosenumber'] = $user_rosenum['rosenumber'];
        MooFastdbUpdate('members_base', 'uid', $userid, $value);
    }
    //}
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_rose_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_rose_count = isset($leer['rid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_rose_date) {
        $today_rose_count = 1;
    }
    $sendinfo = MooGetGPC('sendinfo', 'string', 'G');
    if (!empty($sendinfo)) {
        $sendinfo = ",对您说:" . $sendinfo;
    }
    if ($res['usertype'] != 3) {
        if ($serverid) {
            //客服模拟会员登录可以选择发送短信或彩信
            $SMStype = MooGetGPC('selectSMSorCMS', 'string', 'G');
            if ($SMStype == 'SMS' && $res['is_phone']) {
                Push_message_intab($sendtoid, $res['telphone'], "鲜花", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花" . $sendinfo . "     请及时把握您的缘分!4006780405", $userid);
            } elseif ($SMStype == 'CMS' && $res['is_phone']) {
                //====发送彩信   begin  ====
                //发送人有照片
                $sql = "SELECT uid,telphone FROM {$dbTablePre}members_search where uid='{$userid}' and images_ischeck=1 and pic_num>0";
                $sendfrom_user_info = $_MooClass['MooMySQL']->getOne($sql, true);
                //发送条件:本站注册会员,有电话号码的,开启短信通知的会员发送
                /* $sql="SELECT telphone FROM {$dbTablePre}members where uid='{$sendtoid}'";// and is_phone=1 and telphone!='' and usertype=1";
                   $sendto_user_info=$_MooClass['MooMySQL']->getOne($sql);*/
                if ($sendfrom_user_info['uid']) {
                    $sendedMMSCount = $memcached->get('hznsimulate' . $serverid);
                    if (empty($sendedMMSCount)) {
                        $sendedMMSCount = 0;
                    }
                    //if($sendedMMSCount > 10){
                    //	MooMessage('您今天累计已经发过10条彩信','index.php?n=service&h=rose');
                    //}
                    send_mms_commission($res['telphone'], 'rose', $userid);
                    $memcached->set('hznsimulate' . $serverid, ++$sendedMMSCount, 0, 28800);
                }
                //====发送彩信 end =====
            }
        } else {
            //真实会员登录
            if ($res['is_phone'] && $is_first_send && $res['s_cid'] != 40) {
                //第一次发才短信提示
                // SendMsg($res['telphone'],"真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花".$sendinfo."     请及时把握您的缘分!4006780405");
                Push_message_intab($sendtoid, $res['telphone'], "鲜花", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花" . $sendinfo . "     请及时把握您的缘分!4006780405", $userid);
            }
        }
    }
    /*
    	$week_time = 24*3600*7;//一周时间秒数
    	$interval_time = $timestamp - $user_arr['last_login_time'];//当前时间-最后登录时间
    	$date1 = date("Y-m-d",strtotime("last Monday"));
    	$date2 = date("Y-m-d",strtotime("Sunday"));
    	
    	//echo "interval_time:".$interval_time . ' and '.'week:'.$week_time;exit;
    
    	if($interval_time > $week_time){//不活跃用户每周发一条短信
    		 $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    		 $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid'  and sendtime>='$date1' and sendtime<='$date2'");
    		 if($cos[c] <= 1){
    			//fanglin暂时屏蔽
    			Push_message_intab($sendtoid,$res['telphone'],"鲜花","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花,请及时把握您的缘分!4006780405",$userid);
    		 }
    	}else{
    		  //echo $today_rose_count;exit;
    		  if($send_rose_date==date("Y-m-d") && $today_rose_count == 1){	//每天同一个用户发送多次秋波,短信只记一次
    			   $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid' and sendtime='".date("Y-m-d")."'");
    			   
               //print_r($cos);exit;
    			   if($cos[c]<5){
    				  $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    				  //fanglin暂时屏蔽
    				  Push_message_intab($sendtoid,$res['telphone'],"鲜花","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花,请及时把握您的缘分!4006780405",$userid);
    			   }
    		}
    	}
    */
    /*
    	//发送彩信
    	$sql="SELECT uid FROM {$dbTablePre}members where uid='{$uid}' and mainimg!='' and images_ischeck=1 and pic_num>0";
    	//$sql="SELECT uid FROM {$dbTablePre}members where uid='{$uid}'";
    	$sendout_user_info=$_MooClass['MooMySQL']->getOne($sql);
    	//发送人有照片
    	$sql="SELECT telphone FROM {$dbTablePre}members where uid='{$sendtoid}' and is_phone=1 and telphone!='' and usertype=1";
    	$sendto_user_info=$_MooClass['MooMySQL']->getOne($sql);
    	//发送条件:本站注册会员,有电话号码的,开启短信通知的会员发送
        
    	//echo $sendto_user_info['telphone'].' and '.$sendout_user_info['uid'];exit;
    	if($sendto_user_info['telphone']&&$sendout_user_info['uid']){
    		//echo 'ffff';exit;
    		if(send_mms_commission($sendto_user_info['telphone'],'rose',$sendout_user_info['uid'])){
    			$note="。";
    		}else{
    			$note="!";
    		}
    	}
    */
    /*普通会员对全权会员反馈白名单*/
    if ($res['usertype'] == '3' && $user_arr['usertype'] != '3' && !$serverid) {
        white_list($res['uid'], $user_arr['uid']);
    }
    /*客服模拟全权记录*/
    if ($user_arr['usertype'] == '3' && $serverid && $res['usertype'] != '3') {
        $action = '鲜花';
        fulllog($user_arr['uid'], $serverid, $action, $res);
    }
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了鲜花';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    $return = "发送鲜花成功";
    echo return_data($return);
    exit;
    //MooMessage('发送鲜花成功',"index.php?n=service&h=rose&t=isendrose","05");
    //require MooTemplate('public/service_rose_sendrose', 'module');
}
Ejemplo n.º 20
0
         $total_money = $paymoney2['add_money'];
     } else {
         $total_money = $paymoney['add_money'];
     }
     $apply_note = '高级会员升级钻石会员';
     break;
 case '100':
     $time = time();
     $_MooClass['MooMySQL']->query("update {$dbTablePre}certification set sms=1 where uid={$uid}");
     if (!$_MooClass['MooMySQL']->affectedRows()) {
         $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}certification (uid,sms) VALUES('{$uid}','1')");
     }
     if (MOOPHP_ALLOW_FASTDB) {
         $val = $_MooClass['MooMySQL']->getOne("select * from {$dbTablePre}certification where uid={$uid}  limit 1");
         $val['sms'] = 1;
         MooFastdbUpdate('certification', 'uid', $uid, $val);
     }
     //$username=iconv('utf-8','gbk',MooAuthCode($_MooCookie['sftrz_username'], 'DECODE'));
     $username = MooAuthCode($_MooCookie['sftrz_username'], 'DECODE');
     $usercode = MooAuthCode($_MooCookie['sftrz_usercode'], 'DECODE');
     $mobile = MooAuthCode($_MooCookie['sftrz_mobile'], 'DECODE');
     $sql = "select id from {$dbTablePre}smsauths where uid='{$uid}' ";
     $row = $_MooClass['MooMySQL']->getOne($sql);
     if (!empty($row['id'])) {
         $sql = "update {$dbTablePre}smsauths set time='{$time}',realname='{$username}',idcode='{$usercode}',mobile='{$mobile}' where uid='{$uid}'";
     } else {
         $sql = "insert into {$dbTablePre}smsauths set uid='{$uid}',time='{$time}',realname='{$username}',idcode='{$usercode}',mobile='{$mobile}'";
     }
     $_MooClass['MooMySQL']->query($sql);
     //重新设置诚信值
     reset_integrity($user_arr);
Ejemplo n.º 21
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;
}
Ejemplo n.º 22
0
function allmember_del_same_telphone()
{
    $uid = MooGetGPC('uid', 'integer', 'G');
    $telphone = MooGetGPC('telphone', 'string', 'G');
    if (empty($telphone)) {
        return;
    }
    //$sql = "DELETE FROM {$GLOBALS['dbTablePre']}members WHERE uid='{$uid}'";
    $sql = "SELECT sid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid='{$uid}'";
    $sid = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    $now = time();
    $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search  SET sid='0',is_lock=0 WHERE uid='{$uid}' ";
    searchApi('members_man members_women')->updateAttr(array('sid', 'is_lock'), array($uid => array(0, 0)));
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        $value = array();
        $value['sid'] = 0;
        $value['is_lock'] = 0;
        $value['updatetime'] = $now;
        MooFastdbUpdate('members_search', 'uid', $uid, $value);
    }
    //对应的维护会员总数减1
    $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count-1 WHERE uid='{$sid['sid']}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    serverlog(2, $GLOBALS['dbTablePre'] . 'members', "{$GLOBALS['username']}客服将有同号手机会员{$uid}删除", $GLOBALS['adminid'], $uid);
    salert('删除成功', 'index.php?action=allmember&h=same_telphone&telphone=' . $telphone);
}
Ejemplo n.º 23
0
function binding()
{
    global $_MooClass, $dbTablePre, $userid, $timestamp, $user_arr;
    $b_uid = MooGetGPC('buid', 'integer', 'G');
    //echo $b_uid;
    if ($user_arr['bind_id'] > 0) {
        //如果申请过了就不能再次申请
        echo 'havebind';
        exit;
    }
    //note 检查是否同性
    $sql = "SELECT s.gender,b.bind_id,b.isbind FROM {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid  WHERE s.uid = " . $b_uid;
    $b_gender = $_MooClass['MooMySQL']->getOne($sql);
    if ($b_gender['gender'] == $user_arr['gender']) {
        echo 'onesex';
        exit;
    }
    if ($b_uid > 0 && $user_arr['isbind'] == 0) {
        $sql = "INSERT INTO {$dbTablePre}members_bind SET a_uid={$user_arr['uid']},b_uid={$b_uid},dateline=" . time();
        $query = $_MooClass['MooMySQL']->query($sql);
        $bind_id = $_MooClass['MooMySQL']->insertId();
        @$_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET bind_id=" . $bind_id . " WHERE uid=" . $user_arr['uid']);
        //预先更新申请人的bind_id,
        if (MOOPHP_ALLOW_FASTDB) {
            $value = array();
            $value['bind_id'] = $bind_id;
            MooFastdbUpdate("members_base", 'uid', $user_arr['uid'], $value);
        }
        if ($query) {
            echo 'binding';
            //申请成功
        }
    } else {
        echo 'binded';
        //对方已绑定过
    }
    //require MooTemplate('public/service_members_bind', 'module');
}
Ejemplo n.º 24
0
Archivo: ajax.php Proyecto: noikiy/zays
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;*/
}
Ejemplo n.º 25
0
function certification($key, $val, $uid)
{
    global $_MooClass, $dbTablePre;
    $sql = "select count(*) as a from {$dbTablePre}certification where uid='{$uid}' ";
    $r = $_MooClass['MooMySQL']->getone($sql, true);
    if ($r[a] == 0) {
        $sql = " insert into {$dbTablePre}certification (uid,{$key}) values('{$uid}','{$val}')";
    } else {
        $sql = "update {$dbTablePre}certification set {$key}='{$val}' where uid='{$uid}' ";
    }
    $_MooClass['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        $cert_arr = array('uid' => $uid, $key => $val);
        MooFastdbUpdate('certification', 'uid', $uid, $cert_arr);
    }
    // 更新诚信值
    reset_integrity($uid);
}
Ejemplo n.º 26
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');
}
Ejemplo n.º 27
0
function ajax_this_login()
{
    $time = time();
    $uid = MooGetGPC('luid', 'integer', 'G');
    $serverid = $GLOBALS['adminid'];
    $sql = "select * from {$GLOBALS['dbTablePre']}members_search where uid='{$uid}'";
    $userinfo = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    if (!$userinfo) {
        echo '用户不存在';
        exit;
    }
    /*
    	$useronline = $GLOBALS['_MooClass']['MooMySQL']->getOne("select * from {$GLOBALS['dbTablePre']}membersession where uid='$uid'");
    	if($useronline){
    		//echo '此用户在线';exit();
    	}*/
    $userinfo_uid = $userinfo['uid'];
    $userinfo_pw = $userinfo['password'];
    //模拟用户登录
    MooSetCookie('auth', '', -86400 * 365);
    MooSetCookie('kefu', '', -86400 * 365);
    MooSetCookie('auth', MooAuthCode("{$userinfo_uid}\t{$userinfo_pw}", 'ENCODE'), 86400);
    MooSetCookie('kefu', MooAuthCode("hongniangwang\t{$serverid}", 'ENCODE'), 86400);
    if (!session_id()) {
        session_start();
    }
    $_SESSION['s_userid'] = $userinfo['uid'];
    //更新模拟时间
    $GLOBALS['_MooClass']['MooMySQL']->query("update `{$GLOBALS['dbTablePre']}member_admininfo` set real_lastvisit='{$time}' where uid='{$uid}'");
    if ($GLOBALS['groupid'] != 60) {
        $GLOBALS['_MooClass']['MooMySQL']->query("update `{$GLOBALS['dbTablePre']}members_login` set lastvisit='{$time}' where uid='{$uid}'");
        if (MOOPHP_ALLOW_FASTDB) {
            $value['lastvisit'] = $time;
            MooFastdbUpdate('members_login', 'uid', $uid, $value);
        }
    }
    //$kefu = $_MooCookie['kefu'];exit($kefu);
    serverlog(4, $GLOBALS['dbTablePre'] . 'members_search', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$userinfo['uid']}的身份查看{$uid}", $GLOBALS['adminid'], $userinfo['uid']);
    echo 'ok';
}
Ejemplo n.º 28
0
/**
 * 登录表单处理
 * 描述:
 */
function login_submit()
{
    global $_MooClass, $dbTablePre, $_MooCookie;
    //noet 对提交的数据过滤
    if ($_POST) {
        $username = trim($_POST['username']);
        $md5_password = md5($_POST['password']);
        $cookietime = intval(isset($_POST['cookietime']) ? $_POST['cookietime'] : '');
        $remember_username = MooGetGPC('remember', 'integer', 'P');
    }
    /*****设置回转的页面*****/
    $returnurl = MooGetGPC('returnurl', 'string', "P");
    //echo $returnurl;
    //exit;
    //note 要填写用户和密码
    if (empty($_POST['username']) && empty($_POST['password'])) {
        //note 转至邮箱验证页
        if ($returnurl) {
            $returnurl = $returnurl;
            MooMessage("请填写用户名和密码", "{$returnurl}", '03');
        } else {
            MooMessage("请填写用户名和密码", "index.php?n=login", '03');
        }
        exit;
    }
    //note 用户名不能为空
    if (empty($_POST['username'])) {
        //note 转至邮箱验证页
        if ($returnurl) {
            $returnurl = $returnurl;
            MooMessage("用户名不能为空", "{$returnurl}", '03');
        } else {
            MooMessage("用户名不能为空", "index.php?n=login", '03');
        }
        exit;
    }
    //note 密码不能为空
    if (empty($_POST['password'])) {
        //note 转至邮箱验证页
        if ($returnurl) {
            $returnurl = $returnurl;
            MooMessage("密码不能为空", "{$returnurl}", '03');
        } else {
            MooMessage("密码不能为空", "index.php?n=login", '03');
        }
        exit;
    }
    $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}'")) {
                $userid = $user_one['uid'];
            }
        }
        /*if(strlen($username)==11){
        		   $sql_where = " s.telphone='{$username}'";
                   $user = $_MooClass['MooMySQL']->getOne("SELECT s.uid,s.username,s.password,s.birthyear,s.gender,s.province,s.city,b.automatic,s.is_lock,b.is_awoke,s.sid,l.last_login_time,l.lastip FROM `{$dbTablePre}members_search` as s left join `{$dbTablePre}members_base` as b on s.uid=b.uid left join `{$dbTablePre}members_login` as l on s.uid=l.uid   WHERE $sql_where");
        		}else{
        			$sql_where = " s.uid = '{$username}'";
        			$user = $_MooClass['MooMySQL']->getOne("SELECT s.uid,s.username,s.password,s.birthyear,s.gender,s.province,s.city,b.automatic,s.is_lock,b.is_awoke,s.sid,l.last_login_time,l.lastip FROM `{$dbTablePre}members_search` as s left join `{$dbTablePre}members_base` as b on s.uid=b.uid left join `{$dbTablePre}members_login` as l on s.uid=l.uid   WHERE $sql_where");
        			if(empty($user)){
        			   $sql_where = "b.qq='{$username}'";
        			   //$user = $_MooClass['MooMySQL']->getOne("SELECT a.uid,username,password,birthyear,gender,province,city,automatic,is_lock,is_awoke,sid,last_login_time,lastip FROM `{$dbTablePre}members` a ,`{$dbTablePre}memberfield` b WHERE a.uid=b.uid and $sql_where");
        				$user = $_MooClass['MooMySQL']->getOne("SELECT s.uid,s.username,s.password,s.birthyear,s.gender,s.province,s.city,b.automatic,s.is_lock,b.is_awoke,s.sid,l.last_login_time,l.lastip FROM `{$dbTablePre}members_search` as s left join `{$dbTablePre}members_base` as b on s.uid=b.uid left join `{$dbTablePre}members_login` as l on s.uid=l.uid   WHERE $sql_where");
        			}
        		}*/
    } else {
        $filter = array();
        $filter[] = array('username', $username);
        if ($sp->getResultOfReset($filter, $limit)) {
            $ids = $sp->getIds();
            if (isset($ids[0])) {
                $userid = $ids[0];
            }
        }
        /*$sql_where = "s.username = '******'";
        		//$user = $_MooClass['MooMySQL']->getOne("SELECT uid,username,password,birthyear,gender,province,city,automatic,is_lock,is_awoke,sid,last_login_time,lastip FROM `{$dbTablePre}members` WHERE $sql_where");
        		$user = $_MooClass['MooMySQL']->getOne("SELECT s.uid,s.username,s.password,s.birthyear,s.gender,s.province,s.city,b.automatic,s.is_lock,b.is_awoke,s.sid,l.last_login_time,l.lastip FROM `{$dbTablePre}members_search` as s left join `{$dbTablePre}members_base` as b on s.uid=b.uid left join `{$dbTablePre}members_login` as l on s.uid=l.uid   WHERE $sql_where");*/
    }
    //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}");
        if ($user_one) {
            $userid = $user_one['uid'];
        } else {
            //note 转至邮箱验证页
            if ($returnurl) {
                MooMessage("用户名不存在", "{$returnurl}", '01');
            } else {
                MooMessage("用户名不存在", "index.php?n=login", '01');
            }
        }
    }
    //获取
    $user = array_merge(MooGetData('members_login', 'uid', $userid), MooMembersData($userid));
    echo $user['is_lock'];
    exit;
    if ($user['is_lock'] != '1') {
        MooMessage("很抱歉您的用户名已经被锁定!<br>请联系真爱一生网客服:<b>400-678-0405</b>", "{$returnurl}", '01', 6);
    }
    //note 用户密码错误
    if ($user['uid'] && $user['password'] != $md5_password) {
        //note 转至邮箱验证页
        if ($returnurl) {
            $returnurl = $returnurl;
            MooMessage("用户密码错误", "{$returnurl}", '01');
        } else {
            MooMessage("用户密码错误", "index.php?n=login", '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);
        }
        $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);
        }
        //		echo print_r($_MooCookie);die;
        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);
        //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) {
            $returnurl = $returnurl;
            header("Location:" . $returnurl);
        } else {
            header("Location:index.php?n=service");
        }
        exit;
    }
}
Ejemplo n.º 29
0
function update_iswell_user($uid)
{
    global $_MooClass, $dbTablePre;
    $sql = "update {$dbTablePre}members_search set is_well_user=1 where uid={$uid}";
    $_MooClass['MooMySQL']->query($sql);
    if (MOOPHP_ALLOW_FASTDB) {
        $value['is_well_user'] = 1;
        MooFastdbUpdate('members_search', 'uid', $uid, $value);
    }
}
Ejemplo n.º 30
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;
    }
}