![]() |
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! |
You can also put that in your phpinclude template and then write the variables in the footer template.
|
Cool!
Satan |
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:
PHP Code:
PHP Code:
Satan |
Just incase you want to know:)
Satan |
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); |
Just put the php in a file called "uptime.php", and upload it to your admin folder...
Satan |
How would I change the text color to white ? Sorry newbie to PHP..
|
I believe you would enter this :
PHP Code:
|
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 |
Ok well im a newbie at this, i created the uptime.php and uploaded it but how do i "include" that in my footer, is there a code?
|
PHP Code:
TheWulff - Hmmm... Try : PHP Code:
|
<a href="http://www.mwgclan.net/forums/" target="_blank">http://www.mwgclan.net/forums/ </a> php is in the root.php is in the root.i included your code at the bototm where it says server uptime: but it dosent work, and yes the file is in the root
|
I am trying to put it in the Quick Stats between Server type and MySQL. I want it to display the time there.
Quote:
|
nice
|
nice
|
nice :)
|
hellsatan code worked this time, but still lost as to the include ? do I have to include it in phpinclude ? or copy the code above in the footer ? Thanks for the help, much apperciated.
|
What...
You mean : PHP Code:
Satan |
What...
You mean : PHP Code:
Satan |
What...
You mean : PHP Code:
Satan |
hehe I now that but I dont know how to include it in my footer ;(
|
Now this is a pretty cool idea
Cheers to evryone for their input so far :) Does anyone have an idea on what the best way would be to integrate this with Admin Quick Stats ? This is what currently is displayed in my /admin/index.php http://www.vianet.net.au/~daren/vbul...quickstats.jpg And I would like to add its content directly below -Server Type -MYSQL entries if possible |
Neither way is working.
I tried including it in the footer: how would that work anyway? No PHP parsing down there. I tried parsing the code in the phpinclude-template and then used echo to show the values: there are none. Somehow I just can't get values to show - not even running "uptime.php" directly gives me valid numbers (0 0 0 must be wrong). |
*gee* :eek:
paste this into your phpinclude template PHP Code:
Code:
<smallfont>System Uptime: $wholeday Days $wholehour Hours $wholeminute Minutes |
I told you I did that.
And as I said, it's (still) not working. |
Ok, it's somehow my fault.
I've already got a "script" in my phpinclude-template and it looks like it doesn't really like yours. Any way to let the vB know where one "script" ends and where another one starts? |
Never mind.
I just cut the script there was out and pasted it back in - it seems to work now. Thanks ;) |
How would you make a single variable out of it so you can call it like this:
$sysuptime I'm trying to put it in my Quick Stats in the admin cp. And where would I call the variable from? Still in my phpinclude? Quote:
|
For those that want seconds as well, here you go :)
PHP Code:
PHP Code:
PHP Code:
|
You can also call it via its own template. use nuno's code then do this
in global.php find PHP Code:
PHP Code:
go to your admin cp and add a new template called uptime and paste this into it Code:
<smallfont>System Uptime: $wholeday Days $wholehour Hours $wholeminute Minutes in the footer replace this Code:
$copyrighttext<br> Code:
$copyrighttext<br>$uptime untested but sould work :) |
How would I use this in the admin cp in the index file? It doesn't seem to like it when I try to call it from phpinclude...nothing show up.
|
Has anyone come up with a way to do this
https://vborg.vbsupport.ru/showthrea...264#post267264 |
Do the following:
In your admin/index.php add this: Code:
//Server Uptime Code Code:
makelabelcode('MySQL', 'v' . $mysqlversion['version']); Enjoy! :) Quote:
|
Cheers Boofo
Worked like a charm :) Quote:
|
I'm also working on an extention to the Quick Stats that will give you even more information. This is just a start.
Code:
Server Type Quote:
|
Looks pretty cool so far
Good luck :) |
Here's the top part of it that I have done and working so far. It is in a table like the Quick Stas but shorter. :)
vBulletin Extra Options Menu vBulletin Options Modify Replacements Private Messages View Main Forum View Memberlist Run a SQL query Modify Templates Spin Threads New Message Posts View Online Users Quick Template Search |
jus moved my forum over to a new forum, and now the uptime is stuck on my last server's uptime, any suggestions
|
Use myphpadmin and go to the table and delete the row, I think. Look in the database and it should be pretty self-explanatory.
|
All times are GMT. The time now is 03:00 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|