<?php

######################################################################
# Modulo Splatt Forum per PHP-NUKE ver.5.X
#-------------------------
# Versione: 3.2
#
# Copyright (c) 2002 by:
#
# Giorgio Ciranni (~Splatt~)
# (http://www.splatt.it)
# (webmaster@splatt.it)
#
# Supporto tecnico disponibile sul Forum di www.splatt.it 
######################################################################
# Splatt Forum 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.
# Splatt Forum is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
# 02111-1307  USA
######################################################################

$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;


if (!eregi("modules.php", $PHP_SELF)) {
	die ("You can't access this file directly...");
    }

$module_name = "$name";

include("config.php");
include("modules/$module_name/functions.php");
include("modules/$module_name/auth.php");
include("header.php");


	echo"<table width=\"100%\"><tr><td align=\"left\">"
		."<img src=\"images/forum/forumlogo11.gif\" width=\"168\" height=\"84\" alt=\"Forum\"></td>"
	    ."<td><center><b>Statistiche dettagliate forum di: $sitename</b><br><br>"
		."</center><br></td></tr></table>";

if(!$result = mysql_query("SELECT * FROM ${prefix}_catagories ORDER BY cat_order"))
        die("<font size=+1>"._ERRORE1."</font><hr>"._UNABLETOQUERY."");
Opentable2();

		echo "Utenti maggiormente attivi...";
Closetable();
		echo"<table align=\"center\" border=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td align=\"center\">"
		   ."<table align=\"center\" border=\"0\" cellpadding=\"0\" width=\"100%\" BGCOLOR=\"$bgcolor2\"><tr><td align=\"left\">";
$a = 1;
$r = mysql_query("select uid,uname,user_posts from ".$user_prefix."_users where user_posts >= '5' order by user_posts desc");
while(list ($uid,$uname,$user_posts)= mysql_fetch_row($r)) 

{
echo"$a ) $uname - ($user_posts)<br>";
$a++;
}
//Closetable();

$a = 1;

$result = mysql_query("SELECT   t1.topic_id,t1.topic_title,t1.topic_time, t1.topic_views,t1.forum_id  FROM ${prefix}_forums t0,${prefix}_forumtopics t1   WHERE t0.forum_type = 0  AND t0.forum_id = t1.forum_id     ORDER BY t1.topic_views  DESC  LIMIT 0, 20");
while(list($topic_id, $topic_title, $topic_time, $topic_views, $forum_id) = mysql_fetch_row($result)) 

{
    $title2 = ereg_replace("_", " ", $topic_title);
	$title3 = substr("$title2", 0,35);
    $content1 .= "<strong><big>&middot;</big></strong>&nbsp;$a:&nbsp; <a href=\"modules.php?op=modload&name=$module_name&file=viewtopic&topic=$topic_id&forum=$forum_id \">$title2</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   ($topic_views)<br>";

$a++;
   
}
$contenuto = "<i><b><center></b></i></center><br> $content1<br>";
Opentable2();
echo"I messaggi pił letti";
Closetable();
Opentable();
echo"$content1";
Closetable();


$totale_topics = mysql_num_rows(mysql_query("SELECT * FROM ${prefix}_forumtopics"));
$totale_posts = mysql_num_rows(mysql_query("SELECT * FROM ${prefix}_posts"));
$mediarisposte = $totale_posts / $totale_topics;
Opentable2();
echo"Risposte medie per ogni discussione: $mediarisposte";
Closetable();

$totale_utenti_attivi = mysql_num_rows(mysql_query("SELECT * FROM ${prefix}_forumtopics"));

$tot_attivi = mysql_num_rows(mysql_query("select uid,uname,user_posts from ".$user_prefix."_users where user_posts >= '1'"));

$tot_user = mysql_num_rows(mysql_query("select uid,uname,user_posts from ".$user_prefix."_users where uid != '1'"));
Opentable2();
echo"Utenti totali registrati al sito: $tot_user <br> Utenti utilizzatori del forum: $tot_attivi";
Closetable();

echo"<p align=\"center\">Splatt Forum &copy; By: <a href=\"http://www.splatt.it\" target=\"_blank\">Splatt.it</a><br>Version: $forumver</font></p><br><br>";

$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
printf("<center><font size=-2>Elaboration time:  %f  seconds.</font></center><br>", $totaltime);
include("footer.php");
?>