mirror of https://github.com/IoTcat/ushio-log.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.9 KiB
60 lines
1.9 KiB
<?php |
|
include './functions.php'; |
|
|
|
header("Access-Control-Allow-Origin: *"); |
|
|
|
$fp=$_REQUEST['fp']; |
|
$ip=getIp(); |
|
$domain=$_SERVER['HTTP_HOST']; |
|
$from=$_REQUEST['url']; |
|
$lang=$_REQUEST['lang']; |
|
$timezone=$_REQUEST['timezone']; |
|
$platform=$_REQUEST['platform']; |
|
$ram=$_REQUEST['ram']; |
|
$screen=$_REQUEST['screen']; |
|
$userAgent=$_REQUEST['userAgent']; |
|
$webgl=$_REQUEST['webgl']; |
|
$rsid=$_REQUEST['sid']; |
|
$sessiontime=$_REQUEST['sessiontime']; |
|
|
|
|
|
if(isset($rsid) && isset($sessiontime)){ |
|
yimian__log("log_iis", array("sessiontime"=>$sessiontime), array("sid"=>$rsid)); |
|
die(); |
|
} |
|
|
|
if(isset($ip) && !isset($fp) && !isset($from)){ |
|
echo json_encode(array("ip"=>$ip)); |
|
die(); |
|
} |
|
|
|
if(!isset($fp) || !isset($ip) || !isset($domain)) die(); |
|
|
|
|
|
if(!(isset($from) && strlen($from) > 5)) $from=$_SERVER['HTTP_REFERER']; |
|
$sid=substr(md5(time()*rand()), 0, 16); |
|
|
|
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; 4399Box.560; .NET4.0C; .NET4.0E)'); |
|
|
|
//$ipData = file_get_contents('http://ip-api.com/json/49.64.195.96'); |
|
$ipData = '{ |
|
"status": "success", |
|
"country": "China", |
|
"countryCode": "CN", |
|
"region": "JS", |
|
"regionName": "Jiangsu", |
|
"city": "Suzhou", |
|
"zip": "", |
|
"lat": 31.3093, |
|
"lon": 120.602, |
|
"timezone": "Asia/Shanghai", |
|
"isp": "Chinanet", |
|
"org": "Chinanet JS", |
|
"as": "AS4134 CHINANET-BACKBONE", |
|
"query": "49.64.195.96" |
|
}'; |
|
$ipData = json_decode($ipData,true); |
|
|
|
yimian__log("log_iis",array("sid"=>$sid,"country"=>$ipData['country'],"region"=>$ipData['regionName'],"city"=>$ipData['city'],"isp"=>$ipData['isp'],"address"=>$ipData['as'],"org"=>$ipData['org'],"latitude"=>$ipData['lat'],"longitude"=>$ipData['lon'],"fp"=>$fp,"ip"=>ip2long($ip),"domain"=>get_from_domain(),"url"=>$from,"timestamp"=>date('Y-m-d H:i:s', time()),"language"=>$lang,"timezone"=>$timezone,"platform"=>$platform,"ram"=>$ram,"screen"=>$screen,"useragent"=>$userAgent,"webgl"=>$webgl)); |
|
|
|
echo json_encode(array("sid"=>$sid, "ip"=>$ip));
|
|
|