Single

【PHP源码】获取用户信息

测试图如下哦

代码如下

<?php
$file=$_SERVER['HTTP_USER_AGENT'];
if(strstr($file,"U;")){
preg_match('/Linux; U; (.*?);/i',$file,$version);
}else{
preg_match('/Linux;(.*?);/i',$file,$version);
}
if(strstr($file,"QQ/")&&strstr($file,"NetType/")&&strstr($file,"Pixel")&&strstr($file,"StatusBarHeight")){
preg_match('/QQ\/(.*?) NetType\/(.*?) WebP\/(.*?) Pixel\/(.*?) StatusBarHeight\/(.*?)/i',$file,$data);
}else{
}
preg_match('/Linux; (.*?); (.*?)\//i',$file,$model);
$area=json_decode(file_get_contents("http://opendata.baidu.com/api.php?query=".$_SERVER["REMOTE_ADDR"]."&co=&resource_id=6006&t=1433920989928&ie=utf8&oe=utf-8&format=json"),true);
echo "<h1>";
echo "当前 I P:".$_SERVER["REMOTE_ADDR"]."<hr>";
echo "所在地区:".$area["data"][0]["location"]."<hr>";
if(strstr($file,"Linux")){
echo "在线状态:Android在线<hr>";
}else if(strstr($file,"iPhone")){
echo "在线状态:iPhone在线<hr>";
}else if(strstr($file,"Windows NT")){
echo "在线状态:电脑在线<hr>";
$operatingsystem="电脑";
}else{
echo "在线状态:未知<hr>";
}
if($version[1]){
echo "系统版本:".$version[1]."<hr>";
}
if($model[1]){
echo "系统型号:".$model[2]."<hr>";
}
if($data[2]){
echo "网络状态:".$data[2]."<hr>";
}
if($data[4]){
echo "手机像素:".$data[4]."<hr>";
}
if($data[1]){
echo "QQ版本:".$data[1]."<hr>";
}
echo '信息仅供参考!<hr>';
echo "</h1>";

 

文章有(1)条网友点评

  • 哇666

发表评论