" . (time() - 60 * 60 * 24 * 31)); $user = mysql_result($r_user, 0); return $user; } function getnumposts() { global $pref; if( !$show ) { $query = "SELECT count(postid) As postcount FROM ".$pref."post As post, ".$pref."thread As thread,". $pref."board As board WHERE thread.threadid = post.threadid AND board.boardid = thread.boardid AND board.boarddisabled = 0"; } else { $query = "SELECT count(postid) AS postcount FROM ".$pref."post"; } $r_post = thwb_query($query); $post = mysql_result($r_post, 0); return $post; } function getdaystats() { global $pref; global $act_day; global $act_wday; global $act_month; global $act_year; global $wday; global $month_name; for( $i = 0; $i < 14; $i++ ) { $days[$i]['start'] = mktime(0, 0, 0, $act_month, $act_day - $i, $act_year); $days[$i]['end'] = mktime(0, 0, -1, $act_month, $act_day + 1 - $i, $act_year); } $i = 0; while( $i < 14 ) { $starttime = $days[$i]['start']; $endtime = $days[$i]['end']; $daystats[$i]['month'] = $wday[(int)date("w", $starttime)] . ", " . date("d", $starttime) . ". " . $month_name[(int)date("m", $starttime)] . " '" . date("y", $starttime); $daystats[$i]['user'] = mysql_result(thwb_query("SELECT count(userid) As usercount FROM ".$pref."user WHERE userjoin >= $starttime AND userjoin <= $endtime"), 0); $daystats[$i]['pm'] = mysql_result(thwb_query("SELECT sum(count) As pmcount FROM ".$pref."stats_pm WHERE pmcounttime >= $starttime AND pmcounttime <= $endtime"), 0); $daystats[$i]['view'] = mysql_result(thwb_query("SELECT sum(count) As viewcount FROM ".$pref."stats_view WHERE viewcounttime >= $starttime AND viewcounttime <= $endtime"), 0); $daystats[$i]['thread'] = mysql_result(thwb_query("SELECT count(threadid) As threadcount FROM ".$pref."thread WHERE threadcreationtime >= $starttime AND threadcreationtime <= $endtime"), 0); $daystats[$i]['posts'] = mysql_result(thwb_query("SELECT count(postid) AS postcount FROM ".$pref."post WHERE posttime >= $starttime AND posttime < $endtime"), 0); $daystats[$i]['totalview'] = $daystats[$i]['totalview'] + $daystats[$i]['view']; if (!$daystats[$i]['pm']) { $daystats[$i]['pm'] = 'N/A'; } if (!$daystats[$i]['view']) { $daystats[$i]['view'] = 'N/A'; } $i++; } return $daystats; } function getweekstats() { global $pref; global $act_day; global $act_wnum; global $act_month; global $act_year; global $month_name; for( $i = 0; $i < 12; $i++ ) { $today = date("w"); $weeks[$i]['start'] = mktime(0, 0, 0, $act_month, ($act_day - $i*7)-$today+1, $act_year); $weeks[$i]['end'] = mktime(0, 0, -1, $act_month, ($act_day + 7 - $i*7)-$today+1, $act_year); } $i = 0; while( $i < 12 ) { $starttime = $weeks[$i]['start']; $endtime = $weeks[$i]['end']; $weekstats[$i]['month'] = date("W", $starttime) . ". (" . $month_name[(int)date("m", $starttime)] . ")'" . date("y", $starttime); $weekstats[$i]['user'] = mysql_result(thwb_query("SELECT count(userid) As usercount FROM ".$pref."user WHERE userjoin >= $starttime AND userjoin <= $endtime"), 0); $weekstats[$i]['pm'] = mysql_result(thwb_query("SELECT sum(count) As pmcount FROM ".$pref."stats_pm WHERE pmcounttime >= $starttime AND pmcounttime <= $endtime"), 0); $weekstats[$i]['view'] = mysql_result(thwb_query("SELECT sum(count) As viewcount FROM ".$pref."stats_view WHERE viewcounttime >= $starttime AND viewcounttime <= $endtime"), 0); $weekstats[$i]['thread'] = mysql_result(thwb_query("SELECT count(threadid) As threadcount FROM ".$pref."thread WHERE threadcreationtime >= $starttime AND threadcreationtime <= $endtime"), 0); $weekstats[$i]['posts'] = mysql_result(thwb_query("SELECT count(postid) AS postcount FROM ".$pref."post WHERE posttime >= $starttime AND posttime < $endtime"), 0); $weekstats[$i]['totalview'] = $weekstats[$i]['totalview'] + $weekstats[$i]['view']; if (!$weekstats[$i]['pm']) { $weekstats[$i]['pm'] = 'N/A'; } if (!$weekstats[$i]['view']) { $weekstats[$i]['view'] = 'N/A'; } $i++; } return $weekstats; } function getmonthstats() { global $pref; global $act_month; global $act_year; global $month_name; for( $i = 0; $i < 24; $i++ ) { $months[$i]['start'] = mktime(0, 0, 0, $act_month - $i, 1, $act_year); $months[$i]['end'] = mktime(0, 0, -1, $act_month + 1 - $i, 1, $act_year); } $i = 0; while( $i < 24 ) { $starttime = $months[$i]['start']; $endtime = $months[$i]['end']; $monthstats[$i]['month'] = $month_name[(int)date("m", $starttime)] . " '" . date("y", $starttime); $monthstats[$i]['user'] = mysql_result(thwb_query("SELECT count(userid) As usercount FROM ".$pref."user WHERE userjoin >= $starttime AND userjoin <= $endtime"), 0); $monthstats[$i]['pm'] = mysql_result(thwb_query("SELECT sum(count) As pmcount FROM ".$pref."stats_pm WHERE pmcounttime >= $starttime AND pmcounttime <= $endtime"), 0); $monthstats[$i]['view'] = mysql_result(thwb_query("SELECT sum(count) As viewcount FROM ".$pref."stats_view WHERE viewcounttime >= $starttime AND viewcounttime <= $endtime"), 0); $monthstats[$i]['thread'] = mysql_result(thwb_query("SELECT count(threadid) As threadcount FROM ".$pref."thread WHERE threadcreationtime >= $starttime AND threadcreationtime <= $endtime"), 0); $monthstats[$i]['posts'] = mysql_result(thwb_query("SELECT count(postid) AS postcount FROM ".$pref."post WHERE posttime >= $starttime AND posttime < $endtime"), 0);; $monthstats[$i]['totalview'] = $monthstats[$i]['totalview'] + $monthstats[$i]['view']; if (!$monthstats[$i]['pm']) { $monthstats[$i]['pm'] = 'N/A'; } if (!$monthstats[$i]['view']) { $monthstats[$i]['view'] = 'N/A'; } $i++; } return $monthstats; } function getyearstats() { global $pref; global $act_year; for( $i = 0; $i < 14; $i++ ) { $years[$i]['start'] = mktime(0, 0, 0, 1, 1, $act_year - $i); $years[$i]['end'] = mktime(0, 0, -1, 1, 1, $act_year - $i + 1); } $i = 0; while( $i < 14 ) { $starttime = $years[$i]['start']; $endtime = $years[$i]['end']; $yearstats[$i]['month'] = date("Y", $starttime); $yearstats[$i]['user'] = mysql_result(thwb_query("SELECT count(userid) As usercount FROM ".$pref."user WHERE userjoin >= $starttime AND userjoin <= $endtime"), 0); $yearstats[$i]['pm'] = mysql_result(thwb_query("SELECT sum(count) As pmcount FROM ".$pref."stats_pm WHERE pmcounttime >= $starttime AND pmcounttime <= $endtime"), 0); $yearstats[$i]['view'] = mysql_result(thwb_query("SELECT sum(count) As viewcount FROM ".$pref."stats_view WHERE viewcounttime >= $starttime AND viewcounttime <= $endtime"), 0); $yearstats[$i]['thread'] = mysql_result(thwb_query("SELECT count(threadid) As threadcount FROM ".$pref."thread WHERE threadcreationtime >= $starttime AND threadcreationtime <= $endtime"), 0); $yearstats[$i]['posts'] = mysql_result(thwb_query("SELECT count(postid) AS postcount FROM ".$pref."post WHERE posttime >= $starttime AND posttime < $endtime"), 0); $yearstats[$i]['totalview'] = $yearstats[$i]['totalview'] + $yearstats[$i]['view']; if (!$yearstats[$i]['pm']) { $yearstats[$i]['pm'] = 'N/A'; } if (!$yearstats[$i]['view']) { $yearstats[$i]['view'] = 'N/A'; } $i++; } return $yearstats; } ################################################################### $pstats = array(); $sconf = array(); if( $g_user['userid'] != 0 ) { $r_pstats = thwb_query("SELECT userposts FROM $pref" . "user WHERE userid = '$g_user[userid]'"); $pstats = mysql_fetch_array($r_pstats); mysql_free_result($r_pstats); } $admin = thwb_query("SELECT userisadmin FROM $pref" . "user WHERE userid = '$g_user[userid]'"); $status = mysql_fetch_array($admin); $result = mysql_query("SELECT userjoin FROM $pref"."user ORDER by userjoin ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstactivation) = mysql_fetch_row($result); $astats['firstactivate'] = date("d.m.Y H:i",$firstactivation); } mysql_free_result($result); $result = mysql_query("SELECT posttime FROM $pref"."post ORDER by posttime ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstposttime) = mysql_fetch_row($result); $astats['firstposttime'] = date("d.m.Y H:i",$firstposttime); } $result = mysql_query("SELECT userjoin FROM $pref"."user ORDER by userjoin ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstmember) = mysql_fetch_row($result); $astats['firstmember'] = date("d.m.Y H:i",$firstmember); } $pmsread = 0; $pmsunread = 0; $r_allpms = mysql_query("SELECT count(*) FROM ".$pref."pm"); $allpms = mysql_result($r_allpms, 0); $r_pmsread = mysql_query("SELECT count(*) FROM ".$pref."pm WHERE pmflags = 0"); $pmsread = mysql_result($r_pmsread, 0); $r_pmsunread = mysql_query("SELECT count(*) FROM ".$pref."pm WHERE pmflags = 1"); $pmsunread = mysql_result($r_pmsunread, 0); $astats['allpms'] = $allpms; $astats['pmsread'] = round((($pmsread/$allpms)*100), 2). "%"; $astats['pmsunread'] = round((($pmsunread/$allpms)*100), 2). "%"; $result = mysql_query("SELECT pmcounttime FROM $pref"."stats_pm ORDER by pmcounttime ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstpmsent) = mysql_fetch_row($result); $astats['firstpmsent'] = date("d.m.Y H:i",$firstpmsent); } $result = mysql_query("SELECT viewcounttime FROM $pref"."stats_view ORDER by viewcounttime ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstview) = mysql_fetch_row($result); $astats['firstview'] = date("d.m.Y H:i",$firstview); } $result = mysql_query("SELECT pmtime FROM $pref"."pm ORDER by pmtime ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstpm) = mysql_fetch_row($result); $astats['firstpm'] = date("d.m.Y H:i",$firstpm); } $result = mysql_query("SELECT pmtoid FROM $pref"."pm ORDER by pmtime ASC LIMIT 1"); if (mysql_num_rows($result) == 1) { list($firstpmowner) = mysql_fetch_row($result); $u_result = mysql_query("SELECT username FROM $pref"."user WHERE userid = $firstpmowner"); $firstpmuser = mysql_fetch_array($u_result); $firstpmuser['username_hacked'] = str_replace($searcharray, $replacearray, $firstpmuser['username']); $firstpmuser['username_hacked'] = preg_replace('/[^\w\d_-]+/', '-', $firstpmuser['username_hacked']); $astats['firstpmowner'] = "$style[smallfont]".$firstpmuser['username']."$style[smallfontend]"; } $astats['usercount'] = getusercount(); $astats['activeusers'] = getactiveusers(); $astats['numposts'] = getnumposts(); $Thistory = new Template("templates/" . $style['styletemplate'] . "/stats_historyrow3.html"); $his = getdaystats(); $i = 1; $topbgcol = "$style[CellA]"; foreach( $his As $history ) { if( $history['posts'] >= 0 ) { $history['bgcolor'] = $topbgcol; eval($Thistory->GetTemplate("astats['history']")); $i++; if( $topbgcol == "$style[CellA]" ) { $topbgcol = "$style[CellB]"; } else { $topbgcol = "$style[CellA]"; } } } $Thistory = new Template("templates/" . $style['styletemplate'] . "/stats_historyrow3.html"); $his = getweekstats(); $i = 1; $topbgcol = "$style[CellA]"; foreach( $his As $history ) { if( $history['posts'] > 0 ) { $history['bgcolor'] = $topbgcol; eval($Thistory->GetTemplate("astats['whistory']")); $i++; if( $topbgcol == "$style[CellA]" ) { $topbgcol = "$style[CellB]"; } else { $topbgcol = "$style[CellA]"; } } } $Thistory = new Template("templates/" . $style['styletemplate'] . "/stats_historyrow3.html"); $his = getmonthstats(); $i = 1; $topbgcol = "$style[CellA]"; foreach( $his As $history ) { if( $history['posts'] != 0 ) { $history['bgcolor'] = $topbgcol; eval($Thistory->GetTemplate("astats['mhistory']")); $i++; if( $topbgcol == "$style[CellA]" ) { $topbgcol = "$style[CellB]"; } else { $topbgcol = "$style[CellA]"; } } } $Thistory = new Template("templates/" . $style['styletemplate'] . "/stats_historyrow3.html"); $his = getyearstats(); $i = 1; $topbgcol = "$style[CellA]"; foreach( $his As $history ) { if( $history['posts'] != 0 ) { $history['bgcolor'] = $topbgcol; eval($Thistory->GetTemplate("astats['yhistory']")); $i++; if( $topbgcol == "$style[CellA]" ) { $topbgcol = "$style[CellB]"; } else { $topbgcol = "$style[CellA]"; } } } $Tframe = new Template("templates/" . $style['styletemplate'] . "/frame.html"); $Tstats = new Template("templates/" . $style['styletemplate'] . "/stats3.html"); $navpath .= 'Statistikcenter'; eval($Tstats->GetTemplate("CONTENT")); eval($Tframe->GetTemplate()); ?>