• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Show UpTime error

jestem pro

That is the question
Joined
Apr 20, 2013
Messages
650
Solutions
14
Reaction score
87
Hello, I use MyACC and I wanna display UpTime on a website but there's something wrong.

Code in status.php
PHP:
$status['uptime'] = $serverStatus->getUptime();
        $h = floor($status['uptime'] / 3600);
        $m = floor(($status['uptime'] - $h * 3600) / 60);
        $status['uptimeReadable'] = $h .'h '.$m.'m';

so when I use $status['uptime'] --- shows uptime in seconds ex. 560 sec
using $status['uptimeReadable'] shows nothing but needed declaration before $status['uptimeReadable'] = ' ';

And I can't figure out what's going on
 
View attachment 41751
echo $status['uptime'].'<br>'; echo $status['uptimeReadable'];
You have the newest version?
Sure you calling it correct?
if the variable is set the first time it shows but refreshing page there is nothing at all


I know that the problem is in when I declare the variable before to this
$status['uptimeReadable'] = ' ';
then after refresh it's set to null

but not using declaration it shows:
Notice: Undefined index: uptimeReadable in C:\\\****\xampe\htdocs\templates\tibiacom\index.php on line 193

I need it in index.php
 
Last edited:
why are you declaring it again?
Its already declared on the status page.

You literally just need to post the code I posted above into index.php and it displays.
Why are you using $status['uptimeReadable'] = ' '; thats just setting it to be blank.

The code in my previous post was inside of templates\tibiacom\index.php in a renadom place on the page and it shows the server uptime.
You do not need to edit status.php nor use the code in there.
Just:
echo $status['uptime'].'<br>'; echo $status['uptimeReadable'];
as i said in previous post.

If this doesn't work. You have broken something.
And haven't posted your code for anyone to debug. Sadly people aren't born with the ability to read minds.
 
I put it in anywhere and shows this:

Lua:
4
[B]Notice[/B]:  Undefined index: uptimeReadable in [B]C:\****\******\******\xampe\htdocs\templates\tibiacom\index.php[/B] on line [B]270[/B]


And I didn't change anything else

It's strange

I can tell you that it shows sometimes the uptime but it seems like the variable is not storing the data when I try to refresh the page
 
I know something is wrong with this variable. Saw the same problem few times.

Just never had time to debug it completely.. It's true its undefined sometimes, somehow. Dunno why.

Let me check.
 
I know something is wrong with this variable. Saw the same problem few times.

Just never had time to debug it completely.. It's true its undefined sometimes, somehow. Dunno why.

Let me check.
yes man the hint can be it returns showing the uptime after a few minutes again. And after next reload disappear. It seems as store the variable in specific moment only.
 
Back
Top