index.php
<?php /* the wall hostnames */ $gs="game-server"; $wall01="wall01.lair.lan"; $wall02="wall02.lair.lan"; $wall03="wall03.lair.lan"; $wall04="wall04.lair.lan"; $wall05="wall05.lair.lan"; $wall06="wall06.lair.lan"; /* the port number to commincate on */ $port = 9001; /* connect to every wallxx */ $gs = fsockopen ($gs, $port, $errno, $errstr,1); $w01 = fsockopen ($wall01, $port, $errno, $errstr,1); $w02 = fsockopen ($wall02, $port, $errno, $errstr,1); $w03 = fsockopen ($wall03, $port, $errno, $errstr,1); $w04 = fsockopen ($wall04, $port, $errno, $errstr,1); $w05 = fsockopen ($wall05, $port, $errno, $errstr,1); $w06 = fsockopen ($wall06, $port, $errno, $errstr,1); /* if connections fail */ /*stream_set_timeout($w01,11); stream_set_timeout($w02,11); stream_set_timeout($w03,11); stream_set_timeout($w04,11); stream_set_timeout($w05,11); stream_set_timeout($w06,11);*/ if(!$gs){$gsstatus="<font color=red>OFFLINE<b></font>";}else{$gsstatus="<font color=green><b>ONLINE</b></font>";} if(!$w01){$w1status="<font color=red>OFFLINE</font>";}else{$w1status="<font color=green><b>ONLINE</b></font>";} if(!$w02){$w2status="<font color=red>OFFLINE</font>";}else{$w2status="<font color=green><b>ONLINE</b></font>";} if(!$w03){$w3status="<font color=red>OFFLINE</font>";}else{$w3status="<font color=green><b>ONLINE</b></font>";} if(!$w04){$w4status="<font color=red>OFFLINE</font>";}else{$w4status="<font color=green><b>ONLINE</b></font>";} if(!$w05){$w5status="<font color=red>OFFLINE</font>";}else{$w5status="<font color=green><b>ONLINE</b></font>";} if(!$w06){$w6status="<font color=red>OFFLINE</font>";}else{$w6status="<font color=green><b>ONLINE</b></font>";} fputs($gs,"game-server.student.lab is ONLINE"); //fputs($gs,$_SERVER['REMOTE_HOST']); //fputs($gs,$_SERVER['REMOTE_ADDR']); //fputs($gs,$_SERVER['SERVER_ADDR']); /* set the delay for page refresh */ echo "<META HTTP-EQUIV=\"refresh\" content=\"120;URL=http://game-server.student.lab\""; echo "<CENTER><BR><BR><BR><table><tr><td>game-server.student.lab</td><td>$gsstatus</td></tr><tr><td>wall01.lair.lan</td><td>$w1status</td></tr><tr><td>wall02.lair.lan</td><td>$w2status</td></tr><tr><td>wall03.lair.lan</td><td>$w3status</td></tr><tr><td>wall04.lair.lan</td><td>$w4status</td></tr><tr><td>wall05.lair.lan</td><td>$w5status</td></tr><tr><td>wall06.lair.lan</td><td>$w6status</td></tr></table></CENTER>"; fclose($gs); ?>