corbin Posted June 3, 2006 Share Posted June 3, 2006 Well, I run a small site which checks the status (online/offline) of several servers (13) and the way i have it working is i have the [a href=\"http://l2status.no-ip.org\" target=\"_blank\"]main site[/a] include a page through an IFRAME which includes 4 other pages through IFRAMES. index.php has an IFRAME to status.php which opens IFRAME's to servers/1.php servers/2.php so on. And then in the servers/X.php pages it includes servers/config.php which is this:[code]<? error_reporting(0); while(list($ServerName,$Host)=each($IP)) { list($IPAddress,$Port)=explode(":",$Host); if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) { $server[$ServerName]="<font color=\"#00ff00\">Online</font>"; fclose($fp); }else{ if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) { $server[$ServerName]="<font color=\"#00ff00\">Online</font>"; fclose($fp); } else{ $server[$ServerName]="<font color=\"#ff0000\">Offline</font>"; } } }?>[/code]and an example servers/X.php file is (i changed the IP addresses):[code]<body bgcolor="black"text="#FFFFFF"><?error_reporting(0); $IP = array( "ia_login" =>"000.000.000.000:2106", "ia_aria"=>"000.000.000.000:7777", "ia_victoria" =>"000.000.000.000:7777", );fclose($fp);include("config.php"); ?><b><div align="center" style="font-size: 12; font: bold;">Login: <? echo $server['ia_login']; ?><br>Aria: <? echo $server['ia_aria']; ?><br>Victoria <? echo $server['ia_victoria']; ?><br><div align="center"><? fclose($fp); ?>[/code]So anyway... my question is... is there a more efficient way to go about doing the same thing? Quote Link to comment https://forums.phpfreaks.com/topic/11116-server-status-script/ Share on other sites More sharing options...
poirot Posted June 3, 2006 Share Posted June 3, 2006 You can use fopen or similar functions to try to reach the various mirros.If you don't get a response, most likely they are down.[a href=\"http://www.php.net/fopen\" target=\"_blank\"]http://www.php.net/fopen[/a] Quote Link to comment https://forums.phpfreaks.com/topic/11116-server-status-script/#findComment-41562 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.