You are missing our premiere tool bar navigation system! Register and use it for FREE!


Author: Tank863Location: PhiladelphiaPostPosted: Sun Jun 13, 2004 6:34 pm    Post subject: Re: The Serverload.php Install Help

Open footer.php and search for:
NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 

Author: NukeFanaticPostPosted: Sun Jun 13, 2004 6:03 pm    Post subject: Re: The Serverload.php Install Help

im not familiar with serverload.php - what is it and where can you get it?

have you tried:
http://www.nukecops.com/postt7091.html

Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 225 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - The Serverload.php Install Help The Serverload.php Install Help

Nuke Cops -> Installation for Newbies

Author: BeatJunkie PostPosted: Sun Jun 13, 2004 5:33 pm    Post subject: The Serverload.php Install Help

I am going nuts, I have searched the forum up and down and all the answers are unclear too me. I have serverload.php in my Nuke Root directory. Where do I add the include and how how do I call it? Please give me step by step. Many thanks in advance.
Quote:

"Where do I add the include and how how do I call it?"


"add the include?" <- is this part of th install?

"how do i call it" <- you call php programs by typing therir name in the addressbar
of your browser. ie http://mydomain.com/serverload.php

don
Code:
function foot() {


Before add:
Code:

// SERVER LOAD
   include("serverload.php");
   $serverload=serverload();
//
// Compress buffered output if required and send to browser
//
if ( $do_gzip_compress )
{
   //
   // Borrowed from php.net!
   //
   $gzip_contents = ob_get_contents();
   ob_end_clean();
   $gzip_size = strlen($gzip_contents);
   $gzip_crc = crc32($gzip_contents);
   $gzip_contents = gzcompress($gzip_contents, 9);
   $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
   echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
   echo $gzip_contents;
   echo pack('V', $gzip_crc);
   echo pack('V', $gzip_size);
}
/* Un-comment the line below to restrict Admins only to view page generation info */
//if( ($userdata['session_logged_in']) and ($userdata['user_level'] == ADMIN) )
{
   $gzip_text = ($board_config['gzip_compress']) ? 'GZIP enabled' : 'GZIP disabled';
   $debug_text = (DEBUG == 1) ? 'Debug on' : 'Debug off';
   $excuted_queries = $db->num_queries;
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $total_time = round(($endtime - $start_time), 4);
   $sql_time = round($db->sql_time, 4);
   $sql_part = round($sql_time / $total_time * 100);
   $php_part = 100 - $sql_part;
   echo '<div style="font-family: Verdana; font-size: 10px; color: #000000; letter-spacing: -1px" align="center">[ Page generation time: '. $total_time .'s (PHP: '. $php_part .'% - SQL: '. $sql_part .'%) ] - [ SQL queries: '. $excuted_queries .' ] - [ Pages served in past 5 minutes : '. $serverload .' ] - [ '. $gzip_text .' ] - [ '. $debug_text .' ]</div><br>';
}

echo "<div style=\"font-family: Verdana; font-size: 10px; color: #000000; letter-spacing: -1px\" align=\"center\">$copyright</div>";
echo "<div style=\"font-family: Verdana; font-size: 10px; color: #000000; letter-spacing: -1px\" align=\"center\">All graphics, contents and trademarks are property of their respective owner. The comments are property of their posters.</div>";
echo "<div style=\"font-family: Verdana; font-size: 10px; color: #000000; letter-spacing: -1px\" align=\"center\">Unless stated otherwise, all the rest 2003 <a href=\"http://YOURSITE.COM\" target=\"_blank\">YOURSITE.COM</a> all rights reserved.</div>";
}


Change the last line by putting in the name of your site.. where it says yoursite.com....
And your done. Now you should have something similar as this:
Code:

[Page generation time: 2.4016s (PHP: 25% - SQL: 75%) ] - [ SQL queries: 158 ] - [ Pages served in past 5 minutes : 50 ] - [ GZIP disabled ] - [ Debug off ]


If you have any problems let me know.. it took me a few tries to get it to work correctly..

Author: telli PostPosted: Sun Jun 13, 2004 7:34 pm    Post subject:

You may also want to update the serverload.php if it is the original from kc33. I rewrote the function and released it as a download last week if you want it. Or you can just replace the whole function serverload:

Code:

<?php
/*****************************************************/
/* Function serverload taken from Kc-gentime         */
/* Original author kc33                              */
/* Optimized and cleaned up by Telli                 */
/* telli@codezwiz.com - http://codezwiz.com               */
/* Come and see us for more great scripts!           */
/*****************************************************/ 
function serverload() {
     global $prefix, $db;
   $duration = "300"; //set for time for # of page loads default is 5 mins
      $db->sql_query("DELETE FROM ".$prefix."_serverload WHERE time < " . (time()-$duration));
      $db->sql_query("INSERT INTO ".$prefix."_serverload (time) VALUES (" . time() . ")");
      $numrow = $db->sql_numrows($db->sql_query("SELECT time FROM ".$prefix."_serverload"));
      return ($numrow);
}
?>


The whole version is available here without registering.

http://www.codezwiz.com/downloadview-details-309-Kc_Gen_Time_Revisited.html


Last edited by telli on Sun Jun 13, 2004 8:26 pm; edited 2 times in total

Author: BeatJunkie PostPosted: Sun Jun 13, 2004 7:43 pm    Post subject: Re: The Serverload.php Install Help

Your site gives a 403 Error.... =( Anyways, I finally got the code too work but.... Check this out, the page generation times can't be this high...

[ Page generation time: 1087184429.13s (PHP: 100% - SQL: 0%) ] - [ SQL queries: 0 ] - [ Pages served in past 5 minutes : 5 ] - [ GZIP disabled ] - [ Debug off ]

Can someone check my site and tell me what I did wrong?
http://www.beat-junkies.net

Author: telli PostPosted: Sun Jun 13, 2004 8:21 pm    Post subject:

What's your IP?

Looks you need to global the $total_time and the $start_time. You also should have had a new db/mysql.php to upload which has the added functions for counting the queries and the the query time.

Author: BeatJunkie PostPosted: Mon Jun 14, 2004 1:14 pm    Post subject: Re: The Serverload.php Install Help

Hey Telli, any word on those other tables I need too add so that my SQL Inquiries and Page Load times show correctly?



Nuke Cops -> Installation for Newbies

All times are GMT - 8 Hours

Page 1 of 1

Powered by phpBB © 2001,2002 phpBB Group
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.046 Seconds - 311 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
added by Evaders - DO NOT REMOVE
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::