/**
  * Hooks the `ndn_location` filter to supply the location
  * of the current remote address.
  *
  * @param object $location A stdClass object, detailing a location (possibly unknown)
  *
  * @return object A stdClass object, detailing the location of the remote address
  */
 public function filter_ndn_location($location)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $location = ip2location($ip);
     $human = array();
     if (!empty($location->city) && '-' != $location->city) {
         $human[] = $location->city;
     }
     if (!empty($location->region) && '-' != $location->region && (empty($location->city) || $location->region != $location->city)) {
         $human[] = $location->region;
     }
     if (!empty($location->country_long) && '-' != $location->country_long) {
         $human[] = $location->country_long;
     }
     if (!empty($human)) {
         $human = array_map('trim', $human);
         $human = array_map('strtolower', $human);
         $human = array_map('ucwords', $human);
         $location->human = implode(', ', $human);
         $location->human .= ' (likely completely wrong for mobile devices)';
     } else {
         $location->human = 'Unknown';
     }
     return $location;
 }
示例#2
0
文件: logxss.php 项目: moorefu/anehta
********************************************************/
//请求时间
//$requestDate = date("m/d/Y H:i:s");
$requestDate = date(DATE_RFC822);
//获取IP
$slaveIP = $_SERVER['REMOTE_ADDR'];
// 浏览器和系统版本
$slaveUA = $_SERVER['HTTP_USER_AGENT'];
// 语言
$slaveLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$slaveProxy = "";
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $slaveProxy = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
//查询地理位置
$slaveLocation = ip2location($slaveIP);
$slaveLocation = iconv("gbk", "utf-8", $slaveLocation);
$qstr = $_SERVER['QUERY_STRING'];
// XSS传回的数据
if ($qstr == "") {
    // logCache() POST 回来的数据
    //$qstr = $_POST['anehtaInput_anehtaPostLogger'];
    if (!empty($_POST['anehtaInput_anehtaPostLogger'])) {
        $qstr = urldecode($_POST['anehtaInput_anehtaPostLogger']);
    } else {
        if (!empty($_POST['anehtaInput_anehtaPostKeylog'])) {
            $qstr = urldecode($_POST['anehtaInput_anehtaPostKeylog']);
        } else {
            if (!empty($_POST['anehtaInput_anehtaPostClientProxy'])) {
                // clientproxy, 专门存到clientproxy.xml中
                $fpath = "../slave/clientproxy.xml";
 public function ip_to_city($ip)
 {
     $location = ip2location($ip);
     $human = array();
     if (!empty($location->city) && '-' != $location->city) {
         $human[] = $location->city;
     }
     if (!empty($location->region) && '-' != $location->region && (empty($location->city) || $location->region != $location->city)) {
         $human[] = $location->region;
     }
     if (!empty($location->country_long) && '-' != $location->country_long) {
         $human[] = $location->country_long;
     }
     if (!empty($human)) {
         $human = array_map('trim', $human);
         $human = array_map('strtolower', $human);
         $human = array_map('ucwords', $human);
         $location->human = implode(', ', $human);
     } else {
         $location->human = 'Unknown';
     }
     return $location;
 }
 private static function get_geolocation_data_from_ip()
 {
     $location_full = apply_filters('wpcom_geo_pre_get_geolocation_data_from_ip', false, $_SERVER['REMOTE_ADDR']);
     if (false !== $location_full) {
         return $location_full;
     }
     $location_full = null;
     if (function_exists('ip2location')) {
         $ip_address = apply_filters('wpcom_geo_ip_address', $_SERVER['REMOTE_ADDR']);
         $location_full = ip2location($ip_address);
         $location_full = apply_filters('wpcom_geo_location_full', $location_full);
     } elseif (defined('WP_DEBUG') && true === WP_DEBUG) {
         // Add some fake data for dev
         $location_full = new stdClass();
         $location_full->latitude = '43.6525';
         $location_full->longitude = '-79.381667';
         $location_full->country_short = 'CA';
         $location_full->country_long = 'CANADA';
         $location_full->region = 'ONTARIO';
         $location_full->city = 'TORONTO';
         // Allows for debugging with specific test data
         $location_full = apply_filters('wpcom_geo_location_full_debug', $location_full);
     }
     return $location_full;
 }
示例#5
0
<?php

require_once './include/qqwry.php';
ip2location($_SERVER['REMOTE_ADDR']);
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$browser = get_browser($_SERVER['HTTP_USER_AGENT'], true);
print_r($browser);
?>
 

<?php 
//	$b = get_browser();
//	var_dump($b);
//	phpinfo();