vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   vbMicroStats: page load time, queries, GZIP and PHP version (https://vborg.vbsupport.ru/showthread.php?t=35811)

TECK 06-22-2002 04:33 AM

Quote:

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. :)

Quote:

Originally posted by nakkid
to find out why your server load stats are not showing.

TECK 06-22-2002 04:37 AM

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.

Quote:

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.

TECK 06-22-2002 04:45 AM

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. :)

Quote:

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.


TECK 06-22-2002 04:53 AM

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

Quote:

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.

LuBi 06-22-2002 07:34 PM

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..

TECK 06-22-2002 07:42 PM

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.

TECK 06-22-2002 07:49 PM

Quote:

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...

N9ne 06-22-2002 10:11 PM

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.

TECK 06-23-2002 03:59 PM

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?

LuBi 06-23-2002 10:21 PM

Quote:

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:

TECK 06-23-2002 10:53 PM

Quote:

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...

TECK 06-23-2002 11:00 PM

Quote:

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:
Code:

// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {

  global $pagestarttime,$query_count,$showqueries,$querytime,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$microstats;

  $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:
Code:

// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {

  global $pagestarttime,$query_count,$showqueries,$querytime,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$microstats;

  $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:
Code:

Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.<br>
[$debugmode] [PHP v$versionnum] [$gziptext] $serverload

Don't forget to remove the spaces between [high]hovercolor[/high] brackets.

LuBi 06-23-2002 11:06 PM

Quote:

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..

TECK 06-23-2002 11:11 PM

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 -

Quote:

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?

TECK 06-27-2002 08:32 PM

Quote:

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.

Quote:

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?



PHP Code:

// ###################### 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(=> '{bbusername}');
  
$replacewords=array(=> "$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,$newtext); 

and

PHP Code:

// ###################### 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(=> '{getmicrostats}');
  
$replacewords=array(=> $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,$newtext); 



???

TECK 06-28-2002 03:23 AM

Quote:

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.

TECK 06-28-2002 03:34 AM

Quote:

Originally posted by Xelation
how could I combine these two together?
find:
Code:

$findwords=array(0 => '{getmicrostats}');
$replacewords=array(0 => $microstats);

replace it with:
Code:

$findwords=array(0 => '{getmicrostats}', 1 => '{bbusername}');
$replacewords=array(0 => $microstats, 1 => $bbusername);


Bro_Joey_Gowdy 06-28-2002 04:44 AM

Quote:

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:

Quote:

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 ?

TECK 06-28-2002 04:45 AM

22queries is very good. :)

Bro_Joey_Gowdy 06-28-2002 04:47 AM

so what would be considered 'bad' ?

TECK 06-28-2002 04:49 AM

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)

TECK 06-28-2002 05:05 AM

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? :)

Quote:

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, 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

TECK 06-30-2002 02:53 PM

Quote:

Originally posted by Blak n Wite
Referring to this post, 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

Quote:

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:


All times are GMT. The time now is 01:01 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02025 seconds
  • Memory Usage 1,867KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (20)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete