public function log()
 {
     if (I('type') == 'excel') {
         $field = 'target.uid,target.uname,target.introducer_uid,target.introducer_uname,target.created,target.reg_ip,target.mobile,i.university_name,i.campus_name,target.channel,target.device_code,m.area,m.type';
         $model = M()->table('zj_user target')->join('zj_user_info i on i.uid=target.uid')->join('left join zj_common_mobile m on m.number=left(target.mobile,7)');
         $list = $model->where('introducer_uid>0')->field($field)->order('target.uid DESC')->select();
         foreach ($list as $key => $vo) {
             $list[$key]['created'] = date('Y-m-d', $vo['created']);
         }
         csv('推荐注册人', $list, ['推荐人编号' => 'introducer_uid', '推荐人名称' => 'introducer_uname', '注册日期' => 'created', '用户编号' => 'uid', '用户名' => 'uname', '手机号' => 'mobile', '所属大学' => 'university_name', '来源渠道' => 'channel']);
     }
     $where = [];
     $code = I('code');
     if ($code) {
         $where['s.introducer_code'] = $code;
     }
     $this->meta_title = '推荐记录';
     $model = M()->table('zj_user target')->join('zj_user_info i on i.uid=target.uid');
     $model->join('left join zj_common_mobile m on m.number=left(target.mobile,7)');
     $model->join('zj_user_source s on s.uid=target.uid');
     $list = $this->lists($model, $where, 'target.created desc', 'target.uid,target.uname,target.created,target.reg_ip,target.mobile,i.university_name,i.campus_name,s.*,m.area,m.type');
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     foreach ($list as &$vo) {
         $vo['location'] = $Ip->getlocation(long2ip($vo['reg_ip']));
     }
     $this->assign('_list', $list);
     $this->display();
 }
 public function index()
 {
     $ip = get_client_ip();
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示IP地址库文件
     $area = $Ip->getlocation('203.34.5.66');
     // 获取某个IP地址所在的位置
     echo $area;
 }
Example #3
0
 public function ip()
 {
     $ip = get_client_ip();
     print_r($ip);
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示IP地址库文件
     $area = $Ip->getlocation($ip);
     // 获取某个IP地址所在的位置
     print_r($area);
 }
 public function ip()
 {
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示IP地址库文件
     $area = $Ip->getlocation('www.58.com');
     // 获取某个IP地址所在的位置
     dump($area);
     echo $area;
     //$this->display();
 }
Example #5
0
function IP($ip = '', $file = 'UTFWry.dat')
{
    $_ip = array();
    if (isset($_ip[$ip])) {
        return $_ip[$ip];
    } else {
        $iplocation = new \Org\Net\IpLocation($file);
        $location = $iplocation->getlocation($ip);
        $_ip[$ip] = $location['country'] . $location['area'];
    }
    return $_ip[$ip];
}
 public function addVisitor()
 {
     // 获取数据
     $ip = get_client_ip();
     $ipLocation = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示Ip地址库文件
     $area = $ipLocation->getlocation($ip);
     // 获取某个Ip地址所在的位置
     // 构造数据
     $data = array('ip' => $ip, 'country' => $area['country'], 'area' => $area['area'], 'created_time' => Date('Y-m-d H:i:s'));
     M('visitor')->add($data);
 }
 public function trace($url)
 {
     // session ( "access_trace_data", null);
     $ses = session("access_trace_data");
     if ($ses == null) {
         // 用户首次登录
         $data["session_id"] = session_id();
         $data["thedate"] = date("Y-m-d H:i:s", time());
         $data["url"] = $url;
         if (isMobile()) {
             $data["location"] = "手机";
         } else {
             $ipLocation = new \Org\Net\IpLocation('QQWry.dat');
             // 实例化类 参数表示IP地址库文件
             $ip = get_client_ip();
             $data["ip"] = $ip;
             $area = $ipLocation->getlocation($ip);
             // '203.34.5.66'); // 获取某个IP地址所在的位置
             $author_location = iconv('gbk', 'utf-8', $area['country'] . $area['area']);
             $data["location"] = $author_location;
         }
         session("access_trace_data", $data);
         // 设置用户已登录
         self::updateCounter($data);
     } else {
         // 检查是否已经是下一天
         $today = date("Y-m-d", time());
         $data = session("access_trace_data");
         if ($today > substr($data["thedate"], 0, 10)) {
             $data = session("access_trace_data");
             $data["thedate"] = date("Y-m-d H:i:s", time());
             self::updateCounter($data);
         }
     }
     $counter = session("access_trace_counter");
     $m = M("AccessTraceCounter");
     // 网站发布总天数
     $totalNo = $m->query("select count(distinct(date(thedate))) as c from think_access_trace_counter");
     $totalDay = intval($totalNo[0]["c"]) - 1;
     // 日均访问量
     $counter["avgNo"] = (int) (intval($counter["totalNo"]) / $totalDay);
     // 最高访问量
     $totalNo = $m->query("select count(*) as c from think_access_trace_counter group by date(thedate) order by c desc");
     $counter["maxNo"] = $totalNo[0]["c"];
     $data = session("access_trace_data");
     $data["thedate"] = date("Y-m-d H:i:s", time());
     $data["url"] = $url;
     // 记录访问详细信息
     $m = M("AccessTraceDetails");
     $m->add($data);
     $this->ajaxReturn($counter);
 }
 public function detail_tpbox($id)
 {
     $feedback = M()->table('zj_feedback f')->join('zj_user u ON u.uid=f.uid')->join('zj_feedback_source fs ON fs.feedback_id=f.id')->field('f.*,fs.*,u.uname')->find($id);
     if ($feedback) {
         $feedback['url'] = explode(',', $feedback['url']);
         $Ip = new \Org\Net\IpLocation('UTFWry.dat');
         $feedback['location'] = $Ip->getlocation(long2ip($feedback['ip']));
         $this->assign('feedback', $feedback);
         $this->display('Feedback/detail_tpbox');
     } else {
         $this->error('反馈消息不存在');
     }
 }
 public function doLogin($loginname, $password)
 {
     if (session('can_doLogin') != true) {
         echo TO_HACKERS;
         return;
     }
     session('can_doLogin', false);
     $operator = new \Home\Model\OperatorModel();
     $result = $operator->queryOperator($loginname, $password);
     if (!empty($result) && count($result) == 1) {
         session('operatorId', $result[0]['operator_id']);
         session('instId', $result[0]['inst_id']);
         session('operatorName', $result[0]['user_name']);
         session('isSuperAdmin', $result[0]['is_super_admin']);
         session('teacherId', $result[0]['teacher_id']);
         if ($result[0]['is_super_admin'] == 1) {
             session('role', "超级管理员");
         } else {
             session('role', "管理员");
         }
         $roleList = $operator->findRolesByOperator($result[0]['inst_id'], $result[0]['operator_id']);
         for ($i = 0; $i < count($roleList); $i++) {
             if ($roleList[$i]['code'] == 'ROLE_TEACHER') {
                 session('ROLE_TEACHER', 1);
             }
             //TODO 添加角色权限
         }
         //add login log
         try {
             $ip = get_client_ip();
             $loc = new \Org\Net\IpLocation('UTFWry.dat');
             // 实例化类 参数表示IP地址库文件
             $locationArr = $loc->getlocation($ip);
             $location = $locationArr['country'] . $locationArr['area'];
             $operator->addLoginLog($result[0]['operator_id'], date('Y-m-d H:i:s', time()), $ip, $location);
         } catch (Exception $e) {
             //do nothing
         }
         session("loginErr", 0);
         $this->redirect('Operator/showDashboard', null, 0, '页面跳转中...');
     } else {
         session("loginErr", 1);
         $this->redirect('Operator/login', null, 0, '页面跳转中...');
     }
 }
 public function index()
 {
     if (GetValue("ipblock_lang") == 1 && substr_count($_SERVER["HTTP_ACCEPT_LANGUAGE"], 'zh-cn') > 0) {
         $this->redirect('Ipblock/login');
     }
     $IpLocation = new \Org\Net\IpLocation();
     $result = $IpLocation->getlocation();
     $address = $result['country'] . $result['area'];
     $ip = $result['ip'];
     $city = GetValue("ipblock_city");
     $cityinfo = unserialize($city);
     foreach ($cityinfo as $k => $v) {
         if (substr_count($address, $v) > 0 || substr_count($ip, $v) > 0) {
             $this->redirect('Ipblock/login');
         }
     }
     cookie('ipblock', 0, 3600 * 6);
     //不在范围
 }
Example #11
0
 public function addinfo()
 {
     if (empty($_GET['imgcode'])) {
         echo '请输入验证码';
         exit;
     }
     if (!check_verify($_GET['imgcode'])) {
         echo '验证码错误';
         exit;
     }
     if (empty($_GET['brand'])) {
         echo '请选择品牌';
         exit;
     }
     if (empty($_GET['series'])) {
         echo '请选择车系';
         exit;
     }
     if (empty($_GET['use_time'])) {
         echo '请输选择用车时间';
         exit;
     }
     if (empty($_GET['telphone'])) {
         echo '请输入手机号码';
         exit;
     }
     $model = M();
     $count = $model->query('select * from tc_zuche where ip = \'' . get_client_ip() . '\' and to_days(FROM_UNIXTIME(addtime, \'%Y-%c-%d\')) = to_days(now())');
     if (count($count) > 3) {
         echo '您今天已经提交三次';
         exit;
     }
     $ip = get_client_ip();
     $ipInfo = new \Org\Net\IpLocation('UTFWry.dat');
     $area = $ipInfo->getlocation($ip);
     $carBrand = M('CarBrand')->find(I('get.brand'));
     $result = M('Zuche')->add(array('carinfo' => $carBrand['title'] . ' ' . I('series'), 'use_time' => I('get.use_time'), 'phone' => I('get.telphone'), 'use_area' => I('get.use_area'), 'use_type' => I('get.use_type'), 'userinfo' => $area["country"] . '-' . $area["area"], 'ip' => $ip, 'addtime' => time()));
     if ($result !== false) {
         echo 1;
     } else {
         echo '发布失败请稍后重试……';
     }
 }
 public function customized()
 {
     $flag = true;
     $msg = '';
     if (IS_POST) {
         if (empty($_POST['telphone']) || !preg_phone($_POST['telphone'])) {
             $flag = false;
             $msg = '请输入正确的手机号码';
         }
         if (empty($_POST['price']) || preg_match('/^\\d{1,3}$/', $_POST['price'])) {
             $flag = false;
             $msg = '请输入正确的预算格式为数字';
         }
         if (empty($_POST['title'])) {
             $flag = false;
             $msg = '请输入品牌车型';
         }
         if ($flag) {
             $model = M();
             $count = $model->query('select * from tc_car_buy where ip = \'' . get_client_ip() . '\' and to_days(FROM_UNIXTIME(addtime, \'%Y-%c-%d\')) = to_days(now())');
             if (count($count) > 3) {
                 $msg = '您今天已经提交三次';
             } else {
                 $ip = get_client_ip();
                 $ipInfo = new \Org\Net\IpLocation('UTFWry.dat');
                 $area = $ipInfo->getlocation($ip);
                 $carBrand = M('CarBrand')->find(I('get.brand'));
                 $result = M('CarBuy')->add(array('title' => I('post.title'), 'price' => I('post.price'), 'phone' => I('post.telphone'), 'ipaddress' => $area["country"], 'ip' => $ip, 'network' => $area["area"], 'addtime' => time()));
                 if ($result !== false) {
                     $this->success('发布成功,工作人员会尽快与您联系', __APP__);
                 } else {
                     $msg = '发布失败请稍后重试……';
                 }
             }
         }
     }
     $this->assign('msg', $msg);
     $this->display();
 }
 public function get_user_cityname()
 {
     /*
      * 这里有一个很核心的问题没有解决,但不影响整体性能
      * 如果用户使用路由器,那么我们或得的ip显然就不正确
      * 这样的话,这个方法,返回的数据为空,也就是数方法
      * 无意义,但是,用户一旦拥有独立ip的主机,则有意义,
      * new: 已解决
      */
     //得到用户的ip
     if (empty($_POST['ip_cin'])) {
         $host_ip = R('Others/get_user_ip');
     } else {
         $host_ip = $_POST['ip_cin'];
     }
     //这里ip地址库必须这样实例化
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示IP地址库文件
     //可以同时放ip和域名
     $area = $Ip->getlocation($host_ip);
     // 获取域名服务器所在的位置,扩展库方法
     $city_allname = $area['country'];
     //得到的字符串是完整的信息,然后对字符串进行分割得到一个简短的城市名,主要为了和城市代码库的索引相同
     $sim_cityname = explode("市", explode("省", $city_allname)[1])[0];
     // 		$sim_cityname="北京";//测试专用
     return $sim_cityname;
 }
Example #14
0
 /**
  * 定位所在城市
  */
 public function getDefaultCity()
 {
     $areaId2 = (int) I('city', 0);
     if ($areaId2 == 0) {
         $areaId2 = (int) session('areaId2');
     }
     //检验城市有效性
     if ($areaId2 > 0) {
         $m = D('Home/Areas');
         $sql = "SELECT areaId FROM __PREFIX__areas WHERE isShow=1 AND areaFlag = 1 AND areaType=1 AND areaId=" . $areaId2;
         $rs = $m->query($sql);
         if ($rs[0]['areaId'] == '') {
             $areaId2 = 0;
         }
     } else {
         $areaId2 = (int) $_COOKIE['areaId2'];
     }
     //定位城市
     if ($areaId2 == 0) {
         //IP定位
         $Ip = new \Org\Net\IpLocation('UTFWry.dat');
         // 实例化类 参数表示IP地址库文件
         $area = $Ip->getlocation(get_client_ip());
         if ($area['area'] != "") {
             $m = D('Home/Areas');
             $sql = "SELECT areaId FROM __PREFIX__areas WHERE isShow=1 AND areaFlag = 1 AND areaType=1 AND areaName like '{$cityName}'";
             $rs = $m->query($sql);
             if ($rs[0]["areaId"] > 0) {
                 $areaId2 = $rs[0]["areaId"];
             } else {
                 $areaId2 = C(DEFAULT_CITY);
             }
         } else {
             $areaId2 = C(DEFAULT_CITY);
         }
     }
     session('areaId2', $areaId2);
     setcookie("areaId2", $areaId2, time() + 3600 * 24 * 90);
     return $areaId2;
 }
 public function addAuctionMsg()
 {
     if (IS_POST) {
         $code = $_POST["code"];
         $v = new Verify();
         if (!$v->check($code, "")) {
             $this->error("验证码有误!");
         }
         $data["auction_uid"] = session("auction_id");
         $data["goods_uid"] = $_POST["goods_uid"];
         $author = session("user");
         if ($author == null) {
             $author = "游客";
             // 游客才需要显示IP及位置
             // 获取IP所在地
             if (isMobile()) {
                 $data["author_location"] = "手机用户";
             } else {
                 $ipLocation = new \Org\Net\IpLocation('QQWry.dat');
                 // 实例化类 参数表示IP地址库文件
                 $ip = get_client_ip();
                 $data["author_ip"] = $ip;
                 $area = $ipLocation->getlocation($ip);
                 // '203.34.5.66'); // 获取某个IP地址所在的位置
                 $author_location = iconv('gbk', 'utf-8', $area['country'] . $area['area']);
                 $data["author_location"] = $author_location;
             }
         }
         $data["author"] = $author;
         $data["post_time"] = date("Y-m-d H:i:s", time());
         $data["message"] = $_POST["message"];
         $m = M("AuctionMessage");
         $m->add($data);
         if ($_POST["goods_uid"] == null) {
             $this->redirect("Home/Auction/viewAuction/uid/" . session("auction_id"));
         } else {
             $this->redirect("Home/Auction/viewAuctionGoods/uid/" . $_POST["goods_uid"]);
         }
     } else {
         $this->error("非法访问!");
     }
 }
Example #16
0
<?php

$dir = dirname(dirname(__FILE__));
include $dir . '/lib/IpLocation.class.php';
$data_path = $dir . '/data/qqwry_all.dat';
$ip = new Org\Net\IpLocation($data_path);
$arr = $ip->getlocation("58.16.27.0");
$country = mb_convert_encoding($arr["country"], "UTF-8", "GBK");
$area = mb_convert_encoding($arr["area"], "UTF-8", "GBK");
print_r($country);
echo "\r\n";
print_r($area);
echo "\r\n";
 public function addcustomized()
 {
     if (IS_AJAX) {
         if (empty($_POST['imgcode'])) {
             echo '请输入验证码';
             exit;
         }
         if (!check_verify($_POST['imgcode'])) {
             echo '验证码错误';
             exit;
         }
         if (empty($_POST['brand'])) {
             echo '请选择品牌';
             exit;
         }
         if (empty($_POST['series'])) {
             echo '请选择车系';
             exit;
         }
         if (empty($_POST['province'])) {
             echo '请选择省份';
             exit;
         }
         if (empty($_POST['city'])) {
             echo '请选择城市';
             exit;
         }
         if (empty($_POST['pricemin']) || empty($_POST['pricemax'])) {
             echo '请输填写价格';
             exit;
         }
         if (empty($_POST['buytime'])) {
             echo '请输选择预计购车时间';
             exit;
         }
         if (empty($_POST['telphone'])) {
             echo '请输入手机号码';
             exit;
         }
         $model = M();
         $count = $model->query('select * from tc_car_buy where ip = \'' . get_client_ip() . '\' and to_days(FROM_UNIXTIME(addtime, \'%Y-%c-%d\')) = to_days(now())');
         if (count($count) > 3) {
             echo '您今天已经提交三次';
             exit;
         }
         $ip = get_client_ip();
         $ipInfo = new \Org\Net\IpLocation('UTFWry.dat');
         $area = $ipInfo->getlocation($ip);
         $carBrand = M('CarBrand')->find(I('get.brand'));
         $result = M('CarBuy')->add(array('title' => $carBrand['title'] . ' ' . I('post.series'), 'province' => I('post.province'), 'city' => I('post.city'), 'price' => I('post.pricemin') . '-' . I('post.pricemax'), 'buytime' => I('post.buytime'), 'phone' => I('post.telphone'), 'ipaddress' => $area["country"], 'ip' => $ip, 'network' => $area["area"], 'addtime' => time()));
         if ($result !== false) {
             echo 1;
         } else {
             echo '发布失败请稍后重试……';
         }
     }
 }
Example #18
0
/**
 *取ip的物理地址
 ***/
function get_iplocation($ip = "127.0.0.1")
{
    if (file_exists(SITE_PATH . __ROOT__ . '/TP/Library/Org/Net/UTFWry.dat')) {
        $Ip = new \Org\Net\IpLocation('UTFWry.dat');
        // 实例化类 参数表示IP地址库文件
        $area = $Ip->getlocation($ip);
        // 获取某个IP地址所在的位置
        return $area['country'] . $area['area'];
    } else {
        $uri = "http://www.ip138.com/ips138.asp?ip={$ip}";
        $opts = array('http' => array('method' => 'GET', 'timeout' => 2));
        $context = stream_context_create($opts);
        $str = @file_get_contents($uri, false, $context);
        $str = iconv('gbk', 'utf-8', $str);
        preg_match('/本站主数据:(.*?)<\\/li>/si', $str, $out);
        return preg_replace('/\\s+/', '', $out[1]);
    }
}
Example #19
0
	public function index2()
	{
		$Ip = new \Org\Net\IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件
		$area = $Ip->getlocation('2.1.1.1'); // 获取某个IP地址所在的位置
		$this->show('<div type="text/css">'.$area[country].'-->'.$area[area].'</div>','utf-8');
	}
Example #20
0
function get_current_city()
{
    $ip = get_client_ip();
    $area = new \Org\Net\IpLocation('UTFWry.dat');
    $city = $area->getlocation($ip);
    if (!$city) {
        $city = '深圳';
    }
    $data = M('Region')->where("name like '%{$city}%'")->select();
    $_SESSION['wiki']['city'] = $city;
    $_SESSION['wiki']['cityId'] = $data[0]['id'];
    $res['city'] = $city;
    $res['cityId'] = $data[0]['id'];
    return $res;
}
Example #21
0
/**
 * 获取客户端IP并得到其地址
 *
 * @return string 客户端地址
 */
function getAddOfClient()
{
    $ip = get_client_ip();
    $Ip = new Org\Net\IpLocation('UTFWry.dat');
    // 实例化类 参数表示IP地址库文件
    //$area = $Ip->getlocation('203.34.5.66'); // 获取某个IP地址所在的位置
    $area = $Ip->getlocation($ip);
    // 获取某个IP地址所在的位置
    dump($area);
    exit;
    return $area['area'];
}
Example #22
0
function getAddressByIp($ip)
{
    //获取IP地址
    $IpLocation = new \Org\Net\IpLocation();
    $ipAddress = $IpLocation->getlocation($ip);
    $address = $ipAddress["country"] . '-' . $ipAddress["area"] . ' (' . $ipAddress["ip"] . ')';
    return $address;
}
 public function get_user_cityname()
 {
     /*
      * 这里有一个很核心的问题没有解决,但不影响整体性能
      * 如果用户使用路由器,那么我们或得的ip显然就不正确
      * 这样的话,这个方法,返回的数据为空,也就是数方法
      * 无意义,但是,用户一旦拥有独立ip的主机,则有意义,
      * new: 已解决
      */
     //得到用户的ip
     $host_ip = R('Test/get_user_ip');
     //这里ip地址库必须这样实例化
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     // 实例化类 参数表示IP地址库文件
     //可以同时放ip和域名
     $area = $Ip->getlocation($host_ip);
     // 获取域名服务器所在的位置
     // 		dump($area);
     $city_allname = $area['country'];
     $sim_cityname = explode("市", explode("省", $city_allname)[1])[0];
     return $sim_cityname;
     // 		echo $sim_cityname;
 }
 /**
  * 定位所在城市
  */
 public function getDefaultCity()
 {
     $areaId2 = (int) I('city', 0);
     if ($areaId2 == 0) {
         $areaId2 = (int) session('areaId2');
     }
     //检验城市有效性
     if ($areaId2 > 0) {
         $m = D('Home/Areas');
         $sql = "SELECT areaId FROM __PREFIX__areas WHERE isShow=1 AND areaFlag = 1 AND areaType=1 AND areaId=" . $areaId2;
         $rs = $m->query($sql);
         if ($rs[0]['areaId'] == '') {
             $areaId2 = 0;
         }
     } else {
         $areaId2 = (int) $_COOKIE['areaId2'];
     }
     //定位城市
     /*
     if($areaId2==0){
     	//IP定位
     	$Ip = new \Org\Net\IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件
     	$area = $Ip->getlocation(get_client_ip());
     	if($area['area']!=""){
     		$m = D('Home/Areas');
     		$sql ="SELECT areaId FROM __PREFIX__areas WHERE isShow=1 AND areaFlag = 1 AND areaType=1 AND areaName like '$cityName'";
     		$rs = $m->query($sql);
     		if($rs[0]["areaId"]>0){
     			$areaId2 = $rs[0]["areaId"];
     		}else{
     			$areaId2 = $GLOBALS['CONFIG']['defaultCity'];
     		}
     	}else{
     		$areaId2 = $GLOBALS['CONFIG']['defaultCity'];
     	}
     }
     */
     //获得默认城市
     $GLOBALS['CONFIG']['defaultCity'] = 0;
     $sql = "SELECT fieldValue FROM __PREFIX__sys_configs WHERE fieldType!='hidden' AND configId = 32";
     $rs = $this->query($sql);
     if ($rs[0]["fieldValue"] > 0) {
         $GLOBALS['CONFIG']['defaultCity'] = $rs[0]["fieldValue"];
     }
     if ($areaId2 == 0) {
         //IP定位
         $Ip = new \Org\Net\IpLocation('UTFWry.dat');
         // 实例化类 参数表示IP地址库文件
         $area = $Ip->getlocation(get_client_ip());
         if ($area['area'] != "") {
             $m = D('Home/Areas');
             $sql = "SELECT areaId FROM __PREFIX__areas WHERE isShow=1 AND areaFlag = 1 AND areaType=1 AND areaName like '{$cityName}'";
             $rs = $m->query($sql);
             if ($rs[0]["areaId"] > 0) {
                 $areaId2 = $rs[0]["areaId"];
             } else {
                 $areaId2 = $GLOBALS['CONFIG']['defaultCity'];
             }
         } else {
             $areaId2 = $GLOBALS['CONFIG']['defaultCity'];
         }
     }
     session('areaId2', $areaId2);
     setcookie("areaId2", $areaId2, time() + 3600 * 24 * 90);
     return $areaId2;
 }