Can anyone tell me whats wrong here.
when using the $agent to get browser it is displaying alot of info too much I think. I have a log file under "log" folder called "access" that has the same info displayed when using $agent. Could it be pulling the info from here, or am I stupid.
<?php
Header ('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');
// set the dimensions
$img_width = 350;
$img_height = 140;
$image = imagecreatefromjpeg("http://northwst.servemp3.com/sigs/sig.jpg");
// set the colours
$cool = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$grey = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 58, 160, 2);
$blue = imagecolorallocate($image, 0, 0, 255);
$orange = imagecolorallocate($image, 244, 197, 32);
// set the font and print text
$font = 'C:/WINDOWS/fonts/batmfa__.ttf';
$pagefile = "C:\pagefile.sys";
$uptime = (time() - filemtime($pagefile));
$updays = floor($uptime / (24*3600));
$uptime = $uptime - ($updays * (24*3600));
$uphours = floor($uptime / (3600));
$uptime = $uptime - ($uphours * (3600));
$upminutes = floor($uptime /(60));
$uptime = $uptime - ($upminutes * 60);
$upsecs = $uptime;
// counter - CHMOD your counter file to 777
$viewss = file("/views.txt");
$views = $viewss[0]; $views++;
$fp = fopen("/views.txt", "w");
fwrite($fp, $views);
fclose($fp);
$counter = "$views People Clicked This Link";
$agent = ($_SERVER['HTTP_USER_AGENT']); //this shows info one the browser
// get IP and resolve IP
$ip = $_SERVER['REMOTE_ADDR'];
$resolved = gethostbyaddr ($REMOTE_ADDR);
$text = "Your IP is: $ip!";
$text2 = "northwst.servemp3.com";
$text3 = "Browser: $agent"; // this is the text on the 2nd line
// check for non resolve of IP and rip domain if resolved
if ($resolved == $ip) {
$isp = ".. Can't Resolve IP";
}
else
{
$str = preg_split("/\./", $resolved);
$i = count($str);
$x = $i - 1;
$n = $i - 2;
$isp = $str[$n] . "." . $str[$x];
}
// Simple OS Detection
$os = $HTTP_USER_AGENT;
$oslist = Array (
// Windows
"Win|Windows",
"Win16|Windows",
"Win95|Windows 95",
"Win98|Windows 98",
"WinME|Windows ME",
"Win32|Windows",
"WinNT|Windows NT",
"Windows 3.1|Windows 3.1",
"Windows 95|Windows 95",
"Windows CE|Windows CE",
"Windows 98|Windows 98",
"Windows ME|Windows ME",
"Windows NT|Windows NT",
"Windows NT 5.0|Windows 2000",
"Windows NT 5.1|Windows XP",
// Macintosh
"Mac_68000|MacOS m68K",
"Mac_68K|MacOS m68K",
"Mac_PowerPC|MacOS PPC",
"Mac_PPC|MacOS PPC",
"Macintosh|MacOS",
// Unices
"X11|UNIX",
"BSD|BSD",
"SunOS|SunOS",
"IRIX|IRIX",
"HP-UX|HP-UX",
"AIX|AIX",
"QNX|QNX",
"SCO_SV|SCO UNIX",
"FreeBSD|FreeBSD",
"NetBSD|NetBSD",
// Linux
"Linux|Linux",
"Debian|Debian GNU/Linux",
// Other
"BeOS|BeOS",
"OS/2|OS/2",
"AmigaOS|AmigaOS",
);
foreach ($oslist as $osnow) {
$osnow = explode ("|", $osnow);
if (eregi ($osnow[0], $os)) {
$endos = $osnow[1];
$check = "No";
} elseif ($check != "No") {
$endos = "Unknown";
}
}
/*
to output the OS, use $endos
to output the IP, use $ip
to output the resolved IP, use $resolved
*/
ImageTTFText ($image, 7, 0, 110, 90, $orange, $font, $text);
ImageTTFTEXT ($image, 7, 0, 105, 100, $orange, $font, "Your OS Is: $endos");
ImageTTFTEXT ($image, 6, 0, 2, 137, $orange, $font, $text3);
ImageTTFTEXT ($image, 7, 0, 100, 123, $orange, $font, $text2);
ImageTTFTEXT ($image, 7, 0, 120, 110, $orange, $font, "Viewed $views Times");
ImageTTFTEXT ($image, 7, 0, 107, 80, $orange, $font, "Uptime: Days $updays $uphours:$upminutes:$upsecs");
// output and destroy
imagepng($image);
imagedestroy($image);
?>
and yes I know I need to rewrite some of this it is not written very well
thank you for anyones input on this.