include("config.php");
$datum = date("d.m.Y",time());
$ip = getenv("REMOTE_ADDR");
$referer = substr(trim($_REQUEST["referer"]),0,249);
$thiswebsite = $_SERVER[SERVER_NAME];
if(!$ip) $ip = getenv("HTTP_X_FORWARDED_FOR");
if(!strpos(" ".$blacklist,$ip) && (strpos(substr($referer,0,strlen($referer)+5),$thiswebsite)<1)){
if($ip && $whois) {
include_once('phpwhois/whois.main.php');
include_once('phpwhois/whois.utils.php');
$whois = new Whois();
$result = $whois->Lookup($ip);
$provider = gethostbyaddr($ip);
if(!empty($result['rawdata'])) {
while(!$end==true){
$i++;
$provider = $result[rawdata][$i];
if(eregi("netname:",$provider)) $netname = strtolower(trim(substr(strrchr($provider,":"),1)));
if(eregi("descr:",$provider)){
$descr = strtolower(trim(substr(strrchr($provider,":"),1)));
$end = true;
}
if($i>50) $end = true;
}
}
$provider = $netname;
if($descr) $provider = $descr;
$ip = "- $ip
$provider";
}
$screen = substr(trim($_REQUEST["screen"]),0,249);
$color = substr(trim($_REQUEST["color"]),0,249);
$browser = getenv("HTTP_USER_AGENT");
$os = getenv("HTTP_USER_AGENT");
$con = mysql_connect($dbhost, $dbuser, $dbpass) or die("KEINE VERBINDUNG ZU DB-HOST");
mysql_select_db($dbname) or die("KANN DIE DB NICHT ÖFFNEN");
// UPDATE BESUCHER
$sql = "update phpcountersmart_besucher set tag = tag + 1 where datum = '$datum'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
// NEUER TAG?
if(!mysql_affected_rows($con)){
$sql = "insert into phpcountersmart_besucher set tag=1, datum = '$datum'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// REFERER
if($referer){
$sql = "insert into phpcountersmart_referer set woher = '$referer'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// SCREEN
if($screen){
$sql = "insert into phpcountersmart_screen set aufloesung = '$screen'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// PROVIDER
if($provider){
$sql = "insert into phpcountersmart_provider set provider = '$provider'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// COLOR
if($color){
if($color=="8") $color="256 $t_colors";
if($color=="16") $color="High Color (65536 $t_colors)";
if($color=="24") $color="True Color (16 M $t_colors)";
if($color=="32") $color="True Color 8-Bit (16 M $t_colors)";
$sql = "insert into phpcountersmart_color set tiefe = '$color'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// BROWSER
if($browser){
if (strpos($browser, "ozilla")) $browsertyp = "Mozilla";
if (strpos($browser, "pera")) $browsertyp = "Opera";
if (strpos($browser, "Firefox") || strpos($browser, "Firebird")) $browsertyp = "Firefox";
if (strpos($browser, "Firefox/1.5")) $browsertyp = "Firefox 1.5.x";
if (strpos($browser, "Firefox/2.")) $browsertyp = "Firefox 2.0.x";
if (strpos($browser, "MSIE")) $browsertyp = "Internet Explorer";
if (strpos($browser, "MSIE 5.")) $browsertyp = "Internet Explorer 5.x";
if (strpos($browser, "MSIE 6.")) $browsertyp = "Internet Explorer 6.x";
if (strpos($browser, "MSIE 7.")) $browsertyp = "Internet Explorer 7.x";
if (strpos($browser, "Netscape")) $browsertyp = "Netscape";
if (strpos($browser, "Camino")) $browsertyp = "Camino";
if (strpos($browser, "Galeon")) $browsertyp = "Galeon";
if (strpos($browser, "Konqueror")) $browsertyp = "Konqueror";
if (strpos($browser, "Safari")) $browsertyp = "Safari";
if (strpos($browser, "OmniWeb")) $browsertyp = "OmniWeb";
if (strpos($browser, "Flock")) $browsertyp = "Firefox Flock";
if (strpos($browser, "Lynx")) $browsertyp = "Lynx";
if (strpos($browser, "Mosaic")) $browsertyp = "Mosaic";
if (!isset($browsertyp)) $browsertyp = $notknowntype;
$sql = "insert into phpcountersmart_browser set typ = '$browsertyp'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// OS
if($os){
if (strpos($os, "Win95") || strpos($os, "Windows 95")) $ostyp = "Windows 95";
if (strpos($os, "Win98") || strpos($os, "Windows 98")) $ostyp = "Windows 98";
if (strpos($os, "WinNT") || strpos($os, "Windows NT")) $ostyp = "Windows NT";
if (strpos($os, "WinNT 5.0") || strpos($os, "Windows NT 5.0")) $ostyp = "Windows 2000";
if (strpos($os, "WinNT 5.1") || strpos($os, "Windows NT 5.1")) $ostyp = "Windows XP";
if (strpos($os, "WinNT 5.2") || strpos($os, "Windows NT 5.2")) $ostyp = "Windows 2003 Server";
if (strpos($os, "WinNT 6") || strpos($os, "Windows NT 6.0")) $ostyp = "Windows Vista";
if (strpos($os, "Linux")) $ostyp = "Linux";
if (strpos($os, "OS/2")) $ostyp = "OS/2";
if (strpos($os, "Sun")) $ostyp = "Sun OS";
if (strpos($os, "Macintosh") || strpos($os, "Mac_PowerPC")) $ostyp = "Mac OS";
if (!isset($ostyp)) $ostyp = $notknowntype;
$sql = "insert into phpcountersmart_os set typ = '$ostyp'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
// IP
if($ip){
$sql = "insert into phpcountersmart_ip set adresse = '$ip', zeit = '".time()."'";
mysql_query($sql) or die("SQL ERROR:
".$sql);
}
mysql_close($con);
}
header("Content-Type: image/gif");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
readfile("images/invisible.gif");
?>