<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
$bg1=BG_1;
	
$date = date("d.m.Y", time());
$dateyesterday = date("d.m.Y", time()-(24*3600));
$datemonth = date(".m.Y", time());
	
$ergebnis=safe_query("SELECT hits FROM ".PREFIX."counter");
$ds=mysql_fetch_array($ergebnis);
$us = mysql_fetch_array(safe_query("SELECT count(userID) FROM ".PREFIX."user"));
$us=$us[0];

$total=$ds[hits];
$dt = mysql_fetch_array(safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates='$date'"));
if($dt[count]) $today = $dt[count]; else $today = 0;

$dy = mysql_fetch_array(safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates='$dateyesterday'"));
if($dy[count]) $yesterday = $dy[count]; else $yesterday = 0;

$month=0;
$monthquery = safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates LIKE '%$datemonth'");
while($dm=mysql_fetch_array($monthquery)) {
 $month = $month+$dm[count];
}

$online = mysql_num_rows(safe_query("SELECT time FROM ".PREFIX."whoisonline"));
	
$guests = mysql_num_rows(safe_query("SELECT ip FROM ".PREFIX."whoisonline WHERE userID=''"));
$user = mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."whoisonline WHERE ip=''"));
$useronline = $guests + $user;
    
if($user==1) $user_on='1 user';
else $user_on=$user.' users';	
	
if($guests==1) $guests_on='1 guest';
else $guests_on= $guests.' guests';
	
eval ("\$stats = \"".gettemplate("stats")."\";");
echo $stats;
?>
