[php] Server Status with Image

Joined
Apr 22, 2005
Messages
19
Reaction score
0
Hi guys i am just wondering how do i put php script in index.html

I have got a website with Server Status. but i just dont know how to link this server status to the server just so it would automatically be updated when it is up/down
 
Are you wishing to echo an image when the site is up or down? Or just plain text?

PHP:
<?
@$socket = fsockopen("IP" , "PORT");
 if(!$socket) { 
  ?> <td> <b> <font color = "red"> Server Offline! </font> </b> </td><?
 } else { 
  fclose($socket); 
  ?> <td> <b> <font color = "green"> Server Online! </font> </b> </td><?
 } 
?>

Just change where it says Online/Offline to an image source to echo an image.
 
i have tried using that code stated by tyler, but it is plain text. I am trying to make it using the designed image that i have done when it is online/offline.

How should i link them to my server so that it will be automatically updated where Online with green button image and Offline with Red button image. I have made the buttons and layout and such. But just got no idea on how to make them automatically updated.
 
i have tried using that code stated by tyler, but it is plain text. I am trying to make it using the designed image that i have done when it is online/offline.

It's just text? REALLY? How about you change that text to images then?
from

Code:
<td> <b> <font color = "red"> Server Offline! </font> </b> </td>
to
Code:
<img src="yourofflineimage.jpg" />
PHP:
  <?
@$socket = fsockopen("IP" , "PORT");
if(!$socket) {
?> <td> <b> <font color = "red"> Server Offline! </font> </b> </td><?
} else {
fclose($socket);
?> <td> <b> <font color = "green"> Server Online! </font> </b> </td><?
}
?>
 
Back