<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/*                                                                      */
/* NPDS Copyright (c) 2002-2007 by Philippe Brunier                     */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
if (!function_exists("Mysql_Connexion")) {
   include ("mainfile.php");
}

global $admin, $not_admin_count;
if ((!$admin) or ($not_admin_count!=1)) {
   $user_agent=getenv("HTTP_USER_AGENT");

   if((strstr($user_agent,"Nav")) || (strstr($user_agent,"Gold")) || (strstr($user_agent,"X11")) || (strstr($user_agent,"Mozilla")) || (strstr($user_agent,"Netscape")) AND (!strstr($user_agent,"MSIE"))) $browser = "Netscape";
   elseif(strstr($user_agent,"MSIE")) $browser = "MSIE";
   elseif(strstr($user_agent,"Lynx")) $browser = "Lynx";
   elseif(strstr($user_agent,"Opera")) $browser = "Opera";
   elseif(strstr($user_agent,"WebTV")) $browser = "WebTV";
   elseif(strstr($user_agent,"Konqueror")) $browser = "Konqueror";
   elseif((strstr($user_agent,"bot")) || (strstr($user_agent,"Google")) || (strstr($user_agent,"Slurp")) || (strstr($user_agent,"Scooter")) || (strstr($user_agent,"Spider")) || (strstr($user_agent,"Infoseek"))) $browser = "Bot";
   else $browser = "Other";

   if(strstr($user_agent,"Win")) $os="Windows";
   elseif((strstr($user_agent,"Mac")) || (strstr($user_agent,"PPC"))) $os = "Mac";
   elseif(strstr($user_agent,"Linux")) $os = "Linux";
   elseif(strstr($user_agent,"FreeBSD")) $os = "FreeBSD";
   elseif(strstr($user_agent,"SunOS")) $os = "SunOS";
   elseif(strstr($user_agent,"IRIX")) $os = "IRIX";
   elseif(strstr($user_agent,"BeOS")) $os = "BeOS";
   elseif(strstr($user_agent,"OS/2")) $os = "OS/2";
   elseif(strstr($user_agent,"AIX")) $os = "AIX";
   else $os = "Other";

   global $NPDS_Prefix;
   sql_query("update ".$NPDS_Prefix."counter set count=count+1 where (type='total' and var='hits') or (var='$browser' and type='browser') or (var='$os' and type='os')");
}
?>