How to: Make a server status checker

03/30/2008 00:10 cjainy#1
Okay guide on how to make a server status checker accessed in your browser.

Things you will need:
apache server
php processor
or just AppServ
internet access
Snaity's php.ini

1) Install AppServ
2) Open notepad
2a) Put the following code into the file:
Code:
<form action="status.php" method="post">
Enter Server IP: <input type="text" name="ip" /><br>
Enter Port: <input type="text" name="port" /><br>
<input type="submit" />
</form>
Save as index.php if a message saying "Would you like to replace xxxxxxxx" Click yes
3) Open Notepad again
3a) Put the following code into the file:
Code:
<?php
			
			echo "Status: ";
			 = @fsockopen(ip, port, errno, errstr, 1);
			if (!) {
				echo "<B>Offline</B>";
			}
			else
			{
				echo "<B>Online</B>";
				fclose();
			}
			?>
Throw a $ sign infront of ip port errno and errstr then save it as status.php

4) Place the php.ini inside of C:\WINDOWS\
5) Go to localhost in your browser and you will see the results :)
The status checker should look somewhat like this when your done:

How to use checker:

Type in the server IP and port then hit SubmitQuery
04/04/2008 05:47 Acidburncx#2
but i also notice that leavemealone made 1 of this but there was a bug cuz when server down the status said was online hope urs better i check it out tomorrow f there is a bug
05/25/2008 02:16 privt#3
Parse error: syntax error, unexpected '=' in /home/halls6/public_html/bsc/status.php on line 4

How can i fix that? i did as you said and this is what i get.
05/25/2008 23:48 adz06676#4
Quote:
Originally Posted by privt View Post
Parse error: syntax error, unexpected '=' in /home/halls6/public_html/bsc/status.php on line 4

How can i fix that? i did as you said and this is what i get.
I got same problem.
05/29/2008 03:16 hok30#5
Works for me, although the pictures are broken links (in your guide).
05/30/2008 02:47 walmartboi#6
Time to correct your sucky coding, if this is even your work:
Here is the Web Form:
Code:
<form action="status.php" method="post">
Enter Server IP: <input type="text" id="ip" name="ip" /></input><br>
Enter Port: <input type="text" id="port" name="port" /></input><br>
<input type="submit" value="Check Status!" />
</form>
Here is the status.php:

[Only registered and activated users can see links. Click Here To Register...]
The PHP and Code tags are gay here, so I had to upload it onto a host!

+Thanks would be nice.

@cjainy I prefer the method of "function statuscheck($ip, $port) more than @fsockopen, because when the server is offline, you don't get the function.winsock error ;)
06/05/2008 00:19 kinshi88#7
You can also do this for the web form:

Code:
  <form action="status.php" method="post">
      Enter Server IP: <input name="ip" type="text" id="ip" value="<PUT YOUR SERVER'S IP HERE>" size="15" maxlength="13" /></input><br>
      Enter Port: <input name="port" type="text" id="port" value="<PUT YOUR SERVER'S PORT HERE>" size="6" maxlength="4" /></input><br>
      <input type="submit" value="Check Status!" />
  </form>
So people don't have to type it all in, its helpful lol
10/19/2008 02:52 cerda144#8
Parse error: syntax error, unexpected '=' in /home/halls6/public_html/bsc/status.php on line 4

I got this error someone help please
10/27/2008 01:55 XxArcherMasterxX#9
leavemealone made a guide to about this:p why making a second?
07/29/2011 19:06 chad123123#10
i cwindows were u program files are?

Also i get there when i load my browser The website encountered an error while retrieving [Only registered and activated users can see links. Click Here To Register...]. It may be down for maintenance or configured incorrectly.