/** * 取唯一单件模式 * @return object */ private static function _getInstant() { if (null == self::$ipLoc) { self::$ipLoc = new ipLocation(); } return self::$ipLoc; }
<?php require_once './include/config.inc.php'; if(!$userid) { if($_SERVER['HTTP_REFERER'] == '') { if($_SESSION['jumps'] != true) { $ipt = getip(); include_once('./include/getip.php'); $myobj=new ipLocation(); $address = $myobj->getaddress($ipt); $myobj=NULL; session_start(); $_SESSION['jumps'] = true; $address['area1'] = iconv('gb2312','utf-8', $address['area1'].$address['area2']); if(strpos($address['area1'], '辽宁') || strpos($address['area1'], '沈阳')) { obheader('http://shy.jiaju001.com'); } } } } //分类 require_once './cache/list.php'; $data['list_db'] = unserialize(stripslashes($lists_db)); require_once './cache/list_son.php'; $data['list_son'] = unserialize(stripslashes($lists_son)); require_once './cache/ad_index.php'; $data['ad']= unserialize(stripslashes($ad));
$address["area2"] = $this->readaddress(); break; } //*过滤一些无用数据 if (strpos($address["area1"], "CZ88.NET") != false) { $address["area1"] = "未知"; } if (strpos($address["area2"], "CZ88.NET") != false) { $address["area2"] = " "; } return $address; } } //*ipLocation class end $action = $_GET["action"]; $ip_url = $_GET["ip_url"]; if ($action == "getip") { $myobj = new ipLocation(); $ip = $myobj->getIP(); $address = $myobj->getaddress($ip); $myobj = NULL; $str = "您的IP地址是:" . $ip . " 来自:" . $address["area1"] . " " . $address["area2"]; echo $str; } if ($action == "queryip") { $myobj = new ipLocation(); $address = $myobj->getaddress($ip_url); $myobj = NULL; $str = "<h2><font color=green>您查询的IP是:" . $address["ip"] . "</font></h2> 所在地为:" . $address["area1"] . " " . $address["area2"]; echo $str; }
public function format() { $gps_address = \ipLocation::getInstance()->getaddress($this->wan_ip); $wan_gps = \Util::gbkToUtf8($gps_address['area1'] . ' ' . $gps_address['area2']); return array_merge($this->stat->format(), array('l4protocol' => strtoupper(getprotobynumber($this->l4protocol)), 'l7prot' => $this->l7prot, 'lan_ip' => $this->lan_ip, 'wan_ip' => $this->wan_ip, 'lan_port' => $this->lan_port, 'wan_port' => $this->wan_port, 'continue_time' => time() - $this->start_time, 'start_time' => (double) sprintf('%u', $this->start_time), 'wan_gps' => $wan_gps)); }