View previous topic :: View next topic |
Author |
Message |
crs992 -
Joined: 15 Jun 2005 Posts: 32
|
Posted: Sat Mar 04, 2006 12:27 am Post subject: server uptime on page |
|
|
how do you show the server uptime on you home page using php or cgi? |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Mar 04, 2006 1:43 am Post subject: |
|
|
I use php. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
crs992 -
Joined: 15 Jun 2005 Posts: 32
|
|
Back to top |
|
 |
NickC -
Joined: 02 Mar 2006 Posts: 6
|
Posted: Sat Mar 04, 2006 4:09 am Post subject: |
|
|
I guess you'd parse the persist.data file in Abyss's directory to find the <uptime> and <since> info, then format it and output it.
Seems reasonable, but I don't work for Aprelium. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Mar 04, 2006 5:30 am Post subject: |
|
|
Read the Abyss Web Server Documentation on "CGI Environment Variables" and
you will find some pretty nice information. Your answer is in that section. LateR!
In a PHP script, use the following code to find them. X_ABYSS etc.
Code: |
<?php
phpinfo();
?>
|
Sincerely, TRUSTpunk |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Mar 04, 2006 10:59 am Post subject: |
|
|
You can use PHP to get the actual PC uptime or you can use an SSI to get Abyss's uptime. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
crs992 -
Joined: 15 Jun 2005 Posts: 32
|
Posted: Sat Mar 04, 2006 2:21 pm Post subject: |
|
|
does anyone have a script that i may use written in php or an example on how to do this? _________________ http://crs992.bounceme.net:8080/ |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Mar 04, 2006 2:38 pm Post subject: |
|
|
Code: |
<?php
$pagefile = "C:\pagefile.sys";
$uptime = (time() - filemtime($pagefile));
$updays = floor($uptime / (24*3600));
$uptime = $uptime - ($updays * (24*3600));
$uphours = floor($uptime / (3600));
$uptime = $uptime - ($uphours * (3600));
$upminutes = floor($uptime /(60));
$uptime = $uptime - ($upminutes * 60);
$upsecs = $uptime;
?>
<table border="0" align="center">
<tr>
<td><font size="1" face="tahoma"><b>Server Uptime:</b> <?php echo($updays); ?>d, <?php echo($uphours); ?>h, <?php echo($upminutes); ?>m, <?php echo($upsecs); ?>s
</table> |
_________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
crs992 -
Joined: 15 Jun 2005 Posts: 32
|
|
Back to top |
|
 |
|