Показване на Browser, OS, IP със помоща на PHP

fena

Super Moderator
Това показва информация за:
OS
Browser
Agent
IP
Date


Код:
<?php
/*
+-----------------------------------------------------------+
| Re-Written by xCs - xcs@start.bg (http://www.uphacks.com/)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+-----------------------------------------------------------+
*/
   $agent = $_SERVER['HTTP_USER_AGENT'];
   $browser = getbrowser();
   $os = getos();
   $ip = getip();
   $gip = $ip;
   $date = date("Y-m-d");

function getbrowser(){
   $agent = $_SERVER['HTTP_USER_AGENT'];
   if(eregi("Netcaptor", $agent)){
    $browser = "Netcaptor";
} elseif(eregi("(opera) ([0-9]{1,2}.[0-9]{1,3}){0,1}", $agent, $ver) || eregi("(opera/)([0-9]{1,2}.[0-9]{1,3}){0,1}", $agent, $ver)){ $browser = "Opera $ver[2]";
} elseif(eregi("(konqueror)/([0-9]{1,2}.[0-9]{1,3})", $agent, $ver)){ $browser = "Konqueror $ver[2]";
} elseif(eregi("(lynx)/([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2})", $agent, $ver)){ $browser = "Lynx $ver[2]";
} elseif(eregi("(msie) ([0-9]{1,2}.[0-9]{1,3})", $agent, $ver)){ $browser = "Internet Explorer $ver[2]";
} elseif(eregi("Links", $agent)){ $browser = "Lynx";
} elseif(eregi("(Firefox/)([0-9]{1,2}.[0-9]{1,3}){0,1}", $agent, $ver)){ $browser = "Firefox $ver[2]";
} elseif(eregi("(Firebird/)([0-9]{1,2}.[0-9]{1,3}){0,1}", $agent, $ver)){ $browser = "Firebird $ver[2]";
} elseif(eregi("Mozilla/5",$agent)){$browser = "Netscape 5";
} elseif(eregi("Gecko", $agent)){ $browser = "Mozilla";
} elseif(eregi("Safari",$agent)){ $browser = "OS-X Safari";
} elseif(eregi("(netscape6)/(6.[0-9]{1,3})", $agent, $ver)){ $browser = "Netscape $ver[2]";
} elseif(eregi("(Mozilla)/([0-9]{1,2}.[0-9]{1,3})", $agent, $ver)){ $browser = "Netscape $ver[2]";
} elseif(eregi("Galeon", $agent)){ $browser = "Galeon";
} elseif(eregi("(lynx)/([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2})", $agent, $ver) ){$browser = "Lynx $ver[2]";
} elseif(eregi("Avant Browser", $agent)){ $browser = "Avant";
} elseif(eregi("(omniweb/)([0-9]{1,2}.[0-9]{1,3})", $agent, $ver) ){$browser = "OmniWeb $ver[2]";
} elseif(eregi("ZyBorg|WebCrawler|Slurp|Googlebot|MuscatFerret|ia_archiver", $agent)){ $browser = "Web indexing robot";
} elseif(eregi("(webtv/)([0-9]{1,2}.[0-9]{1,3})", $agent, $ver) ){$browser = "WebTV $ver[2]";
} else {$browser = "Unknown";}
return $browser;
}

function getos(){
   $agent = $_SERVER['HTTP_USER_AGENT'];
   if(strstr($agent,'Win')){
      if(strstr($agent,'NT 5.0') || strstr($agent,'NT5.0') || strstr($agent,'Windows 2000')){ $os = "Windows 2000";
   }else if(strstr($agent,'NT 5.1') || strstr($agent,'NT5.1') || strstr($agent,'Windows XP')){$os = "Windows XP";
}else if(strstr($agent,'Win98') || strstr($agent,'Windows 98')){$os="Windows 98";
}else if(strstr($agent,'NT')) {$os='Windows NT';
}else if(strstr($agent,'Win95') || strstr($agent,'Windows 95')){$os='Windows 95';
}else if(strstr($agent,'Win 9x')) {$os='Windows 95';
}else if(strstr($agent,'WinME') || strstr($agent,'Windows ME')){$os='Windows ME';
}else{$os='Windows (version unspecified)';}

}else if (strstr($agent,'Mac')){$os='Apple Macintosh';
}else if (strstr($agent,'Linux')){$os='Linux';
}else if (strstr($agent,'BeOS')){$os='BeOS';
}else if (strstr($agent,'Unix') || strstr($agent, "HP-ux") || strstr($agent, "X11")){$os='Unix';
}else if (strstr($agent,'SunOS')){$os='SunOS';
}else if (strstr($agent,'FreeBSD')){$os='FreeBSD';
}else if (strstr($agent,'OpenBSD')){$os='OpenBSD';
}else if (strstr($agent,'IRIX')){$os='IRIX';
}else if (strstr($agent,'spider') || strstr($agent,'bot') || strstr($agent,'http') || strstr($agent,'Scooter') || strstr($agent,'WebCopier')){$os='Spiders';
}else{$os='Unspecified';
}
return $os;
}

function getip(){
   if(getenv('HTTP_X_FORWARDED_FOR')){
      $ip = $_SERVER['REMOTE_ADDR'];
      if(preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)){
         $ip2 = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10..*/', '/^224..*/', '/^240..*/');
         $ip = preg_replace($ip2, $ip, $ip3[1]);
      }
   }else{
   $ip = $_SERVER['REMOTE_ADDR'];
}
if($ip == ""){ $ip = "x.x.x.x"; }
return $ip;
}
class convert{
function convert_date($datestamp, $mode="long"){
   global $pref;
   $datestamp += (TIMEOFFSET*3600);
   if($mode == "long"){
      return strftime($pref['longdate'], $datestamp);
   }else if($mode == "short"){
      return strftime($pref['shortdate'], $datestamp);
   }else{
   return strftime($pref['forumdate'], $datestamp);
}
}
}

echo "
OS: $os<BR>
Browser: $browser<BR>
Agent: $agent<BR>
IP: $ip<BR>
Date: $date<BR>";
?>
 

Горе