Jump to content

adding too existing server status code


final60

Recommended Posts

Im just wondering if I might be able to add to the existing server status php code I have on my site. It simply shows different images (green for server open, amber for server lock, red for server closed). How might i add to the code to log the last time the server closed and could I use a counter from the point when the server status displays open?

 

So it additionally have:

 

Last reset: Jan 4th 2009 13:44  (When the server status last displayed the red "closed" image)

Uptime: 24hrs 32m 14s (A counter running from when server status last displayed the green "open" image)

 

 

<?php   // retrieve information from Ryzom's website   $server_data = file('[url=http://atys.ryzom.com/serverstatus/status.php]http://atys.ryzom.com/serverstatus/status.php[/url]');   for ($i = 0; $i < sizeof($server_data); $i ++)   {      $data = explode('|',$server_data[$i]);      $server = $data[0];	  $status = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_closed.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_closed.jpg]http://www.dcpryzom.co.uk/images/server_closed.jpg[/url]</a>" alt="Closed" />';  	  $server_img['Aniro'] = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_ani.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_ani.jpg]http://www.dcpryzom.co.uk/images/server_ani.jpg[/url]</a>" alt="Aniro"/>';      $server_img['Leanon'] = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_lea.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_lea.jpg]http://www.dcpryzom.co.uk/images/server_lea.jpg[/url]</a>" alt="Leanon"/>';      $server_img['Arispotle'] = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_ari.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_ari.jpg]http://www.dcpryzom.co.uk/images/server_ari.jpg[/url]</a>" alt="Arispotle"/>';      switch($data[1])      {			case 1:  $status = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_open.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_open.jpg]http://www.dcpryzom.co.uk/images/server_open.jpg[/url]</a>" alt="Open" />'; break;			case 2:  $status = '<img src="<a href="http://www.dcpryzom.co.uk/images/server_locked.jpg" target="_blank">[url=http://www.dcpryzom.co.uk/images/server_locked.jpg]http://www.dcpryzom.co.uk/images/server_locked.jpg[/url]</a>" alt="Locked" />'; break;      }      echo $server_img[$server] . $status .'<br />';   }?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.