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)
-   -   Server Uptime (https://vborg.vbsupport.ru/showthread.php?t=40401)

Etcher 06-27-2002 10:00 PM

Server Uptime
 
Not really a HACK, but nice little script for information...

I added "System Uptime" to the footer of my site:

Save this as uptime.php:

<?PHP

$result = mysql_query("show status");
while ($row = mysql_fetch_array($result)){
if ($row['Variable_name'] == "Uptime") { $uptime = $row['Value']; }
}
$days = ((($uptime/60)/60)/24);
$wholeday = (int) $days;
$hours = (($days - $wholeday)*24);
$wholehour = (int) $hours;
$minutes = (($hours - $wholehour)*60);
$wholeminute = (int) $minutes;

echo "<center><font size=1>";
echo "System Uptime: ";
echo $wholeday . " Days ";
echo $wholehour . " Hours ";
echo $wholeminute . " Minutes <br>";
echo "</font></center>";

?>

Then "include" that file in your footer, or anywhere else you want it displayed.

The actual uptime is a check of mySQL dB.

Enjoy!

filburt1 06-28-2002 02:53 PM

You can also put that in your phpinclude template and then write the variables in the footer template.

Chris M 06-28-2002 02:59 PM

Cool!

Satan

Chris M 06-28-2002 03:07 PM

I think you will find that if you wanted add it to the Admin CP, you could do this :

in admin/index.php
Find :
PHP Code:

makenavselect("Options","<hr>");
// ************************************************* 

And add below :
PHP Code:

makenavoption("Uptime","uptime.php?s=");
makenavselect("Database");
// *** 

Then create a new file called uptime.php, and enter :
PHP Code:

<html>
<head>
<link rel="stylesheet" href="../cp.css">
</head>
</html>
<?PHP 

$result 
mysql_query("show status"); 
while (
$row mysql_fetch_array($result)){ 
if (
$row['Variable_name'] == "Uptime") { $uptime $row['Value']; } 

$days = ((($uptime/60)/60)/24); 
$wholeday = (int) $days
$hours = (($days $wholeday)*24); 
$wholehour = (int) $hours
$minutes = (($hours $wholehour)*60); 
$wholeminute = (int) $minutes

echo 
"<center><font size=1>"
echo 
"System Uptime: "
echo 
$wholeday " Days "
echo 
$wholehour " Hours "
echo 
$wholeminute " Minutes <br>"
echo 
"</font></center>"

?>

(The difference is, that this takes the CP colours and uses them instead of just white and black)

Satan

Chris M 06-28-2002 03:08 PM

Just incase you want to know:)

Satan

Boofo 06-28-2002 05:02 PM

How would I use the code for this? Where would I put the code and how would I call it in here?

makelabelcode('Server Uptime', uptime.php);

Chris M 06-28-2002 06:29 PM

Just put the php in a file called "uptime.php", and upload it to your admin folder...

Satan

TheWulff 06-28-2002 09:43 PM

How would I change the text color to white ? Sorry newbie to PHP..

Chris M 06-28-2002 10:00 PM

I believe you would enter this :

PHP Code:

<html>
<head>
<link rel="stylesheet" href="../cp.css">
</head>
</html>
<?PHP 

$result 
mysql_query("show status"); 
while (
$row mysql_fetch_array($result)){ 
if (
$row['Variable_name'] == "Uptime") { $uptime $row['Value']; } 

$days = ((($uptime/60)/60)/24); 
$wholeday = (int) $days
$hours = (($days $wholeday)*24); 
$wholehour = (int) $hours
$minutes = (($hours $wholehour)*60); 
$wholeminute = (int) $minutes

echo 
"<center><font color="#FFFFFF"><font size=1>"; 
echo "System Uptime: "
echo 
$wholeday " Days "
echo 
$wholehour " Hours "
echo 
$wholeminute " Minutes <br>"
echo 
"</font></font></center>"

?>

Satan

TheWulff 06-28-2002 10:08 PM

Thanks for the reply but nope, bot this error...

Parse error: parse error, expecting `','' or `';'' in /home/sites/site33/web/uptime.php on line 15


All times are GMT. The time now is 06:54 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.01052 seconds
  • Memory Usage 1,752KB
  • 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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