query($sql); ///禁止非法访问 if ($result->num_rows > 0) {}else{echo "";} $address=array(); for($i=0;$i<$result->num_rows;$i++) { $row = $result->fetch_assoc(); if($row['time']>(time()-86400)){ if(!in_array($row['ip'],$ip)){ if(!in_array($address,$row['city'])) array_push($address,$row['city']); array_push($ip,$row['ip']); } if($row['url']=="https://cn.yimian.xyz/") { $hh_count++; if(!in_array($row['ip'],$hh_ip)) array_push($hh_ip,$row['ip']); } $count_total++; } } ///统计video ip $video_count_total=0; $video_ip=array(); $sql = "SELECT * FROM videolog"; $result = $conn->query($sql); ///禁止非法访问 for($i=0;$i<$result->num_rows;$i++) { $row = $result->fetch_assoc(); if($row['time']>(time()-86400)){ if(!in_array($row['ip'],$video_ip)){ array_push($video_ip,$row['ip']); } $video_count_total++; } } ///统计video ip下观看内容 $video_txt=array(); for($_i=0;$_iquery($sql); ///禁止非法访问 $video_txt_tmp=array(); for($i=0;$i<$result->num_rows;$i++) { $row = $result->fetch_assoc(); if($row['time']>(time()-86400)){ if(!in_array($row['video'],$video_txt_tmp)){ $tmp=$row['video']; $time2=$row['time']; $time2=date('H:i:s', $time2+28800); //$res=db__getData($conn,"video","id",$tmp); //$tmp=$res[0]['series']." | ".$res[0]['name']; $tmp="$tmp $time2 ".number_format(($row['seek']/60),2)."分钟"; array_push($video_txt_tmp,$tmp); } } } for($i=0;$iquery($sql); ///禁止非法访问 for($i=0;$i<$result->num_rows;$i++) { $row = $result->fetch_assoc(); if($row['time']>(time()-86400)){ if(!in_array($row['ip'],$ssr_ip)){ array_push($ssr_ip,$row['ip']); array_push($ssr_tel,$row['tel']); $time2=$row['time']; $time2=date('H:i:s', $time2+28800); array_push($ssr_time,$time2); } $ssr_count_total++; } } $ssr_name=array(); for($i=0;$iquery($sql); ///禁止非法访问 if ($result->num_rows > 0) {}else{} $row = $result->fetch_assoc(); $ssr_name[$i]=$row['name']; } ///统计ssr流量 $sql = "SELECT * FROM ssr where port=0"; $result = $conn->query($sql); ///禁止非法访问 if ($result->num_rows > 0) {}else{echo "";} $row = $result->fetch_assoc(); $logFile_usa= file_get_contents("log/usa/ssr.log"); $logFile_aus= file_get_contents("log/aus/ssr.log"); $logFile_Array=array(); $logFile_Array_usa=array(); $logFile_Array_aus=array(); $logFile_Name=array(); $ssr_limit=$row['passwd']; $ssr_lift=8990-$ssr_limit; for($i=8889;$i<=$ssr_limit;$i++) { $file_tmp=substr($logFile_usa,strrpos($logFile_usa,"TCP/$i:"),70); $logFile_Array_usa[$i]=substr($file_tmp,strpos($file_tmp,"s,")+3,strpos($file_tmp,"bytes")-1-(strpos($file_tmp,"s,")+3)); $logFile_Array_usa[$i]+=0; $file_tmp=substr($logFile_aus,strrpos($logFile_aus,"TCP/$i:"),70); $logFile_Array_aus[$i]=substr($file_tmp,strpos($file_tmp,"s,")+3,strpos($file_tmp,"bytes")-1-(strpos($file_tmp,"s,")+3)); $logFile_Array_aus[$i]+=0; $logFile_Array[$i]=$logFile_Array_usa[$i]+$logFile_Array_aus[$i]; if($logFile_Array[$i]!=0) { $sql = "SELECT * FROM user where ssr='$i'"; $result = $conn->query($sql); ///禁止非法访问 $row = $result->fetch_assoc(); $logFile_Name[$i]=$row['name']; } $logFile_Array[$i]= number_format($logFile_Array[$i]/(1025*1025),2); } function getIpInfo($internetIp = '') { try { //内网IP // A类10.0.0.0~10.255.255.255 // B类172.16.0.0~172.31.255.255 // C类192.168.0.0~192.168.255.255 // ...... $bLocalIp = !filter_var($internetIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE); if($bLocalIp) $internetIp = 'myip';//局域网IP $requestAPi = "http://ip.taobao.com/service/getIpInfo.php?ip=" . $internetIp; $opts = array( 'http' => array( 'method' => 'GET', 'timeout' => 1, // 单位秒 ) ); $jsonArr = json_decode( file_get_contents($requestAPi, false, stream_context_create($opts)), JSON_HEX_TAG | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_HEX_APOS ); // 说明断网 if (!isset($jsonArr) || !isset($jsonArr['code'])) { return false; } // 0 表示成功 if ($jsonArr['code'] !== 0) { return false; } // 返回的数据结果: // "ip": "223.98.166.115", // "country": "中国", // "area": "", // "region": "山东", // "city": "济南", // "county": "XX", // "isp": "移动", // "country_id": "CN", // "area_id": "", // "region_id": "370000", // "city_id": "370100", // "county_id": "xx", // "isp_id": "100025" $data = (array)$jsonArr['data']; return $data; } catch (\Exception $e) { } return false; } ?> Yimian Logger