Footer mod aanpassen
Geplaatst: 24 okt 2005, 19:04
Ik gebruik de mod Footer Mod
Deze mod geeft dit resultaat:
Deze mod geeft dit resultaat:
Hoe kan ik deze mod aanpassen zodat ook het record aantal opgevraagde pagina's word opgeslagen en weergegeven?:: [ Load Time: 1.4 Seconds ] :: [ 297 Queries ] :: [ 9,819 Page(s) Viewed Today. ] ::
:: [ Todays DB Queries: 1,866,250 ] :: [ Highest Query Load: 18,822,904 Queries on Oct. 23, 2005 ] ::
Code: Selecteer alles
#
# Table structure for table `phpbb_page_view_count`
#
CREATE TABLE `phpbb_page_view_count` (
`date` date NOT NULL default '0000-00-00',
`views` int(20) NOT NULL default '0'
) TYPE=MyISAM;
#
# Dumping data for table `phpbb_page_view_count`
#
INSERT INTO `phpbb_page_view_count` VALUES ('DATE_HERE', '0');
# --------------------------------------------------------
#
# Table structure for table `phpbb_todays_queries`
#
CREATE TABLE `phpbb_todays_queries` (
`total` int(100) NOT NULL default '0',
`date` date NOT NULL default '0000-00-00'
) TYPE=MyISAM;
#
# Dumping data for table `phpbb_todays_queries`
#
INSERT INTO `phpbb_todays_queries` VALUES ('0', 'DATE_HERE');
# --------------------------------------------------------
#
# Table structure for table `phpbb_top_queries`
#
CREATE TABLE `phpbb_top_queries` (
`total` int(100) NOT NULL default '0',
`day` int(11) NOT NULL default '0'
) TYPE=MyISAM;
#
# Dumping data for table `phpbb_top_queries`
#
INSERT INTO `phpbb_top_queries` VALUES ('0', '1084654229');
# --------------------------------------------------------
Code: Selecteer alles
#
#-----[ OPEN ]------------------------------------------
#
extension.inc
#
#-----[ FIND ]------------------------------------------
#
$starttime = 0;
#
#-----[ REPLACE WITH ]----------------------------------
#
// Added by Smartor - BEGIN
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
// Added by Smartor - END
#
#-----[ CLOSE & SAVE ]----------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE ADD ]------------------------------------
#
/* Start Page Views, Queries Today & Queries Top By aUsTiN (http://austin-inc.com/Blend) */
function UpdatePageView()
{
global $db, $table_prefix;
$q1 = "UPDATE ". $table_prefix ."page_view_count
SET views = views + 1";
$r1 = $db -> sql_query($q1);
return;
}
function SelectPageViewDate()
{
global $db, $table_prefix;
$q = "SELECT *
FROM ". $table_prefix ."page_view_count";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$pvd = $row['date'];
return $pvd;
}
function PageViewsToday()
{
global $db, $table_prefix;
$q = "SELECT *
FROM ". $table_prefix ."page_view_count";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$pvv = $row['views'];
return $pvv;
}
function ResetPageViews($date)
{
global $db, $table_prefix;
$q1 = "UPDATE ". $table_prefix ."page_view_count
SET views = '1', date = '$date'";
$r1 = $db -> sql_query($q1);
return;
}
function SelectQueries()
{
global $db, $table_prefix;
$q = "SELECT *
FROM ". $table_prefix ."todays_queries";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$tqd = $row['date'];
$otq1 = $row['total'];
$otq = number_format($otq1);
$q = "SELECT *
FROM ". $table_prefix ."top_queries";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$top_1 = $row['total'];
$top_d = $row['day'];
$set = strftime("%b. %d, %Y @ %H:%M:%S", $top_d);
$top_q = number_format($top_1);
$show_in_footer_today = "Todays DB Queries: $otq";
$show_in_footer_top = "Highest Query Load: $top_q Queries On $set";
$show_data = $show_in_footer_today ."/". $show_in_footer_top ."/". $tqd;
return $show_data;
}
function UpdateQueryCount($excuted_queries)
{
global $db, $table_prefix;
$q1 = "UPDATE ". $table_prefix ."todays_queries
SET total = total + $excuted_queries";
$r1 = $db -> sql_query($q1);
return;
}
function UpdateQueryTop($tqt, $excuted_queries)
{
global $db, $table_prefix;
$q1 = "UPDATE ". $table_prefix ."top_queries
SET total = '$tqt', day = '". time() ."'";
$r1 = $db -> sql_query($q1);
return;
}
function ResetTodaysQueries($excuted_queries, $date)
{
global $db, $table_prefix;
$q1 = "UPDATE ". $table_prefix ."todays_queries
SET total = '$excuted_queries', date = '$date'";
$r1 = $db -> sql_query($q1);
return;
}
function QueryDateCheck()
{
global $db, $table_prefix;
$q = "SELECT total
FROM ". $table_prefix ."todays_queries";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$tqt = $row['total'];
$q = "SELECT *
FROM ". $table_prefix ."top_queries";
$r = $db -> sql_query($q);
$row = $db -> sql_fetchrow($r);
$tq = $row['total'];
$qd = $row['day'];
$show_data = "$tqt,$tq,$qd";
return $show_data;
}
/* Finished Page Views, Queries Today & Queries Top By aUsTiN (http://austin-inc.com/Blend) */
#
#-----[ CLOSE & SAVE ]----------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
$template->set_filenames(array(
'overall_footer' => ( empty($gen_simple_header) ) ? 'overall_footer.tpl' : 'simple_footer.tpl')
);
#
#-----[ Add After ]-------------------------------------
#
/* Start Page Views, Queries Today & Queries Top By aUsTiN (http://austin-inc.com/Blend) */
/* Start © Smartors Page generation time for Admin only Hack */
$excuted_queries = $db -> num_queries;
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$gentime = round(($endtime - $starttime), 1);
/* End © Smartors Page generation time for Admin only Hack */
$date = date("Y-m-d");
$pvd = SelectPageViewDate();
if($pvd == $date)
{
UpdatePageView();
}
else
{
ResetPageViews($date);
}
$pvv = PageViewsToday();
$pvt = number_format($pvv);
$spvt = "$pvt Page(s) Viewed Today.";
$data_to_explode = SelectQueries();
$explode_it = explode("/", $data_to_explode);
$show_in_footer_today = $explode_it[0];
$show_in_footer_top = $explode_it[1];
$tqd = $explode_it[2];
if($tqd == $date)
{
UpdateQueryCount($excuted_queries);
$date_to_explode = QueryDateCheck();
$explode_it_2 = explode(",", $date_to_explode);
$tqt = $explode_it_2[0];
$tq = $explode_it_2[1];
$qd = $explode_it_2[2];
if($tqt > $tq)
{
UpdateQueryTop($tqt, $excuted_queries);
}
}
else
{
ResetTodaysQueries($excuted_queries, $date);
}
$template->assign_vars(array(
'GENERATION_TIME' => $gentime,
'NUMBER_QUERIES' => $excuted_queries,
'OVERALL_QUERIES_TODAY' => $show_in_footer_today,
'OVERALL_QUERIES_TOP' => $show_in_footer_top,
'OVERALL_PAGES_VIEWED' => $spvt,
)
);
$template->assign_block_vars('generation_time_switch', array() );
/* Finished Page Views, Queries Today & Queries Top By aUsTiN (http://austin-inc.com/Blend) */
#
#-----[ Close & Save ]----------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
templates/YOUR_TEMPLATE/overall_footer.tpl
#
#-----[ FIND / OR SIMILAR TO THIS ]---------------------
#
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} © 2002
#
#-----[ ADD AFTER ]-------------------------------------
#
<br />
:: [ Load Time: {GENERATION_TIME} Seconds ] :: [ {NUMBER_QUERIES} Queries ] :: [ {OVERALL_PAGES_VIEWED} ] ::
<br />
:: [ {OVERALL_QUERIES_TODAY} ] :: [ {OVERALL_QUERIES_TOP} ] ::
#
#-----[ CLOSE & SAVE ]----------------------------------
#
EoM