Advertisement
garfield

[PHP]: Exibir informações do usuário em forma de imagem

Feb 4th, 2013
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2.     // Este script detecta Informações do usuário como IP/Navegador e sistema operacional.
  3.     // preview: http://suyann.6te.net/Forum/IP/
  4.  
  5.  
  6.  
  7.     header("Content-type: image/jpg");
  8.    
  9.    
  10.    
  11.     $Imagem             = imageCreateFromJPEG("fundo.jpg");
  12.     $cor                = imagecolorallocate($Imagem, 255, 255, 255);
  13.    
  14.    
  15.    
  16.     imagestring($Imagem, 5, 30, 10, "S.Operacional: ".getOS($_SERVER['HTTP_USER_AGENT']), $cor);
  17.     imagestring($Imagem, 5, 30, 25, "Navegador:     ".getSeafaring(), $cor);
  18.     imagestring($Imagem, 5, 30, 40, "Seu IP:        ".$_SERVER['REMOTE_ADDR'], $cor);
  19.     imagestring($Imagem, 2, 280, 50, "(Criado por SuYaNw A.K.A Garfield)", $cor);
  20.    
  21.    
  22.    
  23.    
  24.     imagepng($Imagem);
  25.    
  26.    
  27.     function getSeafaring(){
  28.        
  29.         $Navegador      = $_SERVER['HTTP_USER_AGENT'];
  30.         $Saida          = "";
  31.                
  32.         if(preg_match('/MSIE/i',   $Navegador))            $Saida  = "Internet Explorer";
  33.         else if(preg_match('/Firefox/i',$Navegador))            $Saida  = "Mozilla Firefox";
  34.         else if(preg_match('/Chrome/i', $Navegador))            $Saida  = "Google Chrome";
  35.         else if(preg_match('/Safari/i', $Navegador))            $Saida  = "Apple Safari";
  36.         else if(preg_match('/Opera/i',  $Navegador))            $Saida  = "Opera";
  37.         return $Saida;
  38.     }
  39.    
  40.     function getOS($userAgent) // Daniel Kassner
  41.     {
  42.         $oses = array (
  43.             'iPhone' => '(iPhone)',
  44.             'Windows 3.11' => 'Win16',
  45.             'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', // Use regular expressions as value to identify operating system
  46.             'Windows 98' => '(Windows 98)|(Win98)',
  47.             'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
  48.             'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
  49.             'Windows 2003' => '(Windows NT 5.2)',
  50.             'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
  51.             'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
  52.             'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
  53.             'Windows ME' => 'Windows ME',
  54.             'Open BSD'=>'OpenBSD',
  55.             'Sun OS'=>'SunOS',
  56.             'Linux'=>'(Linux)|(X11)',
  57.             'Safari' => '(Safari)',
  58.             'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
  59.             'QNX'=>'QNX',
  60.             'BeOS'=>'BeOS',
  61.             'OS/2'=>'OS/2',
  62.             'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)'
  63.         );
  64.  
  65.         foreach($oses as $os=>$pattern){
  66.             if(@eregi($pattern, $userAgent)) {
  67.  
  68.                 return $os;
  69.             }
  70.         }
  71.         return 'Desconhecido';
  72.     }
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement