+-----------------------------------------------+
| vB Load Time, Queries Execution, |
| PHP and MySQL Percent Page Usage, |
| GZIP Compression and PHP Version MICROSTATS |
| Version 1.2 |
+-----------------------------------------------+
| By Nakkid (vBulletin.org hacker)
| Email(Messenger): [email]nakkidone@hotmail.com[/email]
| 4463Sm9obldvbw==
|
+-----------------------------------------------+
| CREDITS |
+-----------------------------------------------+
| Chen \'FireFly\' Avinadav
| PHP and MySQL percentage addon.
|
+--------------------------------------------------------------------------+
| This hack will add at the bottom of each vBulletin(powered) page the |
| following stats: |
| |
| - load time of specified page in microseconds |
| - number of queries executed |
| - PHP percent page usage |
| - MySQL percent page usage |
| - browser GZIP library compression status |
| - server PHP version |
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| FILES TO MODIFY:
+--------------------------------------------------------------------------+
| forum/admin/db_mysql.php
| forum/admin/functions.php
+--------------------------------------------------------------------------+
|
|
+-----------------------------------------------+
| INSTALL STEPS |
+-----------------------------------------------+
|
+-----------------------------------------------+
| File: forum/admin/db_mysql.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
if ($showqueries) {
echo "Query: $query_string\\n";
global $pagestarttime;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$beforetime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
echo "Time before: $beforetime\\n";
}
$this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}
$query_count++;
if ($showqueries) {
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$aftertime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$querytime+=$aftertime-$beforetime;
echo "Time after: $aftertime\\n";
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
global $pagestarttime;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$beforetime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}
$query_count++;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$aftertime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$querytime+=$aftertime-$beforetime;
if ($showqueries) {
echo "Query: $query_string\\n";
echo "Time before: $beforetime\\n";
echo "Time after: $aftertime\\n";
+--------------------------------------------------------------------------+
|
|
+-----------------------------------------------+
| File: forum/admin/functions.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
if ($showqueries) {
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$vartext.="<!-- Page generated in $totaltime seconds with $query_count queries -->";
}
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
$totaltime=$endtime[0]-$starttime[1];
// time format (how many digits you want to show)
$digits="7";
$trimmedtime=number_format($totaltime,$digits);
if (strstr($HTTP_SERVER_VARS[\'HTTP_ACCEPT_ENCODING\'], \'gzip\')) {
$gziptext=" with GZIP compression library enabled";
} else {
$gziptext=" with GZIP compression library disabled";
}
$debugmode=(DEBUG)?"(Debug mode)":"";
$versionphp=phpversion();
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100), 2)."% PHP";
$percentsql=number_format((($querytime/$totaltime)*100), 2)."% MySQL";
$vartext.="<center><smallfont>Page generated in $trimmedtime ($percentphp - $percentsql) seconds with $query_count queries.
PHP version $versionphp $debugmode$gziptext.</smallfont></center>";
+--------------------------------------------------------------------------+
|
|
+-----------------------------------------------+
| FINAL STEPS |
+-----------------------------------------------+
|
| The variables you can use are:
|
| $digits - number of digits for microtime
| $trimmedtime - the time your page is loaded
| $query_count - number of queries executed
| $versionphp - PHP version
| $percentphp - PHP percent page usage
| $percentsql - MySQL percent page usage
| $gziptext - GZIP compression library
| $debugmode - script Debug mode
|
| NOTE: If you want to have more(less) then 7 digits in your microtime, change
| value 7 to what ever suits better your forum.
|
|
| Upload the modified file. You are done.
+--------------------------------------------------------------------------+