Show Server Status
Show server stats.
Checks FTP, HTTP, POP3
Then Displays If there working or not
For a working demo visit
http://k2-coding.net/serverstats/
Create some images
green-status.gif
red-status.gif
Or use the following
and read the comments in the script!
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
$mainsite = "localhost"; // this is the site you wish to check.
// Let's check our common ports 80, 21, and 110
$http = fsockopen($mainsite, 80);
$ftp = fsockopen($mainsite, 21);
$pop3 = fsockopen($mainsite, 110);
// Check To See All Ports Are Working.
if ($http) {
$httpstat .= "<img src='green-status.gif' align='center'><font face='Verdana' size='2'> OK</font>";
}
else {
$httpstat .= "<img src='red-status.gif' align='center'><font face='Verdana' size='2'> N/A</font>";
}
if ($ftp) {
$ftpstat .= "<img src='green-status.gif' align='center'><font face='Verdana' size='2'> OK</font>";
}
else {
$ftpstat .= "<img src='red-status.gif' align='center'><font face='Verdana' size='2'> N/A</font>";
}
if ($pop3) {
$popstat .= "<img src='green-status.gif' align='center'><font face='Verdana' size='2'> OK</font>";
}
else {
$popstat .= "<img src='red-status.gif' align='center'><font face='Verdana' size='2'> N/A</font>";
}
echo "
<table border='1' cellpadding='7' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='25%'>
<tr>
<td width='100%' colspan='2' bgcolor='#F0F0F0'>
<p align='center'><b><font face='Verdana' size='2'>Current Server Stats</font></b></td>
</tr>
<tr>
<td width='100%'><b><font face='Verdana' size='2'>HTTP:</font></b></td>
<td width='41%'>
<p align='center'>$httpstat</td>
</tr>
<tr>
<td width='100%'><b><font face='Verdana' size='2'>FTP:</font></b></td>
<td width='41%'>
<p align='center'>$ftpstat</td>
</tr>
<tr>
<td width='100%'><b><font face='Verdana' size='2'>POP3:</font></b></td>
<td width='41%'>
<p align='center'>$popstat</td>
</tr>
</table>
";
?>