Hello, I am putting a ftp server on my site where members can upload there pics but i wont have the server on all the time i was wondering if there was a simple script like so if the server is up a green dot will be there but if the server was down there would be a red dot. Thanks
Server Status
| Code: |
| <?php
//Server domain/ip:port $server='google.com:80'; //Split up port and ip $split=explode(':',$server); $ip=$split[0]; $port=(empty($split[1]))?'80':$split[1];//If no port use 80 $server=$ip.':'.$port; //Try to connect to the server, 1 time $fp = @fsockopen($ip, $port, $errno, $errstr, 1); if($fp){//worked, server online echo $server.' is online'; fclose($fp); } else{//Failed, server offline echo $server.' is offline'; } ?> |
so what do i edit to make it to my server?
Atm it checks the google.com webserver, but you will have to change that to your ftp server. Seeing as to how the standard port for ftp is 21 you would in example get:
$server = your_ip_here:21
If you are using a different port, then just change the number to that.
Now there are 2 more things for you to edit and that's where now is written:
echo $server.' is online';
and where is written:
echo $server.' is offline';
Just change them to what you desire to be displayed. If it would be an image file as you suggested change it to something like:
first (server online status):
echo "<img src=\"online.jpg\" />";
second (server offline status):
echo "<img src=\"offline.jpg\" />";
Or wherever you would place your images or how you would name them. Basically open for you to customize in whatever way you would like and would feel it would suit your site.
thanks for help! 
