Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 365
0 Users 3 Guests Online

PHP Server Status

On the page you want to put the server status, put this code:
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
<?php
$churl 
= @fsockopen("IPADDRESS"PORT$errno$errstr5);

if(!
$churl)
{
    
$statusMSG "OFFLINE MESSAGE";
}
else
{
    
$statusMSG "ONLINE MESSAGE";
}
?>

Change IPADDRESS to the IP address of the server, PORT to the port the server is running on, OFFLINE MESSAGE to the message you want to be shown when the server is offline (can be HTML), and ONLINE MESSAGE to the message you want to be shown when the server is online (can be HTML).

Then, where you want the message to appear, put this:
PHP Code
1
<?php echo $statusMSG?>


Hope you like it!
Xerofait
Author:
Views:
2023
Rating:
Posted on Friday 16th May 2008 at 01:43 PM
jambomb
jambomb
NICE!