View Full Version : vbMicroStats: page load time, queries, GZIP and PHP version
NTLDR
04-13-2002, 05:07 PM
Thank you nakkid,
Its peope like you that make this such a great community to be part of :D
NTLDR
04-13-2002, 09:16 PM
I've just had a thought, I tried to run repair.php, I can't use that as it requires MySQL 3.23 or higher, I have MySQL 3.22.23 and PHP 4.1.2, could this be the problem, that this hack won't work with those versions?
According to vBulletin.com vBulletin shouldn't even run on that low of a version... I'd upgrade ASAP.
NTLDR
04-14-2002, 04:08 PM
I've got vBulletin working fine, I haven't had any problems with it, I've got to change host as my current one has provided me v.bad service lately.
Anyway, thanks to nakkid, I have got this hack working on my forums :D
He's a real creadit to the vb.org community, great hack and even better support, thank you nakkid.
credit? no. but thanks for the nice words. as for the help, i try to do as much as i can. i'm glad we got it working. ;)
ryanhulce
04-16-2002, 05:25 PM
This is a very cool hack thanks!
Originally posted by ryanhulce
This is a very cool hack thanks! glad you like it. ;)
Just installed it, looks great :D
But, I dont understand this part of the install instructions:+-----------------------------------------------+
| 'no template' Mod |
+-----------------------------------------------+
| Find this code:
+--------------------------------------------------------------------------+
eval("\$microstats = \"".gettemplate('home_microstats')."\";");
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
$microstats = "Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.<br>
$adminstats";
+--------------------------------------------------------------------------+It works fine without it, but im confused to what it does, and what 'no template' Mod means...
Anyway, keep up the good work :)
Alan (DWZ)
is for people who dont want to add a template, but instead to hard code it.. i do this all the time, i dont add templates. so i made it in 2 ways: for those who want a template based code or for those who want the actual php code. that's all. :)
Originally posted by nakkid
is for people who dont want to add a template, but instead to hard code it.. i do this all the time, i dont add templates. so i made it in 2 ways: for those who want a template based code or for those who want the actual php code. that's all. :) oh, ok cool :)
Thanks for your help :D
Humble Magii
04-22-2002, 02:59 AM
Hi could someone maybe help me... I am trying to get this to display on my main page. I am using vBPortal and it only shows the amount of queries everything else is blank if I use what is in the getmicrostats template. Anyone else try doing this yet or what? I have to insert this into the VBP config.php file in the footer section I know just dunno how to get it to display :). I don't have a footer template for VBP from what I can gather sifting thru my templates. Anyhoo thx for any help and nakkid you did a fine job.
mashby
04-22-2002, 04:04 PM
I'm trying to install this hack, but I'm running into a problem with the first edit. :ermm: In global.php I'm supposed to change
if (isset($showqueries)) {
$pagestarttime = microtime();
} else {
$pagestarttime = 0;
}
But in my global.php I have the following:
if (isset($explain)) {
$showqueries=1;
}
if (isset($showqueries)) {
$pagestarttime=microtime();
}
Before I proceeded, I wanted to check here and see what I should be replacing.
replace:if (isset($showqueries)) {
$pagestarttime=microtime();
}with:$pagestarttime=microtime();you probably dont have 225 installed. in the install file, read below the 225 segment, it will tell you how to install it for other versions.
mashby
04-23-2002, 01:00 PM
Nakkid - thanks for the fast reply.
According to my control panel, I have 2.2.5 installed. I always keep up with the latest version of vB. However, now that I'm adding hacks to the mix, I may delay installing them so fast and wait until I know that my small collection of hacks will work.
The point is, I do have the latest version of vB installed. So, if this code does not look kosher, then perhaps it did not install correctly?
I'm going ahead with the code snippet you gave me and proceed from there and I'll let you know how it goes. Everything else appears like it will work just fine.
Thanks again Nakkid.
ok.. let me know. i'm sure you will get it working perfectly. :)
just make sure you follow at letter the instructions, there is alot of code to be changed.
all the best,
nakkid.
mashby
04-24-2002, 02:12 AM
Nakkid,
Yes, thanks to your input the hack worked just fine. However, I've run into another bug with the register process, so I un-installed the hack just to make sure it wasn't your hack. It wasn't. :knockedout:
But it appears that the Country Flag Hack I installed the day before is the cultprit. So, once I track down the bug, I plan on re-installing your hack.
Thanks again for all your help and I'll let you know how it goes.
you are welcome mashby. ;)
tkeil69575
04-25-2002, 01:01 AM
hi nakkid,
I'm having the same problems NTLDR was having, my templates arent working anymore, as soon as I upload the new function.php. What was the fix for NTLDR - was it a provider problem?
greetings Tina
he wasnt sure how to insert the code into the files.
also he had a problem with the PHP version, he was running a really old one on his localhost. read more in the thread here. about what version he had.
contact your host and ask him to upgrade asap. older php code have bugs.
mashby
04-25-2002, 08:54 AM
Well, I found part of my problem. I re-installed 2.2.5 to clear out all the hacks and to make sure that everything was hack free.
I re-installed the Welcome Panel hack and then this hack. Everything appears to be ok, except now when I go into the Control Panel, I get nothing. No page renders at all.
Everything else appears to be working just perfectly. The stats are appearing on each page as expected, all other sections of the site are great, but I simply cannot access the Control Panel.
This is the source from the Control Panel
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
tkeil69575
04-25-2002, 10:08 AM
Originally posted by nakkid
he wasnt sure how to insert the code into the files.
also he had a problem with the PHP version, he was running a really old one on his localhost. read more in the thread here. about what version he had.
contact your host and ask him to upgrade asap. older php code have bugs.
Hi Nakkid,
thanks for your reply. I've read all that, but he doesnt really go into detail. Well, the newest verison of PHP is installed on my server, so that's not the problem. I do admit I have some hacks installed on 2.2.5 and I guess that's what's causing the problems. However, I dont want to miss out on those hacks. The hacks I have installed are the same ones FireFly has here and he's obviously got the vbmicrostats working, so theoretically there must be some way that it should also work for me ... It's really a pity that it's such a senstive, although cool script.
greetings Tina.
you edited admin/global.php
read carefully the install instructions.
Thomas P
04-26-2002, 05:53 PM
Hi,
thanks for this hack, great stuff. :)
cu,
-Tom
Hack installed in 0.87553499 minutes (80.31% Copy - 19.69% Paste) with 0 queries. ;)
Originally posted by tkeil69575
I dont want to miss out on those hacks. The hacks I have installed are the same ones FireFly has here and he's obviously got the vbmicrostats working, so theoretically there must be some way that it should also work for me... tina, the hack should not interfere with any other one.. it's all related to microtime.
Erwin
04-27-2002, 12:45 AM
I've got over a hundred hacks on my forum, and this hack does not interfere with any of them.
Admin
04-27-2002, 04:55 PM
nakkid, you are using an undefined constant in your code (DEBUG). This causes the "Debug Mode" flag to be on no matter what.
you are referring at $PHP_SELF? it doesnt really matter since i want to read the actual file i view. let me know if i'm correct.
Admin
04-27-2002, 05:17 PM
Originally posted by nakkid
yr referring at $PHP_SELF? it doesnt really matter since i want to read the actual file i view. let me know if i'm correct.
No, I am talking about DEBUG - a constand. You have in your code something like this:
$debug = (DEBUG) ? 'Debug Mode' : '';
Which is not correct, because there is no such constant. Not in PHP nor in vBulletin.
And since vBulletin runs on error reporting level of 7, PHP doesn't warn you and treats it as a string. And since that string always evaluates to TRUE, you will always get 'Debug Mode'.
you are right firefly... doughh.. :cross-eyed:
here it is what i did:
---------------------------------
in functions.php add $debug, before $microstats, like that:global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$deb ug,$microstats;then i inserted this code:if ($debug==0) {
$debugmode="";
} else {
$debugmode="(Debug mode)";should i use the define();? all i want to do is check what is the DEBUG mode on the apache server. let me know if the code is reliable. thanks.
Admin
04-28-2002, 10:05 AM
Apache's configuration has nothing to do with PHP. $debug is a variable set by vBulletin (well, the admin sets it in config.php if he wants to use debugging options). Debug mode refers to vBulletin, not PHP / the server.
ok.. i added the code above.
b-b00gie
04-30-2002, 04:37 AM
This hack is giving me so much trouble installing it... :-\
i'm getting the following error:
Parse error: parse error in /home2/public_html/forum/admin/functions.php on line 496
Fatal error: Call to undefined function: iif() in /home2/public_html/forum/admin/functions.php on line 351
I've gone over the install 20+ times. I verified that I made the correct changes and to the correct files.
If I undo the changes to functions.php (copy the text to replace from the install file) everything goes back to normal. When I replace the text I get the error again. :depressed:
I'm using 2.2.5 btw.
b-b00gie
04-30-2002, 04:49 AM
additionally...
this is my line 351 in functions.php
$usercache["$userid"]['showvbcode'] = iif(($usercache["$userid"]['options'])&SHOWVBCODE,1,0);
this is my line 496 in functions.php
// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {
global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$deb ug,$microstats;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
// time format (how many digits you want to show)
$digits=7;
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$trimmedtime=number_format($totaltime,$digits);
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100), 2)."% PHP";
$percentsql=number_format((($querytime/$totaltime)*100), 2)."% MySQL";
if ($bbuserinfo['usergroupid']==6) {
if ($gzipoutput==1) {
$gziptext="GZIP library compression enabled (level $gziplevel)";
} else {
$gziptext="GZIP library compression disabled";
}
if ($debug==1) {
$debugmode="(Debug mode)";
} else {
$debugmode="";
$versionphp=phpversion();
$adminstats="PHP version $versionphp $debugmode with $gziptext. [<a href=\"$PHP_SELF?explain=1\" target=\"_blank\">details</a>]";
} else {
$adminstats="";
}
if ($showqueries) {
$vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
} else {
$microstats = "Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.<br>
$adminstats";
}
Line 494: } else {
Line 495: $adminstats="";
Line 496: }
remove $debug from the global.
then remove: if ($debug==1) {
$debugmode="(Debug mode)";
} else {
$debugmode="";also remove $debugmode variable from $adminstats line... is useless information. i will mod the hack right now. this debug thing gave me only problems.
b-b00gie
04-30-2002, 06:42 PM
Originally posted by nakkid
remove $debug from the global.
then remove: if ($debug==1) {
$debugmode="(Debug mode)";
} else {
$debugmode="";also remove $debugmode variable from $adminstats line... is useless information. i will mod the hack right now. this debug thing gave me only problems.
That did it! No more error. :classic: It works great now.
i'm glad. congrats... and sorry, it was my mistake that code. it will work only if you have $debug enabled in config.php
b-b00gie
04-30-2002, 08:38 PM
Just a question... is there a way to limit the decimal places of the load time?
For example, I get something like: Page generated in .2973462 seconds...
Can I limit it to 2 or 3 decimal places somehow? not sure :\
// time format (how many digits you want to show)
$digits=7;change it to what value you want. if you want to show the last 4 digits, it should be $digits=4;
so it will look like: Page generated in 0.2973 seconds...
b-b00gie
04-30-2002, 10:48 PM
Silly mistake! I didnt see the variable... Thanks again for all your help.
;)
firefly, i noticed something related to your code addon for this hack. in your site, the PHP % is always smaller then the MySQL %.
the normal way is: your PHP value should always be bigger then the MySQL one (like it's supposed to be in EXPLAIN=1). everyone's page does that, except here at vB.org. just letting you know. if i'm wrong, correct me please.
b-b00gie
05-01-2002, 02:29 AM
Originally posted by nakkid
firefly, i noticed something related to your code addon for this hack. in your site, the PHP % is always smaller then the MySQL %.
the normal way is: your PHP value should always be bigger then the MySQL one (like it's supposed to be in EXPLAIN=1). everyone's page does that, except here at vB.org. just letting you know. if i'm wrong, correct me please.
Mine does the same thing. Take a look for yourself http://www.g20.net/forum reload as much as you wish.
My average is about .30 seconds to generate the page and 35% PHP and 65% SQL.
I think it may be because I have a dedicated mySQL server, its not on the localhost. :squareeyed:
b-b00gie
05-01-2002, 02:37 AM
Also, I looked at my $adminstats and on average I see something like...
Page generated in 0.26241195201874 seconds with 22 queries,
spending 0.18734097480774 doing MySQL queries and 0.075070977210999 doing PHP things.
The SQL is taking longer to generate than PHP. Again, most likely because my VB is connecting to a db on a seperate machine. Although it is still rather fast. :classic:
probably that's the case... :)
thanks for the info. i was just curious.
however, if i do this here, at vB.org (the EXPLAIN=1) it's telling me the viceversa, what is listed in %, at the bottom of the page.
Thomas P
05-04-2002, 12:44 PM
New db_mysql.php released:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=45395
i will change the file when VB226 will be oficially released. (today)
JoshFink
05-04-2002, 07:55 PM
I like this hack. Just out of curiousity, what is an "Ideal" number to get for PHP and MySql and how do they relate?
Boy was that vague.. :D
Thanks for the help,
Josh
it depends on your server. there are no ideal numbers. hope that helps.
regards,
nakkid.
Jawelin
05-04-2002, 09:19 PM
Originally posted by nakkid
it depends on your server. there are no ideal numbers. hope that helps.
Sorry, Nakkid. Many posts before, you talked about the number 40 as the maximum acceptable for queries on forumhome... (apart of VBPortal... w/ more than hundred...)
I have many hacks installed involving the first page, and now I'm round 43-45... And i'm working to something else... more! :cheeky:
Btw I still have numbers like:
Page generated in 0.65888 seconds
(34.21% PHP v4.1.2 + 65.79% MySQL v3.23.45)
with 43 queries. GZip level 1. [details] wich seem acceptable to me...
Actually, is there any reason for the limit under 40 ? Shall I be afraid of arriving till 50 ? :confused:
Thanks a lot.
Bye
i probably understood wrong the question. i thought he was referring at the %. :)
well, if i understood corectly from firefly, the more queries you have, the higher your server load will be. eventually, on a busy board it will bring the server to it's knees and your host will cancel your account. there are alot of people out there who have 150queries on a page, without even knowing.
so i set myself a goal not to have more then 40queries on a page. even 40, on a very busy board, is dangerously high. i'm talking about boards with 300-400 users online that activly post every second. if you have 50queries, that will kill your server, if not even crashing it.
the highest value will be arround 34queries, on my site. and that's the main page (vbHome full version).
Thomas P
05-04-2002, 10:00 PM
Originally posted by nakkid
i will change the file when VB226 will be oficially released. (today)
Thanks :)
-Tom
pipsy
05-05-2002, 01:38 AM
nothing happens when i put {getmicrostats} in my footer template :( all i see it '' {getmicrostats} '' on my page :(
i'm obviously doing something wrong. and i have no idea what.
pipsily yours.
i'm sorry but i can't do nothing about it. please check you code. there are alot of changes so one little mistake can ruin it all. good luck.
Originally posted by nakkid
i will change the file when VB226 will be oficially released. (today) I modified and applied the hack to the new db_mysql.php that was released and it's working fine. :)
thanks.. :)
however the details link will not work anymore in 226. is ok, i will add the code separately. i will need the ok from some of the gurus here, to make sure the code is secure. as soon as 226 is released i will look into it.
until then, FWC, can you post more details about the change? i didnt have a chance to look into it. thanks.
I used Beyond Compare to compare my old hacked file and the new one. I just copied over the parts I thought were necessary for your hack to work. Explain and showqueries are gone now so I left all of that stuff out. I'll take a look at it and post what I added.
OK, it looks like I changed this: function query($query_string) {
global $query_count;
// do query
$this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}
$query_count++;To this: function query($query_string) {
global $query_count,$querytime;
// do query
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;Now that I'm looking at it again, I don't think $showqueries and $explain are necessary in the global statement anymore.
they are unset? i didnt downloaded the new file. i wanted to wait for the 226 release. busy working on my website...
Yes, they are unset. I just took them out and everything seems to work fine.
can you edit the code above and remove them from global?
thanks.
NTLDR
05-05-2002, 06:18 PM
The update in Post 306 (above) (https://vborg.vbsupport.ru/showthread.php?postid=247955#post247955) also worked fine for me with the updated 2.2.6 db_mysql.php on vB 2.2.4
Thanks for the update ;)
Originally posted by NTLDR
The update in Post 306 (above) (https://vborg.vbsupport.ru/showthread.php?postid=247955#post247955) also worked fine for me with the updated 2.2.6 db_mysql.php on vB 2.2.4
Thanks for the update ;) I'm glad it's working for two of us. Beyond Compare came to the rescue. :)
freakyshiat
05-05-2002, 08:14 PM
The update in 306 is working for me also
KuraFire
05-06-2002, 08:50 AM
The update for the new db_mysql is working for me, too.
However, the hack itself wasn't properly working before that, nor is it now. My percentages are completely odd:
Page generated in 0.4714550 seconds (163.74% PHP / -63.74% MySQL) with 20 queries
Page generated in 1.6309210 seconds (-6.54% PHP / 106.54% MySQL) with 20 queries
Page generated in -0.6399480 seconds (36.72% PHP / 63.28% MySQL) with 20 queries
(percentages good, generation time negative... wow)
I even had 5K~ and -5K~ percentages, a few times.
WHAT AM I DOING WRONG?! :'(
I am using php version 4.0.4pl1 on my own computer, might this be the cause of the problem?
hmm kurafire. wierd, it looks like a previous version bug.. this is how i updated the new db_mysql.php (http://www.vbulletin.com/forum/attachment.php?s=&postid=285996):
find: function query($query_string) {
global $query_count;
// do query
$this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}
$query_count++;
return $this->query_id;
}replace it with: function query($query_string) {
global $query_count,$querytime,$pagestarttime;
// do query
$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;
return $this->query_id;
}and it's working perfectly. make sure you download the latest version and follow the steps in there, you probably have 1.6 installed. also get the latest php binaries. let me know please.
KuraFire
05-06-2002, 07:52 PM
I used your new code there, but it's still giving me freakish results.
I *did* 'adopt' a small change by FireFly because without it, my forum looked like a weird rainbow-thing. He said it was something to do with my low PHP version (4.0.4pl1) - might it be that this also caused the mess-up, or is it more logical that my php-version is the problem?
I tried installing new binaries of PHP but for some strange reason, the version never changed. I uninstalled and re-installed like 4 times, didn't work. :(
i know what is it!! upgrade your php binaries!! it hapened the same thing to another user who used PHP4.01. also make sure that your file says: vbMicroStats version 1.7
if it doesnt, delete all your temp files and download it again. let me know how it goes.
GOD-Dblade
05-07-2002, 12:21 AM
hm...anything working with the new update?
what do you mean anything working with the new update?
i do not understand. if you refer to the new db_mysql.php file, read above few posts...
ok, i placed a link on the first post.. so is easy for everyone to get the new db_mysql.php file and the hack update.
KuraFire
05-07-2002, 08:02 AM
nakkid: I'll try, though I think I have to uninstall apache, mysql & php all at once, before it'll work. Like I said, for some weird reason, upgrading didn't do jack sh** the past 4 times :(
*makes note to do this in the afternoon*
thx :)
tkeil69575
05-07-2002, 08:08 AM
Hallo Nakkid,
me again. Well I found out that my provider is not using the latest php. Hes still got php 4.0.4pl. So I guess thats my problem.
Ive asked him to install a newer version and he sais he will do soon but would like to know why. So sorry, but I have to ask you why. What version do I need and why?
regards Tina
the latest. soon it will be out 4.2
this hack was tested on PHP 4.1.2 (wich most providers have it installed).
actually, VB is not working properly on such low version of PHP.
KuraFire
05-07-2002, 08:29 AM
I'm using 4.0.4pl1 on my own system and vB is working fine on it...
it's this hack that isn't, but that's cos of the low version, but vB itself works. (I have 4 boards running on my comp, all for work-in-progress to produce 1 single board, online... :eek: )
i think there was an fervent discussion related to this at vb.com
tubedogg was telling people that VB will not work properly. honestly, i dont remember the version he mentioned, but it was something with 4.0.x
maybe one of the people here can let me know what is the lowest PHP version vB can run properly on it? thanks.
KuraFire
05-07-2002, 09:09 AM
4.0.4pl1 allows my vB to run perfectly fine.
So it has to be lower than that before vB _won't_ work, cos I have proof running in 4-fold (;)) that it works in 4.0.4pl1 :)
(though, I really have to upgrade to 4.1.2 ASAP...)
err... this hack had been working fine for the last few weeks or so, but I just noticed it says this these days:Page generated in 0.2891870 seconds (100.00% PHP - 0.00% MySQL) with 24 queries.0% MySQL?
Admin
05-07-2002, 12:25 PM
Originally posted by nakkid
i think there was an fervent discussion related to this at vb.com
tubedogg was telling people that VB will not work properly. honestly, i dont remember the version he mentioned, but it was something with 4.0.x
maybe one of the people here can let me know what is the lowest PHP version vB can run properly on it? thanks.
I don't know where you heard that, but vBulletin will run properly on 3.0.7 or even lower. Of course it won't have PCRE support but it will still run.
Admin
05-07-2002, 12:26 PM
Originally posted by DWZ
err... this hack had been working fine for the last few weeks or so, but I just noticed it says this these days:0% MySQL?
Hahaha you wish.
KuraFire
05-07-2002, 12:29 PM
You are using the new db_mysql.php file, look up in the past 20~ posts to see how to re-modify it. If you haven't added the new hack for the new db_mysql.php file, it'll show 100% php and 0% mysql constantly.
Originally posted by KuraFire
You are using the new db_mysql.php file, look up in the past 20~ posts to see how to re-modify it. If you haven't added the new hack for the new db_mysql.php file, it'll show 100% php and 0% mysql constantly. :D worked great, thanks :)
* DWZ should read thread next time :)
on that note, I never got an email to say this hack was updated :confused:
hi DWZ.. i didnt send an email, because 226 was not released.. :)
scubasteve
05-07-2002, 11:32 PM
thanks for the quick clarifications to the new db_mysql. i see the 'explain' function was removed, ostensibly because of a security concern - now i'm trying to figure out how that created insecurity ;)
anyways, thx for the update :)
oh, since it is disabled, you might want to change this line of code in admin/functions.php:
$adminstats="PHP version $versionphp with $gziptext. [<a href=\"$PHP_SELF?explain=1\" target=\"_blank\">details</a>]";
to
$adminstats="PHP version $versionphp $debugmode with $gziptext.";
i wait for the new VB226 release.. and i think i will add those back as part of the hack.. the tables. i will ask then firefly or anyone here who knows well VB security if the mod is reliable.
scubasteve
05-08-2002, 12:03 AM
:) sounds like a plan
Jawelin
05-08-2002, 08:19 AM
Hi. With the new modified db_mysql.php version (post #306), does someone have noticed an increment (BY 1, only...) of query counts ?
I switched, on the same forumhome page, from 40 to 41 queries (nakkid, grin!!! ;) ) right after the upload of such hacked file.
Thanks.
Bye
i just tried with the old file to do an explain=1. it's the same number of queries, in forumhome (i did a refresh on the page). maybe you forgot some template out of the equation? could be anything... let me know jawelin. curious on this.
Jawelin
05-08-2002, 05:10 PM
No.... :O
Simply I loaded my forumhome in the browser...
With that index.php page displayed, I uploaded the db_mysql.php file ONLY to server via FTP, and after the successful transfer i pressed the 'page reload' button.
Very very strange: before 40 queries, after (and now, since then) 41 !!! :)
It's just a mistery, not a problem, of course....
I've no time at the moment to investigate into db flow, but that's my black-box experiment.... :)
Thanks
let us know if you find out something. :)
Lethal
05-11-2002, 08:35 AM
Works great, thanks.
Page generated in 0.1183040 seconds (73.35% PHP - 26.65% MySQL) with 19 queries
Pauly
05-11-2002, 01:35 PM
can someone heeellllpppp me!1..lol
i have vb 2.2.5 installed on my pc along with mysql 3.23 & php 4.2.0 ....i have installed the hack but still getting 100 php and 0 mysql.....have checked the updated db_mysql.php ....but copy i have does not tally with copy that peeps have adjusted in this thread...is it just me?....can someone point me in right direction...cos its doing my nut in!! :) ...even if i do a fresh installl can u tell me what i need to do with db_mysql.php from scratch!!...sorry for being a little dumb!! gotta start somewhere!!
you probably have the old db_mysql.php file. make sure you download the new one from the link.
Jawelin
05-11-2002, 10:26 PM
Originally posted by nakkid
let us know if you find out something. :)
Actually I'm looking forward an help to make my 40+ queries dropped down under 30 .... ;)
But need a lot of help (see HERE (https://vborg.vbsupport.ru/showthread.php?s=&threadid=38471)) about optimisation... :bunny:
Could you give a look?
I would OUTER JOIN almost my queries on forumhome.... :squareeyed:
Thnx
Twig Deez
05-12-2002, 12:25 AM
updated version works fine for me.
thanks! :)
jjj0923
05-12-2002, 04:46 PM
I have 2.5 followed the instructions to the T and got this error:
Parse error: parse error in /usr/local/websites/fastboats/upload/global.php on line 271
Fatal error: Call to undefined function: getpermissions() in /usr/local/websites/fastboats/upload/index.php on line 10
this is have to do nothing with the vBMS hack.
pattox2k1
05-18-2002, 07:22 AM
ok guyz i need help here..........how do i put the microstats on a non-vB or vBportal page????? i have looked through the hacks code and cant work it out......plz help me?????
Boofo
05-18-2002, 08:54 AM
Can anyone tell me what this means and if I need to worry about it? I got it in the "details" in the footer where I have microstats running.
Cannot add header information - headers already sent by (output started at /home/virtual/site3/fst/var/www/html/forum/global.php:122) in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 1683
I don't have no-cache headers turned on, should I turn them on? Or does that have anything to do with anything? I'm not complaining, just curious. :)
details are not working with the new db_mysql.php.
i will release a new version once VB226 is out. until then you cannot use details.
regards,
nakkid.
Boofo
05-18-2002, 06:43 PM
I had to go back to the db_mysql.php file that came with 2.2.5 originally because the new one didn't have the code I needed to replace for microstats.
The details work fine, I just get that error in one of the listings on down the page in details. The rest of the details looks fine.
What does it mean, exacxtly, and how do I fix it, or do I need to worry about it?
your headers are sent twice by the script. that means you added something there in your file that calls twice the headers. a function, most probably.
look on the first post in this thread on how to update the newest db_mysql.php file.
Boofo
05-18-2002, 07:05 PM
Ok, did that and it is working. You're right, now the details don't work. :)
On the already sent header error, that is nothing to worry about right? I have no idea where or what to fix to change it. It won't mess anything up, right? Or does it add an extra query that really isn't needed?
Peabody
05-19-2002, 01:01 AM
Does this show for the members too? I don't like the idea of anyone knowing which verison of PHP I'm running, since there always a new vulnerability being discovered. :eek:
Boofo
05-19-2002, 03:32 AM
In a few posts back they said that the PHP and GZIP part of it (along with the details) only showed to the Admin (as long as the Admin was set to the default on your board, which is 6), so you're safe. :)
Erwin
05-23-2002, 07:17 AM
Just to confirm - with the new db_mysql, I cannot access ?showqueries=1 or ?explain=1 - no wonder! :)
you are correct erwin. due to some mods needed for php421, db_mysql.php was modified. i will drop that part when 226 is released. until then, i leave it like that. you can remove the link details, it will not work with the new file.
I'm sort of confused...
I have 2.2.5 installed with the PHP 4.2.0 version of db_mysql that I got of vb.com (from this thread: http://www.vbulletin.com/forum/showthread.php?s=&threadid=44820)
Now, uploading that deleted all the changes I had made to my old db_mysql file, so I just went back then to update the file so I dont get the 100% PHP and 0% MySQL error, and I cant find function query($query_string) {
global $query_count;
Now, what I did find was this: function query($query_string) {
global $query_count,$showqueries,$explain,$querytime;whic h looks like it already has part of this hack installed in it? The code below that also has bits of this hack in it....
Im really sort of confused here :\
What do I need to replace and with what to stop the 100% PHP / 0% MySQL thing?
DWZ, in the first post of this thread is a link with all the instructions necesary to download the new db_mysql.php file and also how to mod it.
ahh, ok, sorry :)
Done that and its working fine now :D
mtf169
05-25-2002, 10:05 PM
There was somebody several postings back that had the same exact problem I'm having now. I've tried installing this hack a dozen times with no success. I get all of the edits done and the one that seems to be breaking everything is:
while ($var=$DB_site->fetch_array($vars) and $i++) {
if ($var['findword']!="") {
$findwords[$i]=$var['findword'];
$replacewords[$i]=$var['replaceword'];
}
}
$newtext=str_replace($findwords,$replacewords,$new text);
The other guy posted this image which is exactly what's happening to me. How did he get this working?
https://vborg.vbsupport.ru/attachment.php?s=&postid=239359
Thanks.
By the way, I installed your vbhome(lite) and love it. Awesome hack.
ahh, the pic you show in the link was due to the PHP version. it was to old. what MySQL and PHP ver you run?
Originally posted by DWZ
Done that and its working fine now :D i'm glad you got it working. congrats.
mtf169
05-26-2002, 04:39 PM
Originally posted by nakkid
ahh, the pic you show in the link was due to the PHP version. it was to old. what MySQL and PHP ver you run?
I'm running this on my test server on windows, which is using the following:
MySQL 3.23.32
PHP 4.0.4
Apache 1.3.14
What's the minimum I need to get this to run? If I need to upgrade my php is it an easy process? I installed a free server package for windows by Nusphere, which had everything bundled together that I needed. My actual website server, which is shared, uses php 4.0.6. Obviously, I have no way to modify that.
ya. it was his prob too. he ran PHP404. can you upgrade to PHP412 at least? i did test it to this version. i'm not sure what is the lowest version you can get it to work, but it's working for PHP 4.2.1-4.1.2 versions.
mtf169
05-26-2002, 10:43 PM
I downloaded the newest php and installed it on my windows machine. Now the hack works flawlessly! Thanks for the help and the awesome hack. Now I just have to figure out if I can cut down some of the queries. :p
Keep up the good work!
Boofo
05-26-2002, 11:11 PM
It works with PHP 4.0.6 just fine, too. :)
Originally posted by nakkid
ya. it was his prob too. he ran PHP404. can you upgrade to PHP412 at least? i did test it to this version. i'm not sure what is the lowest version you can get it to work, but it's working for PHP 4.2.1-4.1.2 versions.
Smoothie
05-27-2002, 06:30 AM
Excellent work. Installed and working fine.
Originally posted by Boofo
It works with PHP 4.0.6 just fine, too. :)Thanks alot Boofo. at least we know for sure that the lowest working version for this hack is PHP4.0.6.
This will be handy for some users. I will post it in the starting post.
Also, I will release later on the update for VB226.
Boofo
05-28-2002, 01:48 AM
No problem, glad I can contribute in some way for such a great hack! :)
kennethj
05-28-2002, 08:30 PM
[i] I will release later on the update for VB226. [/B]
Works like a charm - tnks for the prommpt update :)
Erwin
06-01-2002, 08:09 AM
Beautiful.
Works with 2.2.6 without a problem. Thanks!
+-----------------------------------------------+
| FINAL STEPS |
+-----------------------------------------------+
| To call your vbMicroStats, simply place the string {getmicrostats}
| anywhere you want in your templates (for example in footer).
there's no need to call {getmicrostats} :confused:
replace
$microstats='Page generated in '.$trimmedtime.' seconds ('.$percentphp.' - '.$percentsql.') with '.$query_count.' queries.<br>'.$adminstats;
with
$vartext .='<center><smallfont>Page generated in '.$trimmedtime.' seconds ('.$percentphp.' - '.$percentsql.') with '.$query_count.' queries.<br></smallfont></center>'.$adminstats;
and no longer is needed template editing :paranoid:
Boofo
06-02-2002, 07:53 AM
If you did it this way, you wouldn't be able to decide where it goes. :) And where would it show up with the way you have it here?
Originally posted by nuno
there's no need to call {getmicrostats} :confused:
replace
$microstats='Page generated in '.$trimmedtime.' seconds ('.$percentphp.' - '.$percentsql.') with '.$query_count.' queries.<br>'.$adminstats;
with
$vartext .='<center><smallfont>Page generated in '.$trimmedtime.' seconds ('.$percentphp.' - '.$percentsql.') with '.$query_count.' queries.<br></smallfont></center>'.$adminstats;
and no longer is needed template editing :paranoid:
like this it goes below copyright text :)
Boofo
06-02-2002, 06:18 PM
I tried it but couldn't get it to display right. The second line (for Admin only) was in normalfont and spaced an extra line below the first line. When I tried to moved the center and smallfont, if gave me a blank page when I tried to load my site. :)
nuno, the {getmicrostats} variable is useful to users who want more control over their html code.
for example, if you have vbPortal installed, it will show ur stats in every block, if you do it your way.
Henry-RS
06-05-2002, 02:52 AM
$templatesused.=',pagenav,pagenav_curpage,pagenav_ firstlink,pagenav_lastlink,pagenav_nextlink,pagena v_pagelink,pagenav_prevlink';
That code, is not even in /forum/global.php >=(
Ahh, nevermind. I was just having one of those moments. :) :embarrased:
Jadelit
06-06-2002, 05:11 AM
I am getting this error..
Parse error: parse error, expecting `','' or `';'' in C:\Inetpub\****\board\admin\functions.php</b> on line 474
Fatal error: Call to undefined function: iif() in C:\Inetpub\****\board\admin\functions.php on line 352
im using vb 2.2.6
The Piper
06-09-2002, 08:53 PM
This script is really great, I have it working on my site and it's really useful. A suggestion I'd like to make: how about adding stats on the server loads as well?
Thanks a lot and congrats nakkid on an awesome script!
Paulo
thanks for your nice words. a quick thing.. i noticed you have 48queries on your main page. this is extremly high. over 40, your server goes on the red line, on a busy site.
The Piper
06-10-2002, 01:42 AM
Thanks for the advice, nakkid. Yeah, I'm trying to lower that. I took the polls off but it's still pretty high. I'm planning on reinstalling vbIndex because I'm running an older version, so I'll be able to mess up with the code a bit to try and lower that.
you could also look at vbHome. is a hack i dont support anymore, but worth a shot.
version 2.1 released. i added the Server Load. check the screenshot...
sorry guys but i cant send the email update. the list is to big and the browser times out.
please let me know if everything is ok with the new mod.
Boofo
06-22-2002, 02:05 AM
Can you list what code is updated in this release so we can just add the code we need for the new stuff if we already have it installed? :)
Originally posted by nakkid
version 2.1 released. i added the Server Load. check the screenshot...
sorry guys but i cant send the email update. the list is to big and the browser times out.
please let me know if everything is ok with the new mod.
change the '## Start dooutput ##' hack section only. the changes are there. :)
Boofo
06-22-2002, 02:24 AM
I did the section you said, but the server load doesn't show. :)
Originally posted by nakkid
change the '## Start dooutput ##' hack section only. the changes are there. :)
did you do it on your live server? it wont work if you do it on intranet.
also make sure the file says at the top:
vbMicrostats 2.1, not 2.0
Boofo
06-22-2002, 02:34 AM
What do you mean? Sorry, I guess I don't understand. :) Check out my site and you'll see what I mean.
My site (http://www.bearfacts2.com/forum/)
Originally posted by nakkid
did you do it on your live server? it wont work if you do it on intranet.
ok. you did it on your live site. good. well, go to your admin CP and let me know if you see the server load stats there.
make sure the vbMicrostats file is v2.1. at the top of the text file you have the version marked.
i noticed that if you download a new file it will cache it in your browser as the old one. you will need to delete all your temp files and cookies.
Upgrade to Version 2.1
Change only the code segment listed below in your v2.0:
File: FORUM/admin/functions.php
FIND:// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {
global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$mic rostats;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
// time format (how many digits you want to show)
$digits=8;
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$trimmedtime=number_format($totaltime,$digits);
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
$percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';
if ($bbuserinfo['usergroupid']==6) {
if ($debug==1) {
$debugmode='Debug Mode <font color="#E4630A">ON</font>';
} else {
$debugmode='Debug Mode OFF';
}
if ($gzipoutput==1) {
$gziptext='GZIP <font color="#E4630A">enabled</font> - level '.$gziplevel;
} else {
$gziptext='GZIP disabled';
}
$versionnum=phpversion();
$adminstats='<br>['.$debugmode.'] [PHP v'.$versionnum.'] ['.$gziptext.']';
} else {
$adminstats='';
}
if ($showqueries) {
$vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
} else {
eval("\$microstats = \"".gettemplate('home_microstats')."\";");
}REPLACE IT WITH:// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {
global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$mic rostats;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
// time format (how many digits you want to show)
$digits=8;
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$trimmedtime=number_format($totaltime,$digits);
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
$percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';
if ($bbuserinfo['usergroupid']==6) {
if ($debug==1) {
$debugmode='Debug Mode <font color="{ hovercolor }">ON</font>';
} else {
$debugmode='Debug Mode OFF';
}
if ($gzipoutput==1) {
$gziptext='GZIP <font color="{ hovercolor }">enabled</font> - level '.$gziplevel;
} else {
$gziptext='GZIP disabled';
}
$versionnum=phpversion();
if ($stats=@exec('uptime')) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload=' [Server Load: <font color="{ hovercolor }"><b>'.$regs[1].'</b></font> ? '.$regs[2].' : '.$regs[3].']';
}
$adminstats='<br>['.$debugmode.'] [PHP v'.$versionnum.'] ['.$gziptext.']'.$serverload;
} else {
$adminstats='';
}
if ($showqueries) {
$vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
} else {
eval("\$microstats = \"".gettemplate('home_microstats')."\";");
}Make sure you remove the spaces between the { hovercolor } brackets.
Boofo
06-22-2002, 02:50 AM
Where in my admin cp would I see this? And I replaced the code you suggested below before I wrote you the first time. :)
Originally posted by nakkid
ok. you did it on your live site. good. well, go to your admin CP and let me know if you see the server load stats there.
make sure the vbMicrostats file is v2.1. at the top of the text file you have the version marked.
i noticed that if you download a new file it will cache it in your browser as the old one. you will need to delete all your temp files and cookies.
ic. then your server doesnt allow you to view the stats. ask your host why.
you should see your server load on the main page where you see all the info and dev information.
vb is designed in a way that it will not show you the Average Server Load if your server is not set to do so.
here it is mine's (freddie's hack with server load integrated):
Boofo
06-22-2002, 03:03 AM
You're using Quick Stats, right? My Quick Stats doesn't even have the server load option in it. I checked my /admin/index.php and it isn't even listed in it. That really doesn't tell us anything if I don't have it there does it? :)
Originally posted by nakkid
ic. then your server doesnt allow you to view the stats. ask your host why.
you should see your server load on the main page where you see all the info and dev information.
vb is designed in a way that it will not show you the Average Server Load if your server is not set to do so.
here it is mine's (freddie's hack with server load integrated):
i know it doesnt. is me who add it there. but vB should have it separate. i just didnt like the way it looked so i made it compact.
Boofo
06-22-2002, 03:06 AM
Can you give me the code for it so I can add it and see? I have never seen it in the admin CP (I am still running 2.2.5 if that makes any difference). :)
Originally posted by nakkid
i know it doesnt. is me who add it there. but vB should have it separate. i just didnt like the way it looked so i made it compact.
there is nothing to add. is there the code, right below the quick stats table. it was always there in the admin panel since vb was created.
Boofo
06-22-2002, 03:30 AM
All I have below the quick stats is the Useful Admin Stuff box, nothing else.
contact your host and open a ticket at vb.com.
Boofo
06-22-2002, 04:16 AM
Why do I need to contact vb.com and make a ticket?
Originally posted by nakkid
contact your host and open a ticket at vb.com.
Smoothie
06-22-2002, 04:19 AM
Boofo-
When you first go to your admin index, you should see your server loads at the very top of the page, under useful admin stuff. Right in the middle of the page.
Boofo
06-22-2002, 04:21 AM
To tell you the truth, I don't recall EVER seeing that. :)
Originally posted by Smoothie
Boofo-
When you first go to your admin index, you should see your server loads at the very top of the page, under useful admin stuff. Right in the middle of the page.
Originally posted by Boofo
Why do I need to contact vb.com and make a ticket?to find out why your server load stats are not showing.
or even easier, ask in the vb.com troubleshooting forums.
Boofo
06-22-2002, 04:35 AM
It's probably because of one of the hacks I have installed in my admin/index.php? You're welcome to look at it if it will help. :)
Originally posted by nakkid
to find out why your server load stats are not showing.
just open a thread in the right place please. this hack have nothing to do with your problem. your problem is not related to the admin index.php, but to your host.
Boofo
06-22-2002, 04:42 AM
Then I guess contacting vb.com won't do any good either, huh? :) I don't need to open another thread for this. If it doesn't work, it doesn't work. Opening another thread ins't going to magically make it work.
Originally posted by nakkid
just open a thread in the right place please. this hack have nothing to do with your problem. your problem is not related to the admin index.php, but to your host.
they will guide you and tell you exacly what to ask your host related to this problem. is up to you what you do.
but this thread is certainly NOT the place to discuss your technical server problems.
when your host will enable the stats, you will have no more problems with the hack also.
good luck.
regards,
nakkid.
Boofo
06-22-2002, 04:50 AM
nakkid, until you told me I had server problems, I didn't know I did. I wasn't discussing technical problems in here. All I did was ask a couple of questions. That doesn't constitute a discussion. :) I will talk to my host and take care of it from there. Thanks for trying, anyway. :)
Originally posted by nakkid
they will guide you and tell you exacly what to ask your host related to this problem. is up to you what you do.
but this thread is certainly NOT the place to discuss your technical server problems.
when your host will enable the stats, you will have no more problems with the hack also.
good luck.
regards,
nakkid.
np. vBulletin team and your host will be able to help you better related to this matter.
let me know when you got it up and running. :)
Admin
06-22-2002, 05:49 AM
Originally posted by Nakkid
sorry guys but i cant send the email update. the list is to big and the browser times out.
please let me know if everything is ok with the new mod.
Next time let's not click Submit a hundred times... I got about 13-15 emails for this one.
At the bottom of my page it's giving me
"Page generated in 0.5792069 seconds (100.00% PHP - 0.00% MySQL) with 18 queries." every page is 100% PHP, is that good bad or what? What can I do to fix this? I know before it wasn't all PHP..
lubi.. this is related to your installation. make sure you followed all the steps properly. several people asked the same question here. :)
is alot of code to be changed. please be carefull. check your steps one by one and be SURE what files you edit. let me know if you got it working.
Originally posted by FireFly
Next time let's not click Submit a hundred times... I got about 13-15 emails for this one.lol... i imagine your face when you saw that.. sorry chen and everyone for this. i thought it didnt send the email...
Great hack Nakkid, thanks :), very useful too. I like the way it tells you how many queries are executed, it's convenient :)
bandersen
06-23-2002, 03:44 PM
Hi - I upgraded to 226 and installed this beauty :) No problems...
Except I need to contact my host to show the server load I guess.
i spoked with tubedogg and he was kind to explain to me that not all the servers will show the server load stats.
i will mention this on the first post. :)
Xelation
06-23-2002, 08:48 PM
is there a way to make it so that admins can only see the stats?
Originally posted by Nakkid
lubi.. this is related to your installation. make sure you followed all the steps properly. several people asked the same question here. :)
is alot of code to be changed. please be carefull. check your steps one by one and be SURE what files you edit. let me know if you got it working.
I looked but it was working before, then it just stopped suddenly and is always 100% php now.. :confused:
Originally posted by LuBi
I looked but it was working before, then it just stopped suddenly and is always 100% php now.. :confused: is related to the db_mysql.php mods...
Originally posted by Xelation
is there a way to make it so that admins can only see the stats? you mean the hole stats?
REPLACE:// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {
global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$mic rostats;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
// time format (how many digits you want to show)
$digits=8;
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$trimmedtime=number_format($totaltime,$digits);
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
$percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';
if ($bbuserinfo['usergroupid']==6) {
if ($debug==1) {
$debugmode='Debug Mode <font color="{ hovercolor }">ON</font>';
} else {
$debugmode='Debug Mode OFF';
}
if ($gzipoutput==1) {
$gziptext='GZIP <font color="{ hovercolor }">enabled</font> - level '.$gziplevel;
} else {
$gziptext='GZIP disabled';
}
$versionnum=phpversion();
if ($stats=@exec('uptime')) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload=' [Server Load: <font color="{ hovercolor }"><b>'.$regs[1].'</b></font> ? '.$regs[2].' : '.$regs[3].']';
} else {
$serverload='';
}
$adminstats='<br>['.$debugmode.'] [PHP v'.$versionnum.'] ['.$gziptext.']'.$serverload;
} else {
$adminstats='';
}
if ($showqueries) {
$vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
} else {
eval("\$microstats = \"".gettemplate('home_microstats')."\";");
}WITH:// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {
global $pagestarttime,$query_count,$showqueries,$querytim e,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$mic rostats;
$pageendtime=microtime();
$starttime=explode(" ",$pagestarttime);
$endtime=explode(" ",$pageendtime);
// time format (how many digits you want to show)
$digits=8;
$totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
$trimmedtime=number_format($totaltime,$digits);
$percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
$percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';
if ($debug==1) {
$debugmode='Debug Mode <font color="{ hovercolor }">ON</font>';
} else {
$debugmode='Debug Mode OFF';
}
if ($gzipoutput==1) {
$gziptext='GZIP <font color="{ hovercolor }">enabled</font> - level '.$gziplevel;
} else {
$gziptext='GZIP disabled';
}
$versionnum=phpversion();
if ($stats=@exec('uptime')) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload='[Server Load: <font color="{ hovercolor }"><b>'.$regs[1].'</b></font> ? '.$regs[2].' : '.$regs[3].']';
} else {
$serverload='';
}
if ($showqueries) {
$vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
} else {
$microstats='';
if ($bbuserinfo['usergroupid']==6) {
eval("\$microstats = \"".gettemplate('home_microstats')."\";");
}
}Your template should look like:Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.<br>
[$debugmode] [PHP v$versionnum] [$gziptext] $serverloadDon't forget to remove the spaces between hovercolor brackets.
Originally posted by Nakkid
is related to the db_mysql.php mods...
my db_mysql.php does not match the example you given orh ave I made the changes in your instructions..
that's why is not working. redownload again the vb226 from members area do the changes in your new db_mysql.php file.
let me know if you got it working. :)
Deep Blue
06-26-2002, 07:08 PM
OK, this is a weird one
I'm including a html file to use as a header using : require("http://www.invasionworks.com/includes/header.htm");
From the vB CP templates bit.
Now when i link directly to http://forums.invasionworks.com i get this error
Warning: Cannot add header information - headers already sent by (output started at /home/invasion/public_html/forums/global.php:2) in /home/invasion/public_html/forums/admin/functions.php on line 1610
but if i link to : http://forums.invasionworks.com/index.php?
it works without a hitch,
I'm using a fresh copy of vB, installed hacks, and then re uploaded modified files.
Any ideas?
Bro_Joey_Gowdy
06-27-2002, 03:46 AM
Nice hack...
Below are my stats -
Page generated in 4.45685601 seconds (100.00% PHP - 0.00% MySQL) with 22 queries.
[Debug Mode OFF] [PHP v4.1.2] [GZIP disabled]
are these good or bad ??
Deep Blue
06-27-2002, 05:57 AM
Ok, i know why that happens, if you go back a couple of pages in this thread that problem is explained, my forum looks awefull atm tho, with the header errors that im getting, any clues folks?
Originally posted by Bro_Joey_Gowdy
Nice hack...
Below are my stats - are these good or bad ?? you didnt hack the db_mysql.php file corectly.
Originally posted by Deep Blue
Ok, i know why that happens, if you go back a couple of pages in this thread that problem is explained, my forum looks awefull atm tho, with the header errors that im getting, any clues folks? is it a problem like wierd colors? what php version you use? or you get parse errors?
Boofo
06-27-2002, 09:04 PM
Nakkid,
My server load stats show now. Now will you give me the code for putting the load stats in the Admin Quik Stats? :)
Xelation
06-27-2002, 11:53 PM
how could I combine these two together?
// ###################### Start dovars #######################
function dovars($newtext,$sendheader=1) {
// parses replacement vars
global $DB_site,$replacementsetid,$gzipoutput,$gziplevel, $newpmmsg,$bbuserinfo;
static $vars;
if (connection_status()) {
exit;
}
if (!isset($vars)) {
$vars=$DB_site->query("SELECT findword,replaceword FROM replacement WHERE replacementsetid IN(-1,'$replacementsetid') ORDER BY replacementsetid DESC,replacementid DESC");
} else {
$DB_site->data_seek(0,$vars);
}
$findwords=array(0 => '{bbusername}');
$replacewords=array(0 => "$bbuserinfo[username]<!-- auto name hack -->");
$i=1;
while ($var=$DB_site->fetch_array($vars) and $i++) {
if ($var['findword']!='') {
$findwords[$i]=$var['findword'];
$replacewords[$i]=$var['replaceword'];
}
}
$newtext=str_replace($findwords,$replacewords,$new text);
and
// ###################### Start dovars #######################
function dovars($newtext,$sendheader=1) {
// parses replacement vars
global $DB_site,$replacementsetid,$gzipoutput,$gziplevel, $newpmmsg,$microstats;
static $vars;
if (connection_status()) {
exit;
}
if (!isset($vars)) {
$vars=$DB_site->query("SELECT findword,replaceword FROM replacement WHERE replacementsetid IN(-1,'$replacementsetid') ORDER BY replacementsetid DESC,replacementid DESC");
} else {
$DB_site->data_seek(0,$vars);
}
$findwords=array(0 => '{getmicrostats}');
$replacewords=array(0 => $microstats);
$i=1;
while ($var=$DB_site->fetch_array($vars) and $i++) {
if ($var['findword']!="") {
$findwords[$i]=$var['findword'];
$replacewords[$i]=$var['replaceword'];
}
}
$newtext=str_replace($findwords,$replacewords,$new text);
???
Originally posted by Boofo
Nakkid,
My server load stats show now. Now will you give me the code for putting the load stats in the Admin Quik Stats? :)
is best to ask in that thread this question, is not related to vbMicroStats. i will post there.
Originally posted by Xelation
how could I combine these two together?find:$findwords=array(0 => '{getmicrostats}');
$replacewords=array(0 => $microstats); replace it with:$findwords=array(0 => '{getmicrostats}', 1 => '{bbusername}');
$replacewords=array(0 => $microstats, 1 => $bbusername);
Bro_Joey_Gowdy
06-28-2002, 04:44 AM
Originally posted by Nakkid
you didnt hack the db_mysql.php file corectly.
Thanks for the help - I somehow skipped over that step
:rolleyes:
heres my stats now:
Page generated in 0.13275900 seconds (32.71% PHP - 67.29% MySQL) with 22 queries.
[Debug Mode OFF] [PHP v4.1.2] [GZIP disabled]
So are these good or bad ?
22queries is very good. :)
Bro_Joey_Gowdy
06-28-2002, 04:47 AM
so what would be considered 'bad' ?
over 30 is getting heavy... at 40-45, your server is on the red line and if you have a really busy board it can crash it.
Bro_Joey_Gowdy
06-28-2002, 04:56 AM
and theres nothing one can do to make the server quicker ?
(forgive me - im a newbie with databases)
no. think of this:
for every user, there are 22queries performed at that instance.
if you have 1000users on your board, that's 22,000queries performed on the same instance...
the best way is to keep as low as possible your queries.
is funny, since i released this hack, alot of people are concerned about the no. of queries... :)
with good reason. is healty for your server.
Bro_Joey_Gowdy
06-28-2002, 05:08 AM
Awesome !!
Thanks !!
:)
Boofo
06-29-2002, 07:12 PM
Where is that thread? :)
Originally posted by Nakkid
is best to ask in that thread this question, is not related to vbMicroStats. i will post there.
Gary King
06-29-2002, 08:46 PM
Referring to this post (https://vborg.vbsupport.ru/showthread.php?postid=265092#post265092), is it possible to only make SOME of the stats only visible to admins, while the rest is visible by everyone else? [Just like in your screenshot.]
mashby
06-30-2002, 06:06 AM
Well, I've enjoyed this hack so much, I've just installed it on a new forum I'm working on (2.2.6) and it installed like a piece of cake - as usual. Thanks nakkid! :D
Originally posted by Blak n Wite
Referring to this post (https://vborg.vbsupport.ru/showthread.php?postid=265092#post265092), is it possible to only make SOME of the stats only visible to admins, while the rest is visible by everyone else? [Just like in your screenshot.] that's what the hack does. the second line is visible only for admins. sign in as a regular user just to see...
Gary King
06-30-2002, 03:58 PM
Originally posted by Nakkid
that's what the hack does. the second line is visible only for admins. sign in as a regular user just to see...
I get an error when I apply this hack. It is the following:
Fatal error: Call to undefined function: query_first() in /home/public_html/forum/global.php on line 151
Line 151 contains the following:
$optionstemp=$DB_site->query_first("SELECT template FROM template WHERE title='options'");
What's the problem here? :confused:
Gary King
06-30-2002, 04:02 PM
For a quick solution to this problem while I find a way to make microstats work, I have simply replaced the *edited* db_mysql.php with the *original* one, and the board seems to work now. [Although the stats at the bottom of the page are mostly incorrect, of course].
can you post here what they look like the stats?
i will help you with your prob. thanks.
i also need to know what php version you run (important).
Gary King
06-30-2002, 11:39 PM
Originally posted by Nakkid
can you post here what they look like the stats?
i will help you with your prob. thanks.
i also need to know what php version you run (important).
What do you mean by what the stats looks like? Do you mean how it looks like when browsing the board? Or the code? :confused:
Also, I am running PHP version 4.2.1
Thx for helping :cool:
Gary King
07-01-2002, 03:18 AM
Originally posted by Nakkid
"Page generated in 0.55087197 seconds (29.08% PHP - 70.92% MySQL) with 17 queries."
your problem is related to db_mysql.php, so i presume the only prob you have is the 100%-0% showing. am i correct?
Yep, that is what's expected, and that's what I get .. which of course is highly inaccurate :ermm:
Any solution nakkid ?? :)
attach in a pm your original db_mysql.php file, i will modify it for you.
Gary King
07-01-2002, 03:27 AM
Originally posted by Nakkid
attach in a pm your original db_mysql.php file, i will modify it for you.
sent .. :D
Gary King
07-01-2002, 03:38 AM
thx nakkid !! the edited files seem to have fixed it :D
glad you got it working... :)
Gary King
07-01-2002, 03:19 PM
Originally posted by Nakkid
glad you got it working... :)
And oh btw, just sent ya a PM - my cable dropped last night while I attempted to send, so I just closed it :p
Kars10
07-02-2002, 09:21 AM
Hello Nakkid!!
In my /forum/global.php i can?t find the segment in the first step to change.
Heres my code, please check it out. ;)
Gary King
07-02-2002, 01:39 PM
@Minifreunde: Have you ever edited the file for another hack? What version of vB are you using? etc etc.. :p
Kars10
07-02-2002, 03:28 PM
@ Blak n Wite, version is 2.2.5. Have so many hacks, but ive looked on the orginal global.php and it looks the same to me. CanĀ“t find the lines to edit.... can i use this global-version with a modification?? Or some idea??
Kars10
07-02-2002, 05:51 PM
@ all! I?m stupid! It was my falt. Problem fixed, works perfect!!
Thanks Nakkid!!!
P.S. I click installed! ;)
Originally posted by Minifreunde
Hello Nakkid!!
In my /forum/global.php i can?t find the segment in the first step to change.
Heres my code, please check it out. ;)Minifreunde, please remove that code, you infringe the vB regulations about publishing the code... thanks.
link:
https://vborg.vbsupport.ru/showthread.php?postid=268233#post268233
Kars10
07-02-2002, 07:49 PM
@Nakkid, stupid from me! Sorry, code is delete! ;)
Gary King
07-02-2002, 09:19 PM
Originally posted by Minifreunde
@ all! I?m stupid! It was my falt. Problem fixed, works perfect!!
Thanks Nakkid!!!
P.S. I click installed! ;)
Glad you worked it out :)
Kars10
07-03-2002, 07:10 AM
@ B n W, thanx!! :)
Wildthinks
07-04-2002, 07:30 AM
http://www.2watch4.net/fehler.jpg Hi nakkid, awesome hack .. i like and i need it to optimize my queries... but problems :tired:
- alway server load = 00.00, i have the options *nix=0, but i set the option >0 then i get the follow message:
Screenshot error (http://www.2watch4.net/fehler.jpg)
it's reqiered that i have access to loadavg ?
- second point is, that my debug always off. i have turned on the option, that templatenames include in the page... that's the debug option isn't?
THX :cheeky:
Wildthinks:
1. contact your host for server issues. also let me know if you see the stats in the admin panel.
2. no. run a file with ?debug=1
trilOByte
07-04-2002, 07:27 PM
Thanks for this hack nakkid. I installed it yesterday and it worked perfectly, however, today I installe the xmenu hack (adding a java menu to the header) and now microstats reads....
Page generated in 1,025,814,268.73077905 seconds (100.00% PHP - 0.00% MySQL) with 37 queries.
[Debug Mode OFF] [PHP v4.2.1] [GZIP enabled - level 1] [Server Load: 0.34 ? 0.48 : 0.46];
Any ideas?
check your db_mysql.php file. there is your prob.. the microtime.
trilOByte
07-04-2002, 07:47 PM
OK, looking can't see the prob...
function query($query_string) {
global $query_count,$showqueries,$explain,$querytime,$pag estarttime;
// do query
$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"
???
What's the prob?
trilOByte
07-04-2002, 09:33 PM
Fixed...
Page generated in 0.25673795 seconds (73.55% PHP - 26.45% MySQL) with 36 queries.
User error as usual ;)
I hacked the wrong global.php file. Doof! :D
Thanks.
Gary King
07-04-2002, 10:00 PM
Originally posted by trilOByte
Fixed...
User error as usual ;)
I hacked the wrong global.php file. Doof! :D
Thanks.
Common mistake :)
Glad you got it working :D
Originally posted by trilOByte
I hacked the wrong global.php file. Doof! :D
Thanks. is it to high 36 queries? i think it is. is there a way you reduce them? like around 20-25 should be a good number.
Kars10
07-06-2002, 07:44 AM
Hi Guys!!
How can i reduce my Querys?? Ive got on index 38-39....
Please help! ;)
trilOByte
07-06-2002, 08:36 AM
is it to high 36 queries? i think it is. is there a way you reduce them? like around 20-25 should be a good number.
That's with the vBportal leftcolumn running, when I switch it off, I get:
Page generated in 0.20114601 seconds (65.73% PHP - 34.27% MySQL) with 21 queries.
Gary King
07-06-2002, 01:23 PM
I just tried and got this:
This page was brought to you in 0.14173198 seconds (84.24% PHP & 15.76% MySQL), with 30 queries!
trilOByte
07-06-2002, 02:40 PM
You mean you turned your portal leftcolumn off, and still get 30 queries on your forum/index.php?
Gary King
07-06-2002, 02:57 PM
Originally posted by trilOByte
You mean you turned your portal leftcolumn off, and still get 30 queries on your forum/index.php?
I don't have a portal for my vB. I just went to my index.php again, and got the following:
This page was brought to you in 0.14055097 seconds (84.13% PHP & 15.87% MySQL), with 30 queries!
:ermm:
a standard forumhome index.php page gets 17queries. that means you have inserted certain hack code that added 12 extra queries. that will affect your board performance and also it will flame down your server if you have a busy board.
i know that the new vb3 will have 12queries on forumhome. less queries you have, better it is.
the easiest way is to eliminate the double queries you might have. for example if you have a query in global.php that checks the new pm's is useless to add that query also in index.php since you perform it globaly.
check for guides like that and try to reduce it to a decent number. i personally think from talking to firefly that a decent number of queries should be 25. i will keep on my board the no. of queries under 20 always.
-Sidekick-
07-06-2002, 09:42 PM
I'm receiving extremely high numbers for the time the page loads. Stuff like 1,025,995,166.26833999 seconds. Though everything else works correctly. Any suggestions?
check your hacked code. you edited the wrong global.php file.
-Sidekick-
07-08-2002, 06:59 AM
I followed the instructions. :confused:
trilOByte
07-08-2002, 10:46 AM
I had this error, like Nakkid says, you hacked the wrong global.php file. There are two of them in different directories, you either hacked the wrong one, or uploaded to the wrong directory or something like that.
Check it out.
Spekkie
07-08-2002, 02:04 PM
Nice Hack Dude!
Spekkie, thanks.
-Sidekick-, did you get it working?
Schorsch
07-15-2002, 02:54 AM
thanks for the hack :)
I got these values:
Site generated in 1.14954901 seconds (17.90% PHP - 82.10% MySQL) with 25 queries.
[Debug Mode OFF] [PHP v4.0.6] [GZIP enabled - level 1]
are that normal values ??
and why don't I see the server load ?
thanks,
Schorsch
they look good to me, the values. for details related to your server load, please read the first post of this thread and contact your host.
let me know if you solve it. :)
X-Fan
07-15-2002, 04:27 PM
Just installed this, and now my vbPortals front page stops loading halfway through the last block on the left-hand side.
Help!!!
EDIT: Never mind, got it!
check your templates. the way is designed the hack, it will not interfere with any blocks.. due to {getmicrostats} variable. there are several users who installed this on phpportals without any problem.
X-Fan
07-15-2002, 04:38 PM
Got it working now...
Page generated in 3.88498294 seconds (7.21% PHP - 92.79% MySQL) with 55 queries.
55 queries... ouch :(
How can I find out why there's so many queries and how to cut that number down?
first congrats on get it working... :)
second, hmm there are your hacks that generate alot of queries. i personally think 55queries is huge, extremly high. your server gets on the red line at 40-45queries.
phportals are known for adding alot of queries. unfortunatelly there is nothing you can do about it, unless you disable as many options as you can.
a decent number of queries should be 25.
that's the only reason i didnt install phpportals. the extreme no. of queries.
btw, did you know that vB3 will have only 12queries? :)
X-Fan
07-15-2002, 04:56 PM
Which of the vbPortal options are we talking about, specifically?
(Just so I've got an idea of things I can try and reduce that huge number of queries!)
Gary King
07-15-2002, 04:59 PM
@X-Fan: I just visited your forums, and got this:
Page generated in 8.75267601 seconds (5.27% PHP - 94.73% MySQL) with 46 queries.
:eek::eek::eek:
Originally posted by X-Fan
Which of the vbPortal options are we talking about, specifically?
(Just so I've got an idea of things I can try and reduce that huge number of queries!) i have no idea. as i said, i never installed phpportals. i know about the options from other users who installed this hack and encountered the same prob as you.
Erwin
07-17-2002, 01:22 AM
I got my forum index page down to 15 queries. :D That is less than default. And I have LOTS of hacks running.
that's a great job there erwin. you probably tied the 3 pm queries into one, on forumhome page, that will take it down to 15. :)
i wonder how many queries vb3 will have on showthread? that's the only place where we see the highest number of queries performed.
Erwin
07-17-2002, 01:33 AM
My showthread has 18 queries - that is the bare minimum I can get it down to, without removing hacks I want.
X-Fan
07-17-2002, 02:44 AM
So Erwin, how did you do it? Any advice for us PHP newbies?
Erwin
07-17-2002, 06:14 AM
Make sure you include all your templates in the PHP file's templatesused=" " section. Each template called not in that section is one extra query.
Do a search for the word "query" in the file and then remove all queries that you can make do without. For example, I disabled invisibility, which means I can remove the queries for people browsing a forum etc. - it all adds up.
X-Fan
07-17-2002, 06:48 AM
I did that for my forums/index.php and it only reduced the number of queries by two.
Boofo
07-17-2002, 07:07 AM
How fo you tie those 3 queries together? Mind giving us the code to do it? :)
Originally posted by Nakkid
that's a great job there erwin. you probably tied the 3 pm queries into one, on forumhome page, that will take it down to 15. :)
i wonder how many queries vb3 will have on showthread? that's the only place where we see the highest number of queries performed.
Boofo
07-17-2002, 07:09 AM
What about the templates that don't always get used unless you link to it? Will including them hurt at all?
Originally posted by Erwin
Make sure you include all your templates in the PHP file's templatesused=" " section. Each template called not in that section is one extra query.
Do a search for the word "query" in the file and then remove all queries that you can make do without. For example, I disabled invisibility, which means I can remove the queries for people browsing a forum etc. - it all adds up.
Originally posted by Erwin
My showthread has 18 queries - that is the bare minimum I can get it down to, without removing hacks I want. is impossible. a showthread have 22 queries. unless you removed certain functions, you cant have 18queries. and your hacks you have installed dont perform any queries.
a showthread have 18-19queries when is an empty thread (no threads posted in the last 30days). as soon as you post once, it pops to 22.
firefly (who i'm pretty sure he started slowly to implement on this board vb3 code technique) have it at 29queries.
Originally posted by Boofo
How fo you tie those 3 queries together? Mind giving us the code to do it? :)
search the board. it was posted. or open a new thread in general hacking discussion.
Boofo
07-17-2002, 08:59 AM
I figured I'd get that answer from you. I just wanted to make sure you would react that way. You've proven yourself once again, my friend. Some things never change :)
did you noticed that nobody is answering you related to your 'deviated from thread' questions? in any post? why do you think we have several forums here?
firefly, i have an idea: delete all the forums and make only one ok? "full releases".
and yes, i dont forget when someone is calling me a liar in public.
Boofo
07-17-2002, 09:17 AM
Why don't you calm down, there, son? We all know how you get when you don't get your nap. :)
As far as being not on topic goes, if I remeber right, you brought it up in the first place when you basically called Erwin a liar.
And as far as you being called a liar, that was never actually said in the thread. But, then, you proved yourself when you added the fix from Neo to the file and kept the old version number on it. Do it once, do it again? :)
Firefly, did you catch that? He had an idea! Was it an original one, or someone else's rehash. Just curious. :)
Originally posted by Nakkid
did you noticed that nobody is answering you related to your 'deviated from thread' questions? why do you think we have several forums here?
firefly, i have an idea: delete all the forums and make only one ok? "full releases".
and yes, i dont forget when someone is calling me a liar in public.
you make me smile when you call me son.
the discussion with erwin was not off topic because it didnt involved any extra hacking that does interfere with this hack. it's simple information related to users experience with the hack, since they are able to actually see the number of queries performed.
your request involved a different hack that have nothing to do with vbmicrostats.
as far as our personal issues, is off topic from this hack. if you have any issues, open a new thread or use pm or email.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.