WHoops my bad, forgot I never put it up!!
Most read Today:
Code:
<script language="php">
/*
##############################################################################
# vBulletin Active Topics Version 0.25 #
##############################################################################
*/
/*
##############################################################################
# Load Required Variables #
##############################################################################
*/
include("admin/config.php");
include("class.FastTemplate.php3");
/*
##############################################################################
# Set initial directory to load templates from. #
##############################################################################
*/
$Template_Dir = ".";
/*
##############################################################################
# Set file to output to if post_to_file is equal to 1. #
##############################################################################
*/
$Post_File_Name = "mostread.txt";
/*
##############################################################################
# Initiate FastTemplate #
##############################################################################
*/
$displaytemplate = new FastTemplate("$Template_Dir");
$displaytemplate->strict();
/*
##############################################################################
# Setup initial settings if not specified on command line. #
##############################################################################
*/
if (isset($posts)) {
$num_active = intval($posts);
}
else {
$num_active = 10;
}
if (isset($length)) {
$num_chars = intval($length);
}
else {
$num_chars = 150;
}
if (isset($file)) {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
else {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
if (isset($forum)) {
$selected_forum = intval($forum);
$querylatest = "select * from thread where forumid='$selected_forum' and (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastpost))<35000 order by views desc limit $num_active";
}
else {
$querylatest = "select * from thread where (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastpost))<35000 order by views desc limit $num_active";
}
/*
##############################################################################
# Lets Setup and Connect to the Database #
##############################################################################
*/
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
/*
##############################################################################
# Generate SQL and Query Database #
##############################################################################
*/
$resultlatest = mysql_query($querylatest,$db);
/*
##############################################################################
# Lets Find the Latest Topics #
##############################################################################
*/
while ($latest_array = mysql_fetch_array($resultlatest)) {
/*
##############################################################################
# Go one-by-one through the result query. #
##############################################################################
*/
$query_forum = "select * from forum where forumid='$latest_array[forumid]'";
$result_forum = mysql_query($query_forum,$db);
$forum_info_array = mysql_fetch_array($result_forum);
/*
##############################################################################
# Split the Date to make it nicer. #
##############################################################################
*/
$datestr1 = substr($latest_array["dateline"],0,10);
$datetime = substr($latest_array["dateline"],11,8);
/*
##############################################################################
# Assign result info to template #
##############################################################################
*/
$displaytemplate->assign ("FORUMTITLE" , $forum_info_array["title"]);
$displaytemplate->assign ("POSTTITLE" , $latest_array["title"]);
$displaytemplate->assign ("POSTUSERNAME" , $latest_array["postusername"]);
$displaytemplate->assign ("POSTDATETIME" , $datetime);
$displaytemplate->assign ("POSTREPLYCOUNT" , $latest_array["replycount"]);
$querythread="select * from post where threadid='$latest_array[threadid]' order by dateline asc limit 1";
$result_thread_text= mysql_query($querythread,$db);
$result_thread_array = mysql_fetch_array($result_thread_text);
$displaytemplate->assign ("POSTICON" , $latest_array["iconid"]);
$displaytemplate->assign ("LASTPOSTER" , $latest_array["lastposter"]);
$displaytemplate->assign ("VIEWS" , $latest_array["views"]);
$Msg = substr(strip_tags($result_thread_array["pagetext"]),0,$num_chars);
$displaytemplate->assign ("POSTMESSAGE" , $Msg);
$displaytemplate->assign ("THREADID" , $latest_array["threadid"]);
$displaytemplate->parse ("FORUMINFO" , ".ActiveMessage");
}
/*
##############################################################################
# Parse the Data and Output the whole Page #
##############################################################################
*/
if ($post_to_file == 1) {
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaybody = $displaytemplate->fetch("GLOBAL");
$fp = fopen("$Post_File_Name", "w");
fwrite($fp, $displaybody);
fclose($fp);
exit();
}
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaytemplate->FastPrint();
exit();
</script>
Most read ever:
Code:
<script language="php">
/*
##############################################################################
# vBulletin Active Topics Version 0.25 #
##############################################################################
*/
/*
##############################################################################
# Load Required Variables #
##############################################################################
*/
include("admin/config.php");
include("class.FastTemplate.php3");
/*
##############################################################################
# Set initial directory to load templates from. #
##############################################################################
*/
$Template_Dir = ".";
/*
##############################################################################
# Set file to output to if post_to_file is equal to 1. #
##############################################################################
*/
$Post_File_Name = "mostreadever.txt";
/*
##############################################################################
# Initiate FastTemplate #
##############################################################################
*/
$displaytemplate = new FastTemplate("$Template_Dir");
$displaytemplate->strict();
/*
##############################################################################
# Setup initial settings if not specified on command line. #
##############################################################################
*/
if (isset($posts)) {
$num_active = intval($posts);
}
else {
$num_active = 5;
}
if (isset($length)) {
$num_chars = intval($length);
}
else {
$num_chars = 150;
}
if (isset($file)) {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
else {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
if (isset($forum)) {
$selected_forum = intval($forum);
$querylatest = "select * from thread where forumid='$selected_forum' order by views desc limit $num_active";
}
else {
$querylatest = "select * from thread order by views desc limit $num_active";
}
/*
##############################################################################
# Lets Setup and Connect to the Database #
##############################################################################
*/
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
/*
##############################################################################
# Generate SQL and Query Database #
##############################################################################
*/
$resultlatest = mysql_query($querylatest,$db);
/*
##############################################################################
# Lets Find the Latest Topics #
##############################################################################
*/
while ($latest_array = mysql_fetch_array($resultlatest)) {
/*
##############################################################################
# Go one-by-one through the result query. #
##############################################################################
*/
$query_forum = "select * from forum where forumid='$latest_array[forumid]'";
$result_forum = mysql_query($query_forum,$db);
$forum_info_array = mysql_fetch_array($result_forum);
/*
##############################################################################
# Split the Date to make it nicer. #
##############################################################################
*/
$datestr1 = substr($latest_array["dateline"],0,10);
$datetime = substr($latest_array["dateline"],11,8);
/*
##############################################################################
# Assign result info to template #
##############################################################################
*/
$displaytemplate->assign ("FORUMTITLE" , $forum_info_array["title"]);
$displaytemplate->assign ("POSTTITLE" , $latest_array["title"]);
$displaytemplate->assign ("POSTUSERNAME" , $latest_array["postusername"]);
$displaytemplate->assign ("POSTDATETIME" , $datetime);
$displaytemplate->assign ("POSTREPLYCOUNT" , $latest_array["replycount"]);
$querythread="select * from post where threadid='$latest_array[threadid]' order by dateline asc limit 1";
$result_thread_text= mysql_query($querythread,$db);
$result_thread_array = mysql_fetch_array($result_thread_text);
$displaytemplate->assign ("POSTICON" , $latest_array["iconid"]);
$displaytemplate->assign ("LASTPOSTER" , $latest_array["lastposter"]);
$displaytemplate->assign ("VIEWS" , $latest_array["views"]);
$Msg = substr(strip_tags($result_thread_array["pagetext"]),0,$num_chars);
$displaytemplate->assign ("POSTMESSAGE" , $Msg);
$displaytemplate->assign ("THREADID" , $latest_array["threadid"]);
$displaytemplate->parse ("FORUMINFO" , ".ActiveMessage");
}
/*
##############################################################################
# Parse the Data and Output the whole Page #
##############################################################################
*/
if ($post_to_file == 1) {
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaybody = $displaytemplate->fetch("GLOBAL");
$fp = fopen("$Post_File_Name", "w");
fwrite($fp, $displaybody);
fclose($fp);
exit();
}
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaytemplate->FastPrint();
exit();
</script>
|