PDA

View Full Version : vbMicroStats: page load time, queries, GZIP and PHP version


Pages : 1 2 [3] 4

Boofo
07-17-2002, 09:28 AM
Then you might want to take your own advice and do the same in the future, when you start to ramble elsewhere in a thread. ;) And unless I missed something somewhere, I don't think you were made a moderator here, yet. If that sad day ever happens, I guess I'll have to "find a new place to dwell, uh-huh!" :)

'Nuff said. I'm done.

Originally posted by Nakkid
you make me smile when you call me son.
and this is off topic from this hack. if you have any issues, open a new thread or use pm or email.

TECK
07-17-2002, 09:35 AM
Originally posted by Boofo
Then you might want to take your own advice and do the same in the future, when you start to ramble elsewhere in a thread...np. i will pay attention to this. thanks.
so far i discussed only issues related to the specific thread, anywhere. btw, that's have nothing to do with being a moderator, is with being efficient. basically you save time if you do a search and if you dont find it, simply ask. people will answer you. i know i will, even if you dont believe it.
as for your query question, try this search: "tie pm query", you will be amased...

Boofo
07-17-2002, 10:40 AM
Doesn't work. pm is only 2 letters. Thanks, anyway. :)

Originally posted by Nakkid
as for your query question, try this search: "tie pm query", you will be amased...

TECK
07-17-2002, 10:43 AM
i send you a pm with all the info you need.

Admin
07-17-2002, 12:55 PM
Are we all friends again? Don't let it happen again.

Martin64
07-21-2002, 01:45 PM
Seems like a very useful hack - I'll give it a shot. :)

Martin64
07-21-2002, 02:26 PM
Installed and works like a charm :). This is probably the most useful hack I have on my boards, and I think a lot of fellow vBulletin owners agree with that, especially if they are using servers that are being pushed to their limits. This is perfect, now I can keep an eye on the server load and at the same time browse the boards. :D

TECK
07-21-2002, 06:24 PM
martin64, i looked at your site and i noticed you didnt hacked properly the db_mysql.php file, that's why you have 100% and 0% values. please double check the steps in that file.

Martin64
07-21-2002, 06:49 PM
Okay, thanks. I overwrote some files and had to re-add my 3 most recently added hacks so that's probably why I missed it. I don't know what went wrong, but I had to download the 2.2.6 package again and overwrite my old files. :hurt:

It was working earlier, I just hadn't noticed yet. Thanks once again. :D

Edit: fixed. :cool:

Erwin
07-21-2002, 07:47 PM
Originally posted by Nakkid
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.

Oh, I missed the last few juicy posts! ;)

It is possible, but only if you remove a few standard features.

I took out invisibility (that's 1), and forumjump (that's 2). The hacks in my showthread did not do queries.

Since then though, I have moved servers, and with a faster server I have put back forumjump, and reinstalled who is browsing this thread. I also reinstalled the "Users Online in Header".

This has brought my showthread back up to 23. (Page generated in 1.00907195 seconds (67.16% PHP - 32.84% MySQL) with 23 queries.)

My index is now at 17 queries. (Page generated in 0.29747605 seconds (82.73% PHP - 17.27% MySQL) with 17 queries.) - I did this by combining the PM queries, removing the query to count threads (I only display posts), and also keeping invisibility off. But using the "Users Online in Header" adds an extra 2 queries to every page.

Erwin
07-21-2002, 07:49 PM
Oh yeah, I disabled forum access masks as well, and made the "Who's Online" page only for admins to prevent the private forum bug.

KuraFire
07-22-2002, 10:34 AM
I haven't been keeping up with this thread for a while, but I noticed a 'flaw' in this hack that is rather scary...

When I installed it (just after the 226 db_mysql.php came out) it didn't add the $query_count var. to the query_first function. The Query_first function is, however, as the name implies, another function using queries, and all these queries were omitted since there was no global $query_count and $query_count++; part palced in it. If you do, you'll suddenly notice how much queries are added. On my board, the count went up with an average of 15 queries. Those are all queries with limit 1 (the query_first function) but still queries. I don't think that's a very good thing....

I'm probably missing out on some info here, but to me, that seems bad. Showthread pages now have a standard of 46 queries on average, with a few 1-query hacks installed.... :/

KuraFire
07-22-2002, 03:43 PM
btw...

Is it me, or is it rather silly that Invisibility (I assume this is the normal feature that says whether a user is displayed as logged in or invisible (guest) ?) is something that doesn't require an independant query at all?

I really don't see why that feature requires its own query to be enabled. Someone please explain?

TECK
07-22-2002, 04:27 PM
Originally posted by KuraFire
I haven't been keeping up with this thread for a while, but I noticed a 'flaw' in this hack that is rather scary...

When I installed it (just after the 226 db_mysql.php came out) it didn't add the $query_count var. to the query_first function. The Query_first function is, however, as the name implies, another function using queries, and all these queries were omitted since there was no global $query_count and $query_count++; part palced in it. If you do, you'll suddenly notice how much queries are added. On my board, the count went up with an average of 15 queries. Those are all queries with limit 1 (the query_first function) but still queries. I don't think that's a very good thing....

I'm probably missing out on some info here, but to me, that seems bad. Showthread pages now have a standard of 46 queries on average, with a few 1-query hacks installed.... :/ this hack doesnt add any query, it only give you the opportunity to see what it's happening behing php and mysql, on every page. it's doing this by only using the microtime function built in php. the rest of functions are used as default by vbulletin.

here it is an example of the original db_mysql.php: function query($query_string) {
global $query_count,$showqueries,$explain,$querytime;
// do queryas you notice, $query_count is present there, in the original file. the only mods i did is to allow to insert the microtime at the beginning and end of page so i can see exacly the time it took to generate the page.
i recommend you to download the latest vb226 package from members area and look at the db_mysql.php file. then to modify it properly. there have been several versions of this file and my hack includes instructions with the latest downloadable .zip file from members area.
also, i dont see where you added query_first string, because is not required in my hack.

at no time you will see 15queries added. this is related to other hacks you added, not vbMicroStats.

KuraFire
07-22-2002, 06:40 PM
Nakkid, was my post that unclear to you???

I Never said that it was this hack that added queries. Nowhere. I was talking about the QUERY_FIRST function of vBulletin itself that adds queries, but with this hack all those queries were omitted from the variable $query_count, therefore the number displayed at the bottom in the microstats - this hack allowing for that to be seen - is actually quite a lot higher (15 queries higher on average) than you get with the default install of this hack (last I checked the install instructions, that is).

There are TWO functions in vBulletin to do a query, and your hack counted only the queries done by ONE of them, therefore at the bottom where it says "with XX queries" the number was wrong, by a shocking 15 on average, which are all the queries done by vBulletin's QUERY_FIRST function.

Are you getting this, now? :/

Admin
07-22-2002, 07:15 PM
Originally posted by KuraFire
Nakkid, was my post that unclear to you???

I Never said that it was this hack that added queries. Nowhere. I was talking about the QUERY_FIRST function of vBulletin itself that adds queries, but with this hack all those queries were omitted from the variable $query_count, therefore the number displayed at the bottom in the microstats - this hack allowing for that to be seen - is actually quite a lot higher (15 queries higher on average) than you get with the default install of this hack (last I checked the install instructions, that is).

There are TWO functions in vBulletin to do a query, and your hack counted only the queries done by ONE of them, therefore at the bottom where it says "with XX queries" the number was wrong, by a shocking 15 on average, which are all the queries done by vBulletin's QUERY_FIRST function.
You are the one that is confused.

If you had taken the time to actually look at the query_first() method you would see that it calls query() itself. What you did was count all the query_first() queries twice.

Look:
function query_first($query_string) {
// does a query and returns first row
$query_id = $this->query($query_string);
$returnarray=$this->fetch_array($query_id, $query_string);
$this->free_result($query_id);
return $returnarray;
}

KuraFire
07-22-2002, 08:09 PM
I wasn't confused, I was just uncertain that what I thought was actually how vB worked, which, thankfully, isn't the case.

Nakkid totally didn't get my post up there, but that may well be cos he already knew about that. (notice how I asked for clarity on this thing in my first post on this page? :))

thx btw for that :up:

Boofo
07-22-2002, 08:37 PM
What private forum bug? :)

Originally posted by Erwin
Oh yeah, I disabled forum access masks as well, and made the "Who's Online" page only for admins to prevent the private forum bug.

Erwin
07-23-2002, 02:21 AM
Originally posted by Boofo
What private forum bug? :)



It's discussed in vbulletin.com

Basically if you switch off forum access mask, members can look at the titles of threads in a private forum if a staff member is reading the thread by lookin at the Who's Online page. (At least on my site and a few others).

jassim
07-23-2002, 07:02 AM
ok i want last vr for this hacks :)

thankx

Boofo
07-23-2002, 08:49 AM
Just have it not show where the staff members are or set it up to show them something like "In the forbidden zone" or anything like that. :)

Originally posted by Erwin


It's discussed in vbulletin.com

Basically if you switch off forum access mask, members can look at the titles of threads in a private forum if a staff member is reading the thread by lookin at the Who's Online page. (At least on my site and a few others).

TECK
07-24-2002, 12:30 AM
Originally posted by jassim
ok i want last vr for this hacks :)
thankx is on the first post, highlighted in bold.
"to download the latest version of this hack, click below"

jassim
07-24-2002, 09:58 AM
thankx

jassim
07-24-2002, 01:10 PM
ok .. what proplem in thise :

Page generated in seconds ( - ) with 6 queries.

TECK
07-24-2002, 01:56 PM
what is your forums url?

jassim
07-25-2002, 07:26 AM
Not in the web in my computer :)

TECK
07-25-2002, 05:32 PM
you know what i found strange jassim? that you have only 6 queries on your page.
when you purchase vBulletin, you must include an url with your forums. if you don't mind, can you let me know what is that url? thanks.

Admin
07-25-2002, 05:54 PM
Originally posted by Nakkid
when you purchase vBulletin, you must include an url with your forums. if you don't mind, can you let me know what is that url? thanks.
You can also put in "local" if your board is not installed on a public server. No one has to give you their board's URL.

TECK
07-25-2002, 07:54 PM
i understand.. that's why i said "if you don't mind".
i'm concerned with the number of queries. 6?

that's why i thought i could help related to vb installation.

Keith
07-27-2002, 12:15 AM
Nakkid, great hack man. I've read all 36 pages, just about twice now but still having 1 problem. By the way, THANK YOU for putting the links to special probs like the db_mysql and a couple others on the first page, really was a big help.

I've been through the db_mysql file several times now, and still getting some wierd issues like 1,027,731,445.53708601 seconds (100.00% PHP - 0.00% MySQL) with 40 queries.

I have 2.2.5, and using the the db_mysql patch until I can upgrade to 2.2.6. That's the file I've edited. So what am I missing?


P.S. This is the link to the patch for 2.2.5 forums (http://www.vbulletin.com/forum/showthread.php?s=&threadid=44820)

Keith
07-27-2002, 12:26 AM
Also hoping someone might be able to explain the numbers in serverload.

i.e., [Server Load: 0.70 » 0.64 : 0.58]

jassim
07-27-2002, 10:30 AM
yes , Nakkid
the URL is http://arabna.com

jassim
07-27-2002, 11:05 AM
I dont know How :surprised:
i only replay one time :cheeky:

jassim
07-27-2002, 11:07 AM
Keith
there is a problem i only see 27 pages when i replay and after replay i see 36 pages and i dont see ypure replay
i thing there is probelm

TECK
07-27-2002, 06:45 PM
Originally posted by Keith
Nakkid, great hack man. I've read all 36 pages, just about twice now but still having 1 problem. By the way, THANK YOU for putting the links to special probs like the db_mysql and a couple others on the first page, really was a big help.

I've been through the db_mysql file several times now, and still getting some wierd issues like 1,027,731,445.53708601 seconds (100.00% PHP - 0.00% MySQL) with 40 queries.

I have 2.2.5, and using the the db_mysql patch until I can upgrade to 2.2.6. That's the file I've edited. So what am I missing?


P.S. This is the link to the patch for 2.2.5 forums (http://www.vbulletin.com/forum/showthread.php?s=&threadid=44820) keith, the prob you have there is editing the wrong global.php file and also editing incorrect the db_mysql.php. edit the db_mysql.php 225 version, the changes are the same as in 226. let me know what is wrong.

Originally posted by jassim
yes , Nakkid
the URL is http://arabna.comok from what i see jassim is that you switch from UBB to VB. however in your localhost, you cannot have only 6 queries because the lowest number of queries on a vb page is 9. make sure you install properly first VB in your localhost. if you have probs, follow this tutorial i made:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=39482

proxyMX
07-27-2002, 06:53 PM
uhm quadrizaiple posting is totally not legal

TECK
07-27-2002, 06:54 PM
is probably from the auto email answer. dont worry he will delete them.
keith, when you view the thread, simply click on Edit and delete those double posts. :)
it will save a mod's time.

Keith
07-27-2002, 07:34 PM
First, my apologies to the mod's and Nakkid, and any others subscribing to the thread. I recently changed my email address in the profile to one that has an auto responder. The subscription option and auto email response wound up in a loop, resulting in umteensome identical posts for about 3 pages. I've now deleted them, and changed email address back.

Second, if you're getting unusually high stat numbers like others listed here (me included) or 100% PHP stats and 0% MySQL, and no matter HOW SURE you are that you've edited the right files, before you post anything, start over again!! :) You've hacked the wrong global.php file (there are 2 found in the directories), or the wrong db_mysql.php file. Reload the originals, try it again.

Or you've copied and pasted additional characters from the instructions file that do not belong in the php file.

Third, backup and rename your original files (db_mysql.php, functions.php and global.php) so you'll be able to start over again. As I read this forum thread, I saw how many members had hacked the wrong files. I was CERTAIN I had not made that mistake. Yes, hacking at 1AM is not a good idea. Start over before posting the same stupid situation/question like I did, it was silly and should have known better.

Sorry for having asked the same question that's been answered over and over and over. I'd rather Nakkid be heads down, butt in seat, fingers on keyboard, coming up with more great hacks. :)

TECK
07-27-2002, 07:37 PM
Originally posted by Keith
Also hoping someone might be able to explain the numbers in serverload.
i.e., [Server Load: 0.70 ? 0.64 : 0.58] read more here (http://www.vbulletin.com/forum/showthread.php?s=&action=showpost&postid=291831). hope that helps.
about the wrong editing, dont worry. as i said before, i do similar errors me to, as everyone else on this board. :)

FrankR310
07-28-2002, 02:13 AM
thanks for the hack; just what i needed.

a couple of questions:

1) i get 8 queries in my calendar; did i do something wrong? i see that minimum is 9 for vb pages.

2) why does vb have higher query numbers than some of the other boards i have seen?

thanks

TECK
07-28-2002, 02:21 AM
my bad. i'm sorry. i never had the calendar enabled. :)

FrankR310
07-28-2002, 02:27 AM
cool thanks! :)

Thunderpuck
07-30-2002, 02:17 PM
God I am so embarrassed to be asking this question, you can't be more of a newbie than I am. This is my very first time installing a hack.

I followed the instructions but I am stuck at the part where it says "To call your vbMicroStats, simply place the string {getmicrostats} anywhere you want in your templates"... I copy and pasted {getmicrostats} on my footer template and now my forum displays the word: "{getmicrostats}" instead of actually getting microstats. LOL. Obviously I am not calling MicroStats properly, can anyone shed some light on a newbie?

Thanks in advance...

Keith
07-30-2002, 07:55 PM
It's got to be something very simple, but it's going to be a pain to find. You have to start from square one, go through the instructions again, retracing each and every step, one by one. That's what I would do in this case.

I used the template version. Created a template called home_microstats. It's in the default style because I don't have more than one. This template has the following in it:

<center>Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.
$adminstats </center>

Then place a variable {getmicrostats} in your footer template. This is what the end of my footer template looks like, with the variable call near the end
<!-- Do not remove this copyright notice -->
Powered by: vBulletin Version $templateversion<br>
Copyright &copy;2000, 2001, Jelsoft Enterprises Limited.<br>
<!-- Do not remove this copyright notice -->
$copyrighttext
</smallfont></p>
$themefooter

<smallfont>{getmicrostats}</smallfont>

<!-- End -->

hope this helps.

Thunderpuck
07-31-2002, 12:38 PM
Yes, that did it, you helped a lot Keith! Thanks for taking the time to help a newbie start down the road to hacking this cool forum.
;)

Keith
07-31-2002, 08:20 PM
Originally posted by Thunderpuck
Yes, that did it, you helped a lot Keith! ;)

That's the first time I think I've actually been of help to someone. :) Glad it worked out, thanks for letting me know. I'm still learning as well, but hacking away like crazy, usually getting into trouble and looking for help myself. :D

Take my advice from another post I made above, use the "Lessons Learned". Backup, rename, backup and rename again if you have to. I have a CD with the original code, and a copy on my harddrive for safekeeping. Always have an original to FTP onto the server in case you goof up. :)

TECK
08-10-2002, 08:00 PM
Originally posted by Keith
That's the first time I think I've actually been of help to someone. :) Glad it worked out, thanks for letting me know.great job Keith. glad eveyone got the hack up and running without any hikkies... :)

FlyingDutchman
08-10-2002, 08:31 PM
:bunny:

BlueVoltage
08-10-2002, 08:58 PM
I just installed this and i get this error:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/xelerix/public_html/forums/admin/db_mysql.php on line 240

Fatal error: Cannot instantiate non-existent class: db_sql_vb in /home/xelerix/public_html/forums/admin/global.php on line 108

BlueVoltage
08-10-2002, 09:18 PM
I am also getting this error:


Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/xelerix/public_html/forums/admin/db_mysql.php on line 240

Fatal error: Cannot instantiate non-existent class: db_sql_vb in /home/xelerix/public_html/forums/global.php on line 128

TECK
08-10-2002, 09:24 PM
check your code. 99.99% of the cases is because you edited the wrong global file...
check carefully the db_mysql.php file also.

BlueVoltage
08-10-2002, 09:36 PM
here is line 240 in my db_mysql.php file:
echo "<form><textarea mmTranslatedValueHiliteColor="HILITECOLOR=%22No Color%22" mmTranslatedValueHiliteColor="HILITECOLOR=%22No Color%22" mmTranslatedValueHiliteColor="HILITECOLOR=%22No Color%22" mmTranslatedValueHiliteColor="HILITECOLOR=%22No Color%22" mmTranslatedValueHiliteColor="HILITECOLOR=%22No Color%22" rows=\"12\" cols=\"60\">".htmlspecialchars($message)."</textarea></form>";

TECK
08-10-2002, 09:38 PM
this is a line you added yourself. is not part of vb code.

BlueVoltage
08-10-2002, 09:48 PM
nevermind, i fixed it :)

TECK
08-10-2002, 10:25 PM
congrats :)

Erwin
08-11-2002, 03:39 AM
Look, it even works for posts... look at the bottom of my post...

;)

:p

TECK
08-11-2002, 04:09 AM
lol

2 X Viverridae
08-14-2002, 10:37 AM
Installed in mere minutes, works great.

Thanks!

TECK
08-18-2002, 06:28 PM
glad you like it... :)

Okiewan
08-20-2002, 04:02 PM
Well... I thought it was odd that I'd see 93 queries... noticed the "93" showing up a lot in this thread <---

Also MySQL shows 0% and PHP=100%

Removed a couple of hacks from forumhome (total users online today, welcome panel) ... still showing 93 queries. :(

TECK
08-20-2002, 05:02 PM
the 0-100% is the db_mysql.php issue discussed several times here... please check your file properly and let me know if it's working.
about 93 queries, nobody had 93 queries on forumhome. please let me know exacly what hacks you installed. on the main page (not forumhome) i think you have installed vbIndex, the champion of busting servers with it's extremly high number of queries. a normal unhacked forumhome have 17queries.

DWZ
08-30-2002, 12:57 PM
Has this been tested with 2.2.7? I'm in the middle of adding all my hacks to the 2.2.7 code, just wondering if it will work or not :)

TLfuRy
08-30-2002, 03:19 PM
Originally posted by DWZ
Has this been tested with 2.2.7? I'm in the middle of adding all my hacks to the 2.2.7 code, just wondering if it will work or not :)

You just have to re-apply the hack after you upgrade. I upgraded today and re-applied the hack and it's working fine.

N9ne
08-30-2002, 03:32 PM
There shouldn't be any reason why this shouldn't work.

TECK
08-30-2002, 03:32 PM
it should work in VB227 without any probs.

N9ne
08-30-2002, 03:37 PM
lol @ your sig Nakkid :D :D

jediguy
09-01-2002, 09:10 AM
Thanks for the beaut hack! Took me a while to go through the thread and find out what I did wrong, but in the end it works like a charm. :)

Powered by: vBulletin Version 2.2.6
Copyright ?2000, 2001, Jelsoft Enterprises Limited.
Page generated in 0.36839294 seconds (31.64% PHP - 68.36% MySQL) with 28 queries.
[Debug Mode OFF] [PHP v4.2.2] [GZIP enabled - level 1] [Server Load: 0.62 ? 0.86 : 0.96]

Thanks a lot!

Gohan
09-01-2002, 07:23 PM
Great hack and fine working on 2.2.7

Boogle
09-02-2002, 12:36 PM
I have a problem with the db_mysql.php file. Locally everything works, but if I upload to me webserver I get an error, like so:


Database error in vBulletin 2.2.7:

Invalid SQL: INSERT INTO session (sessionhash,userid,host,useragent,lastactivity,al thash,location) VALUES ('32a41a8546984be8115d0e92b1a55701','1','62.60.41. 40','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;','1030973130','','/')
mysql error: Duplicate entry '32a41a8546984be8115d0e92b1a55701' for key 1

mysql error number: 1062


Any advice?

TECK
09-02-2002, 01:02 PM
check your code.

Boogle
09-02-2002, 01:45 PM
Its a perfect cut 'n paste. The fact it works locally should mean the code is fine anyway.

Why doesn't it work when the file is uploaded to the webserver?

TECK
09-02-2002, 02:17 PM
let me guess, you have a local host clean install forum with no hacks and your online forums with hacks, right?
probably some of your hacks are interefering with it. it doesnt make sense because it should not. i wish i could help you more on this but i really cant... especially that you did get it working on the localhost.

Boogle
09-02-2002, 02:31 PM
Damn, thanks anyway.

TECK
09-05-2002, 02:03 AM
Originally posted by Boogle
Damn, thanks anyway. many users posted here the same story like you did. "is not working... i did the mods perfectly..." 99% of the cases were always little code mistakes.
my hack never interfered with any other hacks... is imposible due to the nature of it's code.
let me know if you got it working. :)

PHiXTiT
09-13-2002, 12:46 PM
Great hack!

ThanX

5 Stars

Neo
09-17-2002, 07:08 PM
I couldnt get it to show in the footer template :\

TECK
09-18-2002, 01:34 AM
lol, get out of town... :)

havefun
09-21-2002, 04:57 PM
thanks for that nice hack! :banana:

lg, havefun

Sc0rp
09-21-2002, 07:14 PM
any way I could show this nfo to all my members instead of only the admins?:)

Dark Shogun
09-21-2002, 08:46 PM
I put {getmicrostats} in my footer but it just shows {getmicrostats}. Does anyone know how to fix this? I have VB 2.2.7.

Dark Shogun

Ian
09-21-2002, 09:51 PM
Originally posted by Dark Shogun
I put {getmicrostats} in my footer but it just shows {getmicrostats}. Does anyone know how to fix this? I have VB 2.2.7.Sounds like you didn't follow the directions properly. Try re-installing and make sure you follow the directions precisely.

Dark Shogun
09-21-2002, 10:08 PM
I reinstalled it and it still doesn't work. I did the php version and it worked but the text of the stats were to big so I redid it and used the template version and it doesn't work.

These are the instructions I downloaded.

Dark Shogun

TECK
09-22-2002, 12:32 AM
Dark Shogun, check your steps. if for 377 people worked perfectly, i dont see why it should not work for you also.
this hack doesnt interact with any other hacks that's why is a real statistics hack.

TECK
09-22-2002, 12:40 AM
here, is working perfectly in my super hacked forum.

Coreace
09-25-2002, 10:17 AM
Is there a way to disable the PHP version on display?

TECK
09-25-2002, 10:19 AM
yes. just remove the code segment. it will not be called anymore.
$versionnum=phpversion();
also delete the [PHP v'.$versionnum.'] code segment.

Erwin
09-25-2002, 11:19 AM
Everytime I upgrade vB, I need to reinstall this hack - it's always the forum/global.php file - this line to be specific:

$pagestarttime = microtime();

I always revert it back to default by accident using Araxis Merge. :) You'd think that I'd learn by now after so many upgrades. :D

TECK
09-25-2002, 11:21 AM
you are not the only one... :) me too.......

Coreace
09-25-2002, 11:54 AM
Originally posted by TECK
yes. just remove the code segment. it will not be called anymore.
$versionnum=phpversion();
also delete the [PHP v'.$versionnum.'] code segment.

Thank you, that worked fine. By the way, nice website you have there! Great design - open for some freelance work?

TECK
09-25-2002, 12:13 PM
actually, that's ugly... here it is the new one:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=43447

should be open in about 2 weeks...

Dark Shogun
09-26-2002, 04:18 AM
Can anyone tell me why my stats say php %100 and mysql 0% on all pages? I know that can't be true. Thats the only problem.

Dark Shogun

TECK
09-26-2002, 04:20 AM
is because you didnt hack properly db_mysql.php

Dark Shogun
09-26-2002, 04:25 AM
Seems I left out that step somehow. Well it is fixed now. Thanks Teck.

Dark Shogun

KimG
09-27-2002, 12:54 PM
Hi there,
Looks a great hack and one I would find useful. My server load seems to magically increase from time to time so I would like to track down the culprit!

Unfortuneatly I have PHP 4.04 installed on my server, and a host who is very slow to do anything! Is there a version of microstats which would work under this version of PHP?

I have the first microstats which does work, butgives incorrect times/queries! The latest version does not parse the php when I update functions.php because of the php version. Is there an inbetween microstats I could use?

Many thanks,
Kim

TECK
09-27-2002, 04:56 PM
hello KimG... unfortunatelly no. the lowest version that vbMicrostats will work is PHP 4.06.

N9ne
09-27-2002, 07:40 PM
ignore post, matter resolved by myself

exTracT
10-01-2002, 05:20 PM
Just curious how these stats look. I am on a shared server
13 members online. i have about 10 lil hacks installed.
almost 1000 members.

thanks

Page generated in 0.30253804 seconds (40.66% PHP - 59.34% MySQL) with 24 queries.
[Debug Mode OFF] [PHP v4.2.2] [GZIP enabled - level 1] [Server Load: 1.96 » 2.64 : 2.64]

Ian
10-01-2002, 09:08 PM
exTracT, those stats look fine to me.

TECK
10-01-2002, 09:19 PM
smart decision to leave the gzip to 1. that cuts the bandwidth alot. dont go higher then this.
24 queries on forumhome? make sure you installed properly your hacks.. not alot of hacks add queries.. and is defalut 17 for vbulletin.

so i would do an ?explain=1 on your forumhome just to see if i didnt forget any templates to add. that the most frequent mistake people do...
if you see in the explain=1 some template title then you missed that one...

NTLDR
10-01-2002, 09:20 PM
Hi TECK,

I don't know if there is a soloution to this or not, but my current work around is a very long one, so I thought I'd ask ;)

On a board with FireFly's change { bbusername } to the viewers username hack installed and this one there is a section of code that allows you (at present) to either have this hack working or FireFly's.

$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'];
}
}

In the { bbusername } hack you have:

$findwords=array(0 => '{ bbusername }');
$replacewords=array(0 => $bbuerinfo[username]);

As well as the microstats code, but which ever one is directly before the while loop works and the other one just displays {text} I have tried everything I can to get it to work, but have failed :(

Any ideas? Currently I have edited a whole bunch of files and used str_replace everywhere I can think of that { bbusername } could appear.

TECK
10-01-2002, 09:23 PM
here it is NTLDR:
$findwords = array(0 => '{getmicrostats}', 1 => '{bbusername}');
$replacewords = array(0 => $microstats, 1 => $bbusername);
$i = 2;

NTLDR
10-01-2002, 09:28 PM
Originally posted by TECK
here it is NTLDR:
$findwords = array(0 => '{getmicrostats}', 1 => '{bbusername}');
$replacewords = array(0 => $microstats, 1 => $bbusername);
$i = 2;

As easy as that :) Thanks TECK, I spent ages trying to figure out how to do that.

TECK
10-02-2002, 04:48 AM
np. :)
your welcome.

Xenon
10-02-2002, 09:11 AM
Finally i've also installed this hack and it makes working on a hack really easier

so i just want to post a thank you floren for this hack.
ok, its on page 41, but i think it's worth, too ;)

TECK
10-04-2002, 10:55 AM
thanks stefan for the nice words. :)

Christoff
10-06-2002, 12:37 PM
Hi

I can't find anything like that in my /forum/global.php file:

if (isset($HTTP_GET_VARS['showqueries']) OR isset($HTTP_POST_VARS['showqueries'])


This is first thing to be changed in your hack.
I use vbb 2.2.6 and... there is nothing like that ...

I beg for help :)

Regards

Christoff

freakyshiat
10-06-2002, 06:20 PM
Running great on 2.2.8

Have one questions, is it possible to put the server load in regular display, not admin? I want the server load visible at all times, not just admin

TECK
10-06-2002, 06:32 PM
i dont recommend it. the server load have no use for users to known is for you as admin to know what to do if the load is to big...

Christoff
10-06-2002, 07:24 PM
TECK: but what with my problem?
This hack is older then 2.2.8
Please..help me ;)

TECK
10-06-2002, 07:26 PM
just give me a few christoff i saw you post, ok? thanks.

Stadler
10-07-2002, 03:18 AM
Originally posted by Boogle
I have a problem with the db_mysql.php file. Locally everything works, but if I upload to me webserver I get an error, like so:



Any advice? Hi, I've got the same error, cause I was mixing up
echo "Time before: $beforetime\n";
and
echo "Time after: $aftertime\n";
when lookig for the code to change ...

Just remove }

$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";in your broken db_mysql.php, cause you've left it there.

HTH

btw: I've modified the Hack, so that the adminstats are based on templates, too.

Check the Attachment

Christoff
10-08-2002, 10:14 AM
TECK: no problem... i'm sorry... i thought it was ignored or something ;)

Thanx and sorry one more time :)

TECK
10-08-2002, 02:14 PM
christoff, what vBulletin version you have?
be aware, there are 2 global.php files in your folders. one in /forum and one in /admin

make sure you edit the correct one. :)

Christoff
10-08-2002, 05:41 PM
I already wrote i've edited the right one!

Version number is 2,2,6

TECK
10-08-2002, 05:44 PM
you still didnt answer to my question. what vB version you have?

Christoff
10-08-2002, 05:49 PM
I'm sorry
you've posted when i was editing it
but in previous post i said that :)

TECK
10-08-2002, 06:07 PM
aha. then you should have the line that you miss. please check it, it's at the top of your global.php.

also you should upgrade to vb228, due to security issues. check with vb team for more details.

marocnl
10-14-2002, 05:43 PM
I measured my serverload with this hack and it came up with [Server Load: 9.32 » 9.46 : 8.66] . Isn't this a little bit 2 much? What's normal?

TECK
10-14-2002, 06:44 PM
it's huge.. what are you doing there???? you added some crazy hacks??? normal is 0.5

did you know that some hacks released here actually they are sooo bad written that they simply distroy your server?

Erwin
10-14-2002, 08:38 PM
Originally posted by marocnl
I measured my serverload with this hack and it came up with [Server Load: 9.32 ? 9.46 : 8.66] . Isn't this a little bit 2 much? What's normal?

If you're on a dedicated server, then you need to look at all your scripts to see which one has a query loop or has bad code in it.

If you're on a shared server, it may not even be your site - it may another site on the same server soaking up all the server load. Either way, that is way over. The CPU on the server is being used at 9 times its capacity.

marocnl
10-15-2002, 07:48 AM
Originally posted by TECK
it's huge.. what are you doing there???? you added some crazy hacks??? normal is 0.5

did you know that some hacks released here actually they are sooo bad written that they simply distroy your server?
I guess that can be the case. Shouldn't vbulletin.org tsjek them first before they can be released. :)

Anyhow, it's now about 3. I don't know exactly why it decremented. The page load time is round about 1. Is this ok? We are on a virtual server. But we will soon go over onto a dedicated. The server we r now on is just to test the board. So most of the time only one or 2 persons are online. That's why i don't get the serverload. But i hope like Erwin says, it's not mine vbulletin-script.

When we go online a minumum of 100 current users is always online.

marocnl
10-15-2002, 07:53 AM
Originally posted by Erwin


If you're on a dedicated server, then you need to look at all your scripts to see which one has a query loop or has bad code in it.

If you're on a shared server, it may not even be your site - it may another site on the same server soaking up all the server load. Either way, that is way over. The CPU on the server is being used at 9 times its capacity.
Is there some kind of a program that can tsjek my vbulletin script, which is extremeley hacked(more than 60:p), for malicious code?

If there isn't tell me how you would do it, besides installing a fresh vbulletin-script. That's no option :D

If others have any ideas, i wanna hear them 2 and would be most grateful. It's nice to have hacks, but when it f*cks up my serverload it's crap! You might agree. :cross-eyed:

TECK
10-15-2002, 12:01 PM
extremly hacked? i barelly see few hacks on it...
and i asume you paid the $600 fee to remove the vBulletin copyright, right?
http://dating.marokko.nl/

install a clean basic v2.2.8 and you will see the server load dropping really low.
alot of people here dont realise that hacking their boards no matter how, [a] they expose them selfs to security issues, [b] to extremly poor coding skills, [c] to large number of queries added, etc.

dont install a hack just like that. first ask the hack writer if it generates any extra queries. if he(she) cant answer any tech questions about the code, be aware, there might be problems with the code. you can compare the code with the original vBulletin code to see if the coder is a sloppy one or not.
anyway, soon vBulletin will install here hack reviews, wich is really good because i could say that half of the hacks here released are terrible (coding, etc).

guys, if you are not sure about a piece of code, dont release it just for fun. half of the the people here who release a hack have no idea about php or how to use an implode explode function for example... not to talk about the usage of a simple array.

marocnl
10-15-2002, 03:27 PM
Originally posted by TECK
extremly hacked? i barelly see few hacks on it...
and i asume you paid the $600 fee to remove the vBulletin copyright, right?
http://dating.marokko.nl/

install a clean basic v2.2.8 and you will see the server load dropping really low.
alot of people here dont realise that hacking their boards no matter how, [a] they expose them selfs to security issues, [b] to extremly poor coding skills, [c] to large number of queries added, etc.

dont install a hack just like that. first ask the hack writer if it generates any extra queries. if he(she) cant answer any tech questions about the code, be aware, there might be problems with the code. you can compare the code with the original vBulletin code to see if the coder is a sloppy one or not.
anyway, soon vBulletin will install here hack reviews, wich is really good because i could say that half of the hacks here released are terrible (coding, etc).

guys, if you are not sure about a piece of code, dont release it just for fun. half of the the people here who release a hack have no idea about php or how to use an implode explode function for example... not to talk about the usage of a simple array.
Thnx 4 the answer.

As 4 the copyright.....i will c to it getting restored :)

-=dm=-
11-03-2002, 11:58 PM
Great TECH :)
does this work with version 2.2.4?

Erwin
11-04-2002, 12:07 AM
Should work for all 2.2.x versions.

slideboxer
11-04-2002, 06:54 PM
I seem to be having some probs with the installation of the hack. Here's a screen shot of what it is doing to my pages...

And it doesn't even tell me the stats, just {getmicrostats} in my footer. I'm running 2.2.8. Any help?

TECK
11-04-2002, 09:51 PM
did u read the note on the first post related to ur php version?

Asendin
11-04-2002, 10:10 PM
Overgrows edge forums show this

Page generated in 2.13338900 seconds (100.00% PHP - 0.00% MySQL) with 25 queries.

how do they accomplish the 0.00% MySQL???

TECK
11-04-2002, 10:46 PM
he doesnt have the hack installed properly, that's why.

Asendin
11-04-2002, 10:47 PM
Originally posted by TECK
he doesnt have the hack installed properly, that's why.

really?? lol, no wonder there board lags so much sometimes, 600 users online though.. :cool:

TECK
11-04-2002, 10:49 PM
even if u have 1200users it will still load in 0.5-0.9secs not 3secs

Lethal
11-05-2002, 03:35 AM
My server load doesn't show up, I talked to my host and they said it should. I went over the hack changes 3 or 4 times and I know that variable is there, everything is right but it just won't show up. Also, is GZIP a good thing to use or is it just better to leave it off? Maybe good on a site that gets a lot of traffic? I turned it on and I go 2 extra queries and the load time didn't change much.

Without gzip:
Page generated in 0.31823003 seconds (82.84% PHP - 17.16% MySQL) with 34 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP disabled]

with gzip:
Page generated in 0.38986803 seconds (97.93% PHP - 18.07% MySQL) with 36 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP enabled - level 1]

Does that look ok? Should I use gzip?

mheinemann
11-05-2002, 03:42 AM
Doesn't look right

97.93% + 18.07% = 116%
this should always equal 100%

IcEmAn@GeR
11-05-2002, 11:40 AM
Hi @ all,


thus I have all changes in my files made and also the template provided however nevertheless get I in each case in more footer this {getmicrostats}angezeigt.

I have also seen that 2 others equal problem to already have, which we make wrongly it seem with that to mostly fold.

I am not also really so crack in this area however after guidance can I sowas also;)

I hope it can me one help.

Thanks already times in advance.

PS: sorry for my bad english, my German is better ;)

Lethal
11-05-2002, 04:40 PM
I guess I will just let GZIP off then.

Ian
11-05-2002, 09:27 PM
Originally posted by Lethal
I guess I will just let GZIP off then. GZIP at setting 1 is the best. It'll reduce bandwidth usage a lot and wont slow your server down much.

N9ne
11-06-2002, 04:18 PM
If your host has GZIP, I suggest setting it to level 1, that goes out to all vB owners, it HALVED my bandwidth usage, right now i'd be using 1GB a day of bandwidth with my forum, but with GZIP I use only about 200-300MB :)

maestrosdelweb
11-10-2002, 09:34 PM
It works fine.. Thanx...

mheinemann
11-10-2002, 09:37 PM
Does a higher GZIP setting offer more compression or less compression.

FWC
11-10-2002, 10:07 PM
Originally posted by mheinemann
Does a higher GZIP setting offer more compression or less compression. Anything over 1 offers little compression gain and is very hard on the server.

mheinemann
11-10-2002, 10:11 PM
Thanks for letting me know. Guess I should take it off level 4.

Dynamic One
11-11-2002, 07:48 AM
Thanks for thits great hack. Easy to see if another hack is taking to much traficdata :).

Sebastian
11-12-2002, 07:32 AM
is it possible to get the server load on a windows 2000 adv server? i tried $serverload but it doesn't show the load, just shows generation time, sql and php .. what about server uptime, is that possible to add, if so will it work on win2000?

thanks.

TECK
11-12-2002, 09:01 AM
no

Bison
11-19-2002, 05:11 PM
Is it just me ... or have anyone noticed that the "getmicrostats" tage in the footer of their pages stopped working?

Mine was working just fine last week and all of a sudden, it stopped! :( Just shows the tag now ... any clue why?

ZiRu$
11-20-2002, 03:24 AM
Installed....thx man..........32 queries on my forumhome

TECK
11-20-2002, 04:07 AM
ZiRu$, you had problems before with it, glad you got it up and running. Congratulations. :)

marc49
11-24-2002, 06:38 AM
rolodex, does it say {getmicrostats} in your footer?

I upgraded to 2.2.9 and installed it correctly (as far as I know) and I am getting {getmicrostats} instead of the actual stats

Asendin
11-24-2002, 12:11 PM
im using this hack with 2.2.9 with no problems

Bison
11-24-2002, 02:51 PM
Must be a "server thing" ... it was working B-fore!

Asendin
11-24-2002, 05:45 PM
since installing this hack on 2.2.9, my 5 min server load stat shows up in red. this happen to anyone else?

not that it matters, i kinda like it this way, just wondering

http://www.asendtechnologies.com/misc/microstats.jpg

TECK
11-25-2002, 11:25 AM
You probably removed the space between brackets, as suggested in the readme file...
That will make the server stats to show colored, otherwise they will show in black. :)

Julio
11-26-2002, 11:13 AM
To "call" microstats, I simply use:

{getmicrostats} $trimmedtime $percentphp $percentsql $query_count $serverload ?

Sebastian
12-01-2002, 11:31 PM
TECK, How do I get it to show the server uptime right below the load?

Right now mines show:

Page generated in 0.15713799 seconds (81.58% PHP - 18.42% MySQL) with 15 queries.
[Debug Mode OFF] [PHP v4.3.0RC] [GZIP enabled - level 1] [Server Load: 0.01 » 0.02 : 0.00]

I would like to see uptime right below the load.

/me installed

TECK
12-02-2002, 08:50 AM
function serveruptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

snout
12-02-2002, 11:09 AM
cool thanks mate, sounds useful ;) ill give it a try........

bahamut0
12-02-2002, 03:27 PM
installed very nice helpfull in seeing quickly how many queries im getting. which is 22

Sebastian
12-05-2002, 09:57 AM
TECK.

you have already added: @exec('uptime')

so I cannot redeclare that code you posted, you are parsing the @exec('uptime') to only show the load averages right? if so how do I un parse the code below so it shows the uptime right near the load?

thanks.


if ($stats=@exec('uptime')) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload=' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].']';
} else {
$serverload='';
}

TECK
12-05-2002, 10:26 AM
function serveruptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

if ( $stats = @exec( 'uptime' ) ) {
preg_match( '/averages?: ([0-9\.]+),[\s]+([0-9\.]+) , [\s]+([0-9\.]+)/' , $stats , $regs );
$serveruptime = serveruptime();
$serverload = ' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].'][Server Uptime: ' . $serveruptime . ']';
} else {
$serverload = '';
}

Sebastian
12-05-2002, 10:32 AM
doesn't work... still get the redeclare error.

Fatal error: Cannot redeclare serveruptime() in /home/www/html/forum/admin/functions.php on line 518

Raptor
12-05-2002, 11:45 AM
worked perfect first time using vb 2.2.9 :)

Page generated in 0.33490300 seconds (43.71% PHP - 56.29% MySQL) with 21 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP enabled - level 1] [Server Load: 1.05 ? 1.10 : 1.08]

is it possible for the admin only stuff to be view by anyone ?

TECK
12-05-2002, 02:21 PM
Originally posted by Sebastian
doesn't work... still get the redeclare error.


Fatal error: Cannot redeclare serveruptime() in /home/www/html/forum/admin/functions.php on line 518
Aha, you probably have my admin hack installed.
function uptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

if ( $stats = @exec( 'uptime' ) ) {
preg_match( '/averages?: ([0-9\.]+),[\s]+([0-9\.]+) , [\s]+([0-9\.]+)/' , $stats , $regs );
$serveruptime = uptime();
$serverload = ' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].'][Server Uptime: ' . $serveruptime . ']';
} else {
$serverload = '';
}

Boofo
12-05-2002, 02:33 PM
Teck, how would we get the serveruptime to show in the admin part of microstats at the bottom of the page? :)

TECK
12-05-2002, 08:02 PM
Boofo, find:
if ($stats=@exec('uptime')) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload=' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].']';
} else {
$serverload='';
}
Replace with:
if ( $stats = @exec( 'uptime' ) ) {
preg_match( '/averages?: ([0-9\.]+) , [\s]+([0-9\.]+) , [\s]+([0-9\.]+)/' , $stats , $regs );

function getserveruptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

$serveruptime = getserveruptime();
$serverload = ' [Server Load: ' . $regs[1] . ' : ' . $regs[2] . ' : ' . $regs[3] . '] [Server UpTime: ' . $serveruptime . ']';
} else {
$serverload = '';
}

Boofo
12-05-2002, 09:17 PM
Thanks, Floren, :) When I added the code you gave me, my Server Load has no numbers after it now. It only shows : :. Any ideas? :) And how can I get it to show on the next line?

Sebastian
12-05-2002, 10:22 PM
yeah TECK, it works but then doesn't show the server load averages, just : :

TECK
12-06-2002, 09:17 PM
That's really wierd.. I simply added a function, so it should display it...
function getserveruptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

$serveruptime = getserveruptime();
The rest is unchanged.
Boofo, simply call $serveruptime anywhere you want... you could use this:
']<br />[Server UpTime: ' . $serveruptime . ']';
from the line listed above, it will display it under the actual line of admin stats... let me know if everything is ok... simply add the above function below this line:
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);

Boofo
12-07-2002, 01:52 AM
Thank you, Floren. It worked great! Once again you have proven yourself the Microstats Wizard. ;) This is why it won Hack of the Month. If they ever have a hack of the year contest, you got my vote! ;)

One last question (2 actually). What is the difference between Server Uptime and MySQL uptime? I have both of them installed and they are about 5 days off from one another.

Also, could you show me how to add (I know this will sound stupid) seconds to the uptime, please? :)

TECK
12-07-2002, 08:54 AM
1. There is a link I posted in the first thread that will explain the diff between, is done by Eva2000 at VB.com site.
2. For seconds, use this:
$sec = floor( $sys_ticks - ( $days * 60 * 24 ) - ( $hours * 60 ) - ( $min * 60 ) );
Then:
if ( $sec != 1 ) {
$value .= $sec . ' seconds';
} else {
$value .= $sec . ' second';
}
Just play with the "and" word...

TECK
12-07-2002, 08:56 AM
Originally posted by Raptor
worked perfect first time using vb 2.2.9 :)

Page generated in 0.33490300 seconds (43.71% PHP - 56.29% MySQL) with 21 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP enabled - level 1] [Server Load: 1.05 ? 1.10 : 1.08]

is it possible for the admin only stuff to be view by anyone ?
Please read the first post. Thank you.

TECK
12-07-2002, 08:59 AM
Originally posted by Boofo
This is why it won Hack of the Month.
It did? I wish since is a useful hack for VB coders, but it didn't... :D

Boofo
12-07-2002, 10:07 AM
I guess I should have said "you won"? I forgot it was your other program. :) Oops! Sorry. :)

Boofo
12-07-2002, 10:22 AM
Originally posted by TECK
1. There is a link I posted in the first thread that will explain the diff between, is done by Eva2000 at VB.com site.
2. For seconds, use this:
$sec = floor( $sys_ticks - ( $days * 60 * 24 ) - ( $hours * 60 ) - ( $min * 60 ) );
Then:
if ( $sec != 1 ) {
$value .= $sec . ' seconds';
} else {
$value .= $sec . ' second';
}
Just play with the "and" word...

This doesn't work quite right. I ended up with:

[Server UpTime: 9 days, 3 hours and 40 minutes and 775307 seconds]

TECK
12-07-2002, 06:26 PM
Hmmm, I can't test it in a live envionment because my server doesn't support the uptime, or passthru (PHP in save mode)...
But technically this is what it does:
$sys_ticks - shows the no. of seconds since the system is up
( $days * 60 * 24 ) - the days
( $hours * 60 ) - the hours
( $min * 60 ) - the minutes
Removing all those values should give you the seconds only... maybe one of the php gurus can explain what we do wrong? In theory it should work...

You could also do this... replace the function with this line:
$serveruptime = passthru( '/usr/bin/uptime' );

Boofo
12-07-2002, 06:49 PM
I just tried the passthru code you gave me and nothing shows up with that.

Admin
12-07-2002, 07:10 PM
passthru() returns nothing. You need to use exec('whatever', $output) and then $output will be an array containing the output from the program. If you only need the last line of output, simply do $line = exec('whatever').

Boofo
12-07-2002, 08:20 PM
You got me on this one, Chen. (By the way, "hello and it's good to hear from you. :)) You're explanation went way over my head. All I am trying to do is get the seconds to show out of the code Teck gave me. Can you help me on that, please? :)

Bison
12-08-2002, 09:02 PM
Originally posted by TECK
function serveruptime() {
$fd = fopen( '/proc/uptime' , 'r' );
$ar_buf = split( ' ' , fgets( $fd , 4096 ) );
fclose( $fd );
$sys_ticks = trim( $ar_buf[0] );
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor( $hours / 24 );
$hours = floor( $hours - ( $days * 24 ) );
$min = floor( $min - ( $days * 60 * 24 ) - ( $hours * 60 ) );

if ( $days != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}

return $value;
}

if ( $stats = @exec( 'uptime' ) ) {
preg_match( '/averages?: ([0-9\.]+),[\s]+([0-9\.]+) , [\s]+([0-9\.]+)/' , $stats , $regs );
$serveruptime = serveruptime();
$serverload = ' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].'][Server Uptime: ' . $serveruptime . ']';
} else {
$serverload = '';
}

TECK,

Why would it be a security risk for someone to read from the "/proc" in a *nix box? This is what my isp is telling me why they disabled this feature?

And if this is disabled, is it possible to get your hack to work with the other statistics (ex: MySQL - PHP - G-ZIP)?

Thanks in advance!

TECK
12-09-2002, 05:47 AM
You are running PHP in safe mode. My host does it also. That's life... you can't do nothing about it.

Sebastian
12-09-2002, 11:35 AM
Originally posted by TECK
You are running PHP in safe mode. My host does it also. That's life... you can't do nothing about it.

yeah you can, get a dedicated server ;)

they can however disable safemode for just one site .. it is possible, i have done it. you can ask them to disable it on just your site.

mute
12-17-2002, 12:08 PM
Anyone using vbmicrostats and apache 2?

vbMs works fine on my 1.3.27+php 4.2.3 server:


Page generated in 0.20286000 seconds (85.72% PHP - 14.28% MySQL) with 16 queries.

but on my 2.0.43+php 4.2.3 server i get:

Page generated in 1,040,133,629.17236805 seconds (100.00% PHP - 0.00% MySQL) with 19 queries.

Both have the same php.ini as well.

Anyone seen that before? (forgive me if its been mentioned, 45 pages of thread were a bit much for me to surf through)

-k

Edit: I surfed back a ways and felt the need to add this:

Both servers are using the same php files (I rsync them to the other server after editing them), so I'm pretty sure the db_mysql.php is hacked properly.

TECK
12-17-2002, 07:37 PM
You didn't hack properly the db_mysql.php file. Double check please. :)

Boofo
12-17-2002, 07:40 PM
Believe it or not, Teck, but I got that same error with microstats when I installed in in vBHome Lite until I added your additional code that you posted for it over there. :)

mute
12-17-2002, 07:43 PM
If its not hacked properly, how come one server works with it, and the other server doesn't?

I am 150% sure they are using the same file, as i rsync the two servers to ensure both webservers are feeding off of the same source..

TECK
12-17-2002, 07:46 PM
Hmm... is wierd. I have it working perfectly on Apache 2.0.43 and Windows XP, on my localhost...
The error not showing the right time is because it doesn't see the microtime in the startpage variable, that's why you get 1,8765988768976 numbers.

mute
12-17-2002, 08:33 PM
I rehacked the db_mysql file just to be 100% certain, and rsync'd it back over, and it worked 100% on server1, but not on server2 :/

any other ideas?

TECK
12-17-2002, 09:08 PM
Give me your environment where you run the problem VB? os, php, mysql, etc

mute
12-17-2002, 09:54 PM
Evidentally I am an idiot :)

* mute bows

TECK, thanks for your help, if theres anything wrong with this hack is that its not idiot proof enough :)

TECK
12-17-2002, 10:33 PM
What was wrong? Just curious? :)
Don't worry, I make also mistake... like anyone else here... is human. :D

mute
12-17-2002, 11:06 PM
the problem was evidentally in global.php. I'm not sure why, but my rsync isn't updating as recursively as it should :)

Herman
12-23-2002, 10:00 PM
Thanks TECK!

/me clicks install

SiXXGuNNZ
12-25-2002, 01:34 AM
edit: fingered it out :)

TECK
01-03-2003, 08:00 PM
Good. :p ;)

Dribbles
01-05-2003, 09:25 PM
Just curious, are these stats bad? The server load and MySQL % seems high but I'm not sure what it means (I'm a noob):

Page generated in 1.27131300 seconds (22.60% PHP - 77.40% MySQL) with 29 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP enabled - level 1] [Server Load: 13.96 ? 15.02 : 12.76]

Also, I noticed that the queries goes up with each additional post I make to a thread ... is this normal? thnx guys :)

NTLDR
01-05-2003, 09:34 PM
Originally posted by Dribbles
[Server Load: 13.96 ? 15.02 : 12.76]

The server load is way too high, you want it be around 1 or lower if you can, the lower the better :)

Also, I noticed that the queries goes up with each additional post I make to a thread ... is this normal? thnx guys :)

No this isn't normal, and is very bad, I suggest you uninstall the hack thats causing this :)

Dribbles
01-05-2003, 09:36 PM
The server load is way too high, you want it be around 1 or lower if you can, the lower the better :)

Hi, thnx. Is the server load something on my side, or could it just be the server company I use?


No this isn't normal, and is very bad, I suggest you uninstall the hack thats causing this :)

Is there a way for me to find out which hack is doing this? Could it be Lesane's Store Hack? thnx again :)

Dribbles
01-05-2003, 09:39 PM
Update - I just double checked, the queries seem to only go up with the first reply I make ... I made a reply and queries went up to 32, but then made 3 more replies right after it and the queries stayed the same ... any difference? thnx

TECK
01-05-2003, 10:03 PM
Is normal. That's how VB works. But 32 queries is huge... normally you should have the default ones 17-20 (with poll), on an unhacked BB. remove all the nasty hacks.

Dribbles
01-05-2003, 10:08 PM
I knew it looked a bit large. My forum view page is only 20 queries, then when you go in to see the actual threads, some of them get up to 32 queries. I think it's because I did something where I added a custom profile field (3 of them: 1 for avatar url, 1 for avatar width, and one for avatar height) and have those fields called up in everyone's postbit?? Thnx for the reply BTW :)

I'm about to install your "Quick Delete Post" ( https://vborg.vbsupport.ru/showthread.php?s=&threadid=40523&perpage=15&display=&pagenumber=4 ) hack right now. That was the reason I installed this hack ... someone posted on that thread something about queries ... so I figured I would install this hack to see for myself if it affected queries or something :)

Wildthinks
01-09-2003, 04:59 AM
HI,

how can I use this on a non-VB page?
It's possible?
Have anybody hints for me?

THX :bunny:

neocorteqz
01-09-2003, 06:04 PM
Having a prblem installing this great hack... I keep getting this

Parse error: parse error in c:\apache\htdocs\forum\admin\functions.php on line 2386

Fatal error: Call to undefined function: iif() in c:\apache\htdocs\forum\admin\functions.php on line 352

Not sure how to fix this... I'm doing this on a clean install of Vbull(running on my puter) to test, then going to install it on my live board.

thanks for any help.

opps, almost forgot... running vBull 2.2.9

GOD-Dblade
01-14-2003, 11:39 PM
confirmed for 2.2.9

Xyphen
01-15-2003, 08:13 PM
I installed this on vb2.2.8 and I got a error..


Parse error: parse error in /homepages/42/d74004174/htdocs/forums/admin/functions.php on line 2499

Fatal error: Call to undefined function: iif() in /homepages/42/d74004174/htdocs/forums/admin/functions.php on line 505

TECK
01-17-2003, 01:57 AM
Guys, please use a decent text editor.
It's working perfectly on my 2.2.8 board as well on several 2.2.9 ones.

Disturbed
01-20-2003, 03:06 AM
it works great on vB 2.2.9 :)

anyway, how can i show users gzip stats?

Etcher
01-20-2003, 10:49 PM
Quick question...
Everything is working perfectly, but it is not showing my server load. I am on an IIS server, is there something that I need to do different?

TECK
01-20-2003, 10:53 PM
The server stats will show only on Apache, is explained in the first post...
Please take the time to read all information there, is useful.

SpeedStreet
01-27-2003, 09:04 PM
Originally posted by TECK
Guys, please use a decent text editor.
It's working perfectly on my 2.2.8 board as well on several 2.2.9 ones.

I am using Crimson Editor and Beyond Compare to make sure my hack transfer is absolutely perfect.

I am having the same exact problem here:

Parse error: parse error in /home/speedstr/public_html/forums/admin/functions.php on line 2549

Fatal error: Call to undefined function: iif() in /home/speedstr/public_html/forums/admin/functions.php on line 502


I poured over each line of your code and made sure I installed EXACTLY what was in the code posted in the first message of this thread. I have even tried relocating the str_replace at the end of dovars in functions, to see if that would help.

Any help would be appreciated.

SpeedStreet
01-29-2003, 06:15 PM
Anybody?

ranger2kxlt
02-02-2003, 07:52 AM
speedstreet i get the same error

anyone have the fix? im on 2.2.9

Mickie D
02-05-2003, 08:33 PM
hi i get this on my server i used the correct global and done it 2 times to make sure :)

Page generated in 1.03874302 seconds (4.79% PHP - 95.21% MySQL) with 42 queries.
[Debug Mode OFF] [PHP v4.2.3] [GZIP enabled - level 1] [Server Load: 0.96 ? 0.90 : 0.83]

well my queries are out of the roof for my main page they seem ok everywhere else ;) about 22-25

but my main page is nasty :(

can anyone tell me how i can find out what the queries are ??

i have many hacks installed, i am thankful that i found this hack maybe i can fix the problem out

Link14716
02-06-2003, 12:49 AM
I just attempted to install this hack.

However, it killed all of the replacements after I uploaded the files so I have to un-install it. :(

Any ideas?

EDIT: Only with 4.0.6 or higher?
* Link14716 goes to poke his host with a pointy stick.

Ah well, *clicks install*

I'll re-install once PHP is upgraded. ;)

neocorteqz
02-06-2003, 03:37 AM
Page generated in 0.17624104 seconds (100.00% PHP - 0.00% MySQL) with 32 queries.

Is this a Prob? besides the obvious high query count.

TECK
02-06-2003, 08:18 AM
Search the thread, it was asked several times.
Cheers.

mcyates
02-06-2003, 09:41 AM
63 quiries is that a lot???? For the index

SpeedStreet
02-06-2003, 12:55 PM
TECK,
Is there any hope to getting this thing resolved on our sites, those of us that are having issues?

TECK
02-06-2003, 02:23 PM
Originally posted by SpeedStreet
TECK,
Is there any hope to getting this thing resolved on our sites, those of us that are having issues?
I don't know what could cause this, probably some hack?
Test it on a unhacked board, you will see it's working perfect. :)

TECK
02-06-2003, 02:23 PM
Originally posted by mcyates
63 quiries is that a lot???? For the index
Is huge!

gameplanetz
02-06-2003, 05:03 PM
TECK,

Sorry for a newbie question but does custom profile field add queries in showthread.php?

Mickie D
02-06-2003, 08:37 PM
ok no one replied for me but i decided to check a few things out :)

i installed XENON'S hack to drop queries and some how it fixed my problem but sometimes the main forum home calls 21 queries and i have seen it call 28 also ????

can anyone explain ???

SpeedStreet
02-06-2003, 11:10 PM
Originally posted by ranger2kxlt
speedstreet i get the same error

anyone have the fix? im on 2.2.9

FIXED

I simply removed the following code from the Start Dooutput replacement:


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';
}

mhardin
02-09-2003, 08:17 PM
Thanks Teck!

I installed it on two servers today. Works Great!

Mike

NexDog
02-10-2003, 02:22 AM
Hmm, I seem to get 31 queries on the index page. Before I go ahead with Xenon's query decreasing hack, I'd like to know how to identify alot of these queries and cut down if possible.

Hacks installed:

Quick Reply
Chat
Arcade
Journal
Default PM
Karma
Local Time
Member Of The Day
ShoutBox
TopList
VBstory
Who was online today

There are a few others but those and a few of the above mentioned ones probably don't apply. What does anyone recommend?

NexDog
02-11-2003, 04:09 AM
Surely someone could help me out? Got a few grand waiting here for the lucky fellow. :P

TECK
02-11-2003, 09:16 AM
Please feel free to open a new thread in General Hacking Discussions, it has nothing to do with troubleshooting the hack itself.

NexDog
02-11-2003, 09:45 AM
Good idea, Teck - will do. :)

Stu
02-11-2003, 10:38 AM
Thanks Teck,
clicked Installed.... :)
I'm using this to evaluate a new Host Server so it's very useful.
I just had to alter it so that ALL Members could see the server loads, so I could get feedback from different users at different times, on the performance of the Server on test.

Kakarot
02-13-2003, 08:51 PM
This hack doesn't quite work with vBulletin 2.3.0 installation-wise, simply because the....

// ###################### Start dovars #######################
function dovars($newtext,$sendheader=1) {
// parses replacement vars

global $DB_site,$replacementsetid,$gzipoutput,$gziplevel, $newpmmsg;
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);
}

while ($var=$DB_site->fetch_array($vars)) {
if ($var['findword']!="") {
$newtext=str_replace($var['findword'],$var['replaceword'],$newtext);
}
}
..isn't found in the functions.php file...

TECK
02-13-2003, 10:09 PM
I'm going to install vb230 and release an update when I have time. :)

tkeil69575
02-15-2003, 11:04 AM
@kakarot
this worked for me with vb 2.3.0


while ($replacement = $DB_site->fetch_array($replacements))
{
if ($replacement['findword'] != '')
{
$vars["$replacement[findword]"] = $replacement['replaceword'];
}
if ($replacement['findword'] = '{getmicrostats}')
{
$vars["$replacement[findword]"] = $microstats;
}
}

Sebastian
02-16-2003, 09:49 PM
@tkeil69575, what code chunk did you find to replace that with?

can't seem to get it to work with 2.3.0.

tkeil69575
02-16-2003, 11:31 PM
sebastian,

see attached file

tina

ChuanSE
02-17-2003, 03:18 AM
changed the requested lines in the php files without backing up those three :/

result

Parse error: parse error, unexpected $ in /usr/local/psa/home/vhosts/forums.puredj.com/httpdocs/admin/functions.php on line 2331

Fatal error: Call to undefined function: iif() in /usr/local/psa/home/vhosts/forums.puredj.com/httpdocs/admin/functions.php on line 352

I can't enter the board anymore :(
does anyone can pass me the global.php from root/ and db_msql.php & functions.php from root/admin/ for vb 2.2.9 plz

Thx,
PureDJ.com

Serge
02-17-2003, 06:33 AM
You know you could just unzip vbulletin and take the those files from it.

blackice912
02-17-2003, 06:41 PM
Originally posted by tkeil69575
sebastian,

see attached file

tina

Works, thanks! :D

Tim Wheatley
02-22-2003, 08:39 AM
Works for me too. If it doesn't, be sure you're not selecting the tags = [php]

TECK
02-22-2003, 09:52 AM
Originally posted by tkeil69575
@kakarot
this worked for me with vb 2.3.0

if ($replacement['findword'] = '{getmicrostats}')
if ( $replacement['findword'] == '{getmicrostats}' )

peanut666
02-24-2003, 12:20 AM
thanks great hack

running fine on 2.2.9 with vbindex

Page generated in 0.13454604 seconds (81.56% PHP - 18.44% MySQL) with 19 queries.
[Debug Mode OFF] [PHP v4.3.0] [GZIP enabled - level 1] [Server Load: 0.14 » 0.12 : 0.09]

dont know what you recon on stats if there average or not

but hay it worked and im a newbie at this lol :banana:

Jawelin
02-25-2003, 12:14 PM
Originally posted by TECK

if ( $replacement['findword'] == '{getmicrostats}' )
I also noticed such assignment within the if-clause, but with this fix, question is: who puts '{getmicrostats}' value into replacement table ? :nervous:

Thank you very much for supporting this hack yet.
:)

SiXXGuNNZ
02-26-2003, 05:39 AM
okay I took original text, and updated that with the info posted by tkeil69575 and then updated that with tecks php edit and it is not working :(

I will attach the file showing the changes I made, i tried both the template and hard coded versions.

version2
02-26-2003, 06:21 PM
Hey guys.

Its not working because {getmicrostats} is not in the findword array. Just add {getmicrostats} to your replacement list via the admin control panel. Just leave the value (replace with) blank. Then it will work.

Convergys
02-26-2003, 08:34 PM
I have tried this as well and can't get it working. I am just having problems with functions.php
I can send someone my file if you like and they can fix it?

Xyphen
02-27-2003, 12:46 AM
I got it to work on vB2.3.0, did whatever the file said, didnt follow the fix for vB2.3.0 cuz it doesnt work, it only displays {getmicrostats}

Page generated in 0.20730102 seconds (61.54% PHP - 38.46% MySQL) with 49 queries.
[Debug Mode OFF] [PHP v4.1.1] [GZIP disabled] [Server Load: 0.00 ? 0.00 : 0.00]

But I also get this error at the top of every page.

Warning: Variable passed to reset() is not an array or object in /homepages/42/d74004174/htdocs/forums/admin/functions.php on line 602

Warning: Variable passed to each() is not an array or object in /homepages/42/d74004174/htdocs/forums/admin/functions.php on line 603

ChuanSE
02-27-2003, 06:18 AM
well, i can't get it to work either, dunno
maybe you guyz should explain us like we are 3y old :)

cheers and thx

version2
02-27-2003, 06:47 PM
*shrugs*

Crap, I dunno guys. I just followed the directions. Then after just getting {getmicrostats} displayed on each page I put it in the replacement table.

LeeCHeSSS
02-28-2003, 10:22 AM
It's not an elegant fix though :(

TECK
02-28-2003, 11:39 PM
The fix is easier then you think, no need to complicate your life like that. ;)
This the working version for VB 2.3.0...

neocorteqz
03-01-2003, 03:53 PM
I'm still using the instuctions from version 2.1 of the hack on 2.3.0 and it works fine.

Lexserv
03-04-2003, 07:10 AM
Hi TECK,

I'm not programmer but I've followed your every instruction in the text file, and still there are no results.

This is what I put in the footer:

<p align="center"><smallfont>
<!-- Do not remove this copyright notice -->
Powered by: vBulletin Version $templateversion<br>
Copyright &copy;2000 - 2002, Jelsoft Enterprises Limited.<br>
<!-- Do not remove this copyright notice -->
$copyrighttext<br>
{getmicrostats}
</smallfont></p>

What could I be doing wrong? Can you, or anyone, help me out here. Thanks in advance.

Edit: Never mind, I got it working now. :)