 |
 |
 |
 |
#279333 - 09/23/04 04:23 PM
Re: Could the "who's online" time be decreased ? :)
[Re: Luka_dup1]
|
Coder
Registered: 09/12/03
Posts: 816
Loc: Hollywood Florida.
|
<img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" /><br /><br />load this script into a file named "serverload.php" and upload it to yor server then call it up in the browser. It will tell you.<br /> <?php<br /><br /> $loadavg_array = explode(" ", exec("cat /proc/loadavg"));<br /> $loadavg = $loadavg_array[2];<br /> print("Server load: " . $loadavg . "%");<br />?> <br /><br />This little code will tell you how long the server has been up since last reboot.. we can call this one server-uptime.php <br /> <p><font color="#999999"> <br /><?<br />function linuxUptime() {<br /> $ut = strtok( exec( "cat /proc/uptime" ), "." );<br /> $days = sprintf( "%2d", ($ut/(3600*24)) );<br /> $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) );<br /> $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 );<br /> $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60 );<br /> return array( $days, $hours, $min, $sec );<br />}<br />$ut = linuxUptime();<br />// If you would like to show the seconds as well just add [ , $ut[3] seconds ] after minutes.<br /><br />echo "Time since last reboot: $ut[0] days, $ut[1] hours, $ut[2] minutes, $ut[3] seconds"<br />?><br /></font></p> <br /><br /> <img src="http://www.ubbdev.com/forum/images/graemlins/smirk.gif" alt="" />
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#279337 - 09/30/04 05:53 PM
Re: Could the "who's online" time be decreased ? :)
[Re: Luka_dup1]
|
Veteran
Registered: 02/22/02
Posts: 2575
Loc: England
|
Monkeyra,<br /><br />Not sure about a 'stats page' but if you want to include this on your control panel index page....<br /><br />In templates/default/admin/login.tmpl<br /><br /><br />###<br />###find<br />###<br /><br /><br />$pa_link<br />$db_link<br />$modq_link<br /><br />###<br />###Change to<br />###<br /><br /><br />$pa_link<br />$db_link<br />$modq_link<br /><br /><br /> <br /><br /><br /><br />UBBTPRINT;<br /><br /><br /><br /> $loadavg_array = explode(" ", exec("cat /proc/loadavg")); $loadavg = $loadavg_array[2]; print("Server load: " . $loadavg . "%"); <br /><br /><br />echo <<<UBBTPRINT<br /><br /><br /><br /><br /><br /><br /><br />UBBTPRINT;<br /><br /> function linuxUptime() { $ut = strtok( exec( "cat /proc/uptime" ), "." );<br /> $days = sprintf( "%2d", ($ut/(3600*24)) );<br /> $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) );<br /> $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 );<br /> $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60 );<br /> return array( $days, $hours, $min, $sec );<br /> }$ut = linuxUptime();<br /> print ("Time since last reboot: $ut[0] days, $ut[1] hours, $ut[2] minutes, $ut[3] seconds");<br /> <br />echo <<<UBBTPRINT<br /><br /><br /> <br /><br /><br /><br />------------------<br /><br />This is very similar to Dr. C's code except I am using the print command rather than the .echo
_________________________
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|