PHPMyStats v 4.0.3
| ========================================
| door MrASCII en Willem van Leeuwen
| (c) 2004
|
http://www.mrascii.nl &
http://www.willemvanleeuwen.nl<?php
if($dontcount!="yes"){
?>
<iframe frameborder="0" width="0" height="0" src="user.php"></iframe>
<?php
}
?>
<?php
/*
------------------------------------------------------------------------------------
| PHPMyStats v 4.0.3
| ========================================
| door MrASCII en Willem van Leeuwen
| (c) 2004
|
http://www.mrascii.nl &
http://www.willemvanleeuwen.nl| ========================================
------------------------------------------------------------------------------------
*/
include("settings.inc.php");
$user = $GLOBALS[HTTP_USER_AGENT];
$refer = $GLOBALS[HTTP_REFERER];
$pagina = $_GET["pagina"];
if($pagina==''){
$pagina = $_SERVER["REQUEST_URI"];
}
$query = "SELECT * FROM ".$db_prfx."cms5_stats_pages WHERE( pagina='$pagina' )";
$result = mysql_db_query ( $db_name, $query, $conn );
if($result) {
while($rij = mysql_fetch_array($result)) {
$aantal = $rij[2];
}
}
if($dontcount!="yes"){
if(!$aantal) {
$debug = $debug . "<BR>$pagina toegevoegt aan database";
$query = "INSERT INTO ".$db_prfx."cms5_stats_pages VALUES ('0' , '$pagina' ,'1')";
$result = mysql_db_query ( $db_name, $query, $conn );
} else {
$aantal++;
$query = "UPDATE ".$db_prfx."cms5_stats_pages SET count='$aantal' WHERE (pagina='$pagina')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
}
// User string herstellen voor strpos
$user = " " . $user;
// Debug:
//$refer = "
http://www.google.nl/search?q=willem+van+leeuwen&ie=UTF-8&oe=UTF-8&hl=nl&lr=";// Kijken of er een referer is, met eventuele keywords
if($refer) {
$xx = strpos( $refer, "/" , 8);
$refer2 = substr($refer , 0, $xx);
if(strlen($refer) > 7 ) {
$site = substr( $refer, 0 , 18);
if($site == "
http://www.google." ) {
$xx = strpos( $refer, "?" , 7);
$xx2 = strpos( $refer, "&" , 7);
$keys = substr($refer, $xx + 3, ($xx2 - $xx) -3);
$keywords = explode( "+" , $keys);
if($keywords) {
foreach ($keywords as $woord) {
$query = "SELECT * FROM ".$db_prfx."cms5_stats_swords WHERE( woord='$woord' )";
$result = mysql_db_query ( $db_name, $query, $conn );
if($result) {
while($rij = mysql_fetch_array($result)) {
$aantal = $rij[2];
}
}
if(!$aantal) {
$debug = $debug . "<BR>$woord toegevoegt aan database";
$query = "INSERT INTO ".$db_prfx."cms5_stats_swords VALUES ('0' , '$woord' ,'1')";
$result = mysql_db_query ( $db_name, $query, $conn );
} else {
$aantal++;
$debug = $debug . "<BR>$woord is $aantal maal gebruikt";
$query = "UPDATE ".$db_prfx."cms5_stats_swords SET count='$aantal' WHERE (woord='$woord')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
}
}
}
}
}
/////////////////////
if($refer != "") {
$querys = "SELECT * FROM ".$db_prfx."cms5_stats_refer WHERE( refer='$refer' )";
$result = mysql_db_query ( $db_name, $querys, $conn );
if($result) {
while($rij = mysql_fetch_array($result)) {
$aantal = $rij[2];
}
}
if($dontcount!="yes"){
if(!$aantal) {
$debug = $debug . "<BR>$refer_site toegevoegt aan database";
$query = "INSERT INTO ".$db_prfx."cms5_stats_refer VALUES ('0' , '$refer' ,'1')";
$result = mysql_db_query ( $db_name, $query, $conn );
} else {
$aantal++;
$query = "UPDATE ".$db_prfx."cms5_stats_refer SET count='$aantal' WHERE (refer='$refer')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
}
} else {
$refer_site = "Geen referer";
}
///////////////
$browser = "Onbekend"; $img = "unknow.gif";
// De volgende strings zijn getest:
if(strpos($user, "Mozilla")) { $browser = "Mozilla"; $img = "mozzila.gif"; }
if(strpos($user, "Firebird")) { $browser = "Mozilla Firebird"; $img = "mozzila.gif"; }
if(strpos($user, "Firefox")) { $browser = "Mozilla Firefox"; $img = "mozzila.gif"; }
if(strpos($user, "Netscape")) { $browser = "Netscape"; $img = "ns.gif"; }
if(strpos($user, "Netscape6/")) { $browser = "Netscape 6"; $img = "ns.gif"; }
if(strpos($user, "Netscape/7.1")) { $browser = "Netscape 7.1"; $img = "ns.gif"; }
if(strpos($user, "Mozilla/4")) { $browser = "Netscape 4.0"; $img = "ns.gif";}
if(strpos($user, "MSIE")) { $browser = "Microsoft Internet Explorer"; $img = "ie.gif"; }
if(strpos($user, "MSIE 6.0")) { $browser = "Microsoft Internet Explorer 6"; $img = "ie.gif";}
if(strpos($user, "Opera")) { $browser = "Opera"; $img = "opera.gif"; }
// Volgende strings zijn niet getest:
if(strpos($user, "MSIE 5.0")) { $browser = "Microsoft Internet Explorer 5"; $img = "ie.gif";}
if(strpos($user, "MSIE 5.5")) { $browser = "Microsoft Internet Explorer 5.5"; $img = "ie.gif";}
if(strpos($user, "MSIE 4.0")) { $browser = "Microsoft Internet Explorer 4.0"; $img = "ie4.gif";}
if(strpos($user, "Konqueror")) { $browser = "Konqueror"; $img = "konqueror.gif";}
if(strpos($user, "SAGEM")) { $browser = "Sagem WAP"; $img = "gsm.gif";}
if(strpos($user, "Nautilus")) { $browser = "Nautilus"; $img = "nautilus.gif";}
if(strpos($user, "Lynx")) { $browser = "Lynx"; $img = "lynx.gif";}
if(strpos($user, "Galeon")) { $browser = "Galeon"; $img = "galeon.gif";}
if(strpos($user, "Safari")) { $browser = "Safari"; $img = "safari.gif";}
if(strpos($user, "Kameleon")) { $browser = "Kameleon"; $img = "kameleon.gif";}
$os = "Onbekend"; $img2="unknow.gif";
if(strpos($user, "Linux")) { $os = "Linux"; $img2="linux.gif";}
if(strpos($user, "Unix")) { $os = "Unix"; $img2="unix.gif";}
if(strpos($user, "Mac")) { $os = "MacOS"; $img2="mac.gif";}
if(strpos($user, "FreeBSD")) { $os = "FreeBSD"; $img2="freebsd.gif";}
if(strpos($user, "BEOS")) { $os = "BeOS"; $img2="beos.gif";}
if(strpos($user, "Windows"))
{
$os = "Windows"; $img2="windows.gif";
if(strpos($user, "95")) { $os = "Windows 95"; $img2="windows.gif";}
if(strpos($user, "98")) { $os = "Windows 98"; $img2="windows.gif";}
if(strpos($user, "SE")) { $os = "Windows 98SE"; $img2="windows.gif";}
}
if(strpos($user, "Windows NT 5.0")) { $os = "Windows 2000"; $img2="windows.gif";}
if(strpos($user, "Windows NT 5.1")) { $os = "Windows XP"; $img2="windows.gif";}
if(strpos($user, "Windows XP")) { $os = "Windows XP"; $img2="winxp.gif";}
if(strpos($user, "Windows NT 5.2")) { $os = "Windows Server 2003"; $img2="windows.gif";}
// Waarschijnlijke useragents:
if(strpos($user, "Windows NT 5.3")) { $os = "Windows Longhorn"; $img2="longhorn.gif";}
if(strpos($user, "Windows NT 5.4")) { $os = "Windows Blackcomb"; $img2="blackcomb.gif";}
$remoteip = $_SERVER['REMOTE_ADDR'];
$query = "SELECT * FROM ".$db_prfx."cms5_stats_ip WHERE( ip='$remoteip' )";
$result = mysql_db_query ( $db_name, $query, $conn );
if($result) {
while($rij = mysql_fetch_array($result)) {
$laatstetijd = $rij[2];
}
}
if(!$laatstetijd) {
$debug = $debug . "debug: onbekend ip: $remoteip $tijd";
$longisp = gethostbyaddr($remoteip);
$isp = explode(".", $longisp);
$isp = array_reverse($isp);
$ISP = $isp[1].".".$isp[0];
$expl = explode(".",$longisp);
$country = $expl[count($expl)-1];
if($dontcount!="yes"){
$query = "INSERT INTO ".$db_prfx."cms5_stats_ip VALUES ('0' , '$remoteip' ,'$tijd' ,'$ISP' ,'$country')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
}
$tijd = time();
$verschil = $tijd - $laatstetijd;
if($dontcount!="yes"){
$query = "UPDATE ".$db_prfx."cms5_stats_ip SET timestamp='$tijd' WHERE (ip='$remoteip')";
$result = mysql_db_query ( $db_name, $query, $conn );
$queryUVS = "INSERT INTO ".$db_prfx."cms5_stats_uvs VALUES ('0','$remoteip','$tijd','$pagina')";
mysql_db_query ( $db_name, $queryUVS, $conn );
}
if($verschil == 0) { $verschil = 400; }
//if($verschil > 300) { // 5 minuten IP blok
// Opslaan van de huidige pageview
$os2 = $os;
if($os2=="Onbekend") { $os2 = "unknown"; }
$browser2 = $browser;
if($browser2=="Onbekend") { $browser2 = "unknown"; }
$query = "SELECT * FROM ".$db_prfx."cms5_stats_browser WHERE (browser='$browser2')";
$result = mysql_db_query ( $db_name, $query, $conn );
while($rij = mysql_fetch_array($result)) {
$t = $rij[2] + 1;
}
if($t==1) { $debug = $debug . "<BR>debug: onbekende browser: $browser2"; }
if($dontcount!="yes"){
$query = "UPDATE ".$db_prfx."cms5_stats_browser SET count='$t' WHERE (browser='$browser2')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
$query = "SELECT * FROM ".$db_prfx."cms5_stats_os WHERE (os='$os2')";
$result = mysql_db_query ( $db_name, $query, $conn );
while($rij = mysql_fetch_array($result)) {
$t = $rij[2] + 1;
}
if($t==1) { $debug = $debug . "<BR>debug: onbekende os: $browser2 $os2"; }
if($dontcount!="yes"){
$query = "UPDATE ".$db_prfx."cms5_stats_os SET count='$t' WHERE (os='$os2')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
$vandaag = date("d-m-Y");
$query = "SELECT * FROM ".$db_prfx."cms5_stats_visits WHERE (datum='$vandaag')";
$result = mysql_db_query ( $db_name, $query, $conn );
if($result) {
while($rij = mysql_fetch_array($result)) {
$aantalvisits = $rij[2];
}
}
if($dontcount!="yes"){
if(!$aantalvisits) {
$query = "INSERT INTO ".$db_prfx."cms5_stats_visits VALUES ('0' , '$vandaag' ,'1')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
$new = $aantalvisits + 1;
$query = "UPDATE ".$db_prfx."cms5_stats_visits SET count='" . $new . "' WHERE (datum='$vandaag')";
$result = mysql_db_query ( $db_name, $query, $conn );
}
// }
?>