Mitch
New Member
- Messages
- 908
- Reaction score
- 0
- Points
- 0
I have got a ip sig. It works but the os and browser are not visible.
http://mitch.exofire.net/ip2.php
http://mitch.exofire.net/ip2.php
PHP:
<?php
if(!empty($_SERVER['HTTP_USER_AGENT'])) //look if you can use the modern http user agent
{
$browserinfo = $_SERVER['HTTP_USER_AGENT'];
}
elseif(!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) //else look that we can use the old one.
{
$browserinfo = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
}
if(isset($browserinfo)) // HTTP_USER_AGENT Data
{
$browser = array(array('Opera', 'Opera(/| )([0-9].[0-9]{1,2})', 2),
array('iCab', 'iCab ([0-9].[0-9].[0-9])', 1),
array('Blazer', 'Blazer/([0-9].[0-9])', 1),
array('Internet Explorer', 'MSIE ([0-9].[0-9]{1,2})', 1),
array('Ombiweb', 'OmniWeb/([0-9].[0-9]{1,2})', 1),
array('Netscape', 'Netscape/([0-9].[0-9])', 1),
array('Firefox', 'Firefox/([0-9].(([0-9]{1,2})|([0-9].[0-9]{1,2})))', 1),
array('Konqueror', 'Konqueror/([0-9].[0-9]{1,2})', 1),
array('Safari', 'Safari/([0-9].[0-9]{1,2})', 1),
array('Lynx', 'Lynx/([0-9].[0-9].(([0-9]{1,2})|([0-9][a-z]+.[0-9])))', 1),
array('Wget', 'Wget/([0-9].[0-9]{1,2}.[0-9])', 1),
array('Mozilla', 'Mozilla/([0-9].[0-9]{1,2})', 1),
array('Konqueror', 'Konqueror/([0-9].[0-9]{1,2})', 1));
foreach($browser as $navigator) //
{
if(ereg($navigator[1], $browserinfo, $versie))
{
$browser = $navigator[0]; // what for browser it is.
$browserversie = $versie[$navigator[2]]; // version
break; // stopped the foreach
}
}
$os = array(array('Linux', 'linux'),
array('Windows', 'win32'),
array('Palm OS', 'Palm'),
array('Windows ME', 'Win 9x 4.90'),
array('Windows XP Mediacenter edition', 'Media Center PC'),
array('Windows 2000', 'windows 2000'),
array('Windows 2000', 'windows nt)( ){0,1}(5.0)'),
array('Windows Vista', 'windows NT (6.[0-9])'),
array('Windows XP', '(windows nt)( ){0,1}(5.1)'),
array('Windows Mobile', 'Windows CE'),
array('Windows ', '(windows) ([0-9]{2})', 2),
array('Windows NT ', '(winnt)([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
array('Windows NT ', '(windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1}', 3),
array('Mac OS X', 'Mac OS X'),
array('mac', 'MAC'),
array('SunOS ', '(sunos) ([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
array('BeOS ', '(beos) r([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
array('FreeBSD', 'freebsd'),
array('OpenBSD', 'openbsd'),
array('IRIX', 'irix'),
array('OS/2', 'os/2)'),
array('plan', 'Plan9'),
array('Unix', 'unix'),
array('OSF', 'osf'));
foreach($os as $besturingss)
{
if(isset($bestuuringss[2]))
{
if(eregi($besturingss[1],$browserinfo,$versie))
{
$best = $besturingss[0].$versie[$besturingss[2]];
break;
}
}
else
{
if(eregi($besturingss[1],$browserinfo))
{
$best = $besturingss[0];
break;
}
}
}
$gegevens['browser'] = (isset($browser)) ? $browser : 'Unknown';
$gegevens['browserversie'] = (isset($browserversie)) ? $browserversie : 'Unknown';
$gegevens['os'] = (isset($best)) ? $best : 'Unknown';
/*
Not really needed.
*/
foreach($gegevens as $controle)
{
if($controle == 'unknown')
{
$gegevens['unknown'] = $browserinfo;
break;
}
}
if(isset($gegevens['unknown']))
{
echo $gegevens['unknown'];
}
}
else // if http_vars is not available
{
echo 'This function cannot be executed this server';
}
$image = "ip.png";
// Color
$im = imagecreatefrompng($image);
$red = imagecolorallocate ($im, 255, 0, 0);
$blue = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagecolortransparent($im, $white);
imagefill($im, 0, 0, $white);
$number = "Your IP is " . $_SERVER['REMOTE_ADDR'];
$rquote = random_quote();
$font = 10;
$font2 = 1;
// Number
$image_width = imagesx($im);
$string_width = imagefontwidth($font)*strlen($number);
$center = ($image_width-$string_width)/2;
// Quote = 72
$image_width2 = imagesx($im);
$string_width2 = imagefontwidth($font2)*strlen($rquote);
$center2 = ($image_width2-$string_width2)/2;
Imagestring($im, $font, $center, 17, $number, $red);
Imagestring($im , $font2, $center2, 40, $rquote, $blue);
function random_quote( )
{
$quotes[] = "Copyrights MITCH.EXOFIRE.NET";
$quotes[] = "Your provider: " . $_SERVER['REMOTE_HOST'];
$quotes[] = "Your OS: " . $gegevens['os'];
$quotes[] = "Your Browser: " . $gegevens['browser'];
srand ((double) microtime() * 1000000);
$random_number = rand(0,count($quotes)-1);
return $quotes[$random_number];
}
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>