The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
spherestatusbase
Author Message
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #1
spherestatusbase
I'm trying to show an uptime on my server status, I read on the wiki and saw I could use %TIME%, but it said it shows the uptime in tenths of a second. How would i do this so it would show the uptime in minutes, hours, or even days?

Thanks for any help!
09-06-2013 09:49 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #2
RE: spherestatusbase
Well the first thing you need to know is how to tell time: http://www.wikihow.com/Teach-Kids-to-Tell-Time
09-07-2013 12:56 AM
Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #3
RE: spherestatusbase
Although it was a very informative website, it did not help me figure my situation out
09-07-2013 07:02 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #4
RE: spherestatusbase
Then you need to know how to do math in a web page: http://www.scriptingmaster.com/javascrip...c-math.asp
09-07-2013 07:21 AM
Find all posts by this user Like Post Quote this message in a reply
KyleH112
Apprentice
*

Posts: 18
Likes Given: 0
Likes Received: 6 in 4 posts
Joined: Oct 2012
Reputation: 0



Post: #5
RE: spherestatusbase
(09-06-2013 09:49 PM)Leonidas Wrote:  I'm trying to show an uptime on my server status, I read on the wiki and saw I could use %TIME%, but it said it shows the uptime in tenths of a second. How would i do this so it would show the uptime in minutes, hours, or even days?

Thanks for any help!

If your hosting your server from a Windows machine and running PHP you can use something like this... What this script does is pulls your computers/servers pagefile.sys file which stores your computers/system/servers information and it will extract the uptime in this format ( #Days, #Hours, ##Minutes, ##Seconds) and will also show the last time the system was rebooted.


Code:
<?php
$pagefile = 'c:\pagefile.sys';

function ifif ($value, $true, $false)
{
    if ($value == 0)
    {
        return $false;
    }  
    else
    {
        return $true;
    }  
}  

$upsince = filemtime($pagefile);
$gettime = (time() - filemtime($pagefile));
$days = floor($gettime / (24 * 3600));
$gettime = $gettime - ($days * (24 * 3600));
$hours = floor($gettime / (3600));
$gettime = $gettime - ($hours * (3600));
$minutes = floor($gettime / (60));
$gettime = $gettime - ($minutes * 60);
$seconds = $gettime;

$days   = ifif($days != 1, $days . ' days', $hours . ' day');
$hours   = ifif($hours != 1, $hours . ' hours', $hours . ' hour');
$minutes = ifif($minutes != 1, $minutes . ' minutes', $minutes . ' minute');
$seconds = ifif($seconds != 1, $seconds . ' seconds', $seconds . ' second');

echo '<font color="red">Uptime:</font> ' . $days . ' ' . $hours . ' ' . $minutes . ' ' . $seconds;
echo '<br /> <font color="red"> Rebooted:</font> ' . date('l. F jS, Y. h:i a', $upsince);
?>
10-09-2013 02:59 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)