God of Ikiliki Posted January 21, 2007 Share Posted January 21, 2007 Does anyone know how to make a server status page.I know how make it say Server Online/Offline.But I want people can add their own server.For example:• A text box with port and the ip• A ''add server'' button.Does anyone know a turturial or a code for this?Thank you Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/ Share on other sites More sharing options...
Daniel0 Posted January 21, 2007 Share Posted January 21, 2007 If you can create a script that checks the online status then it should be very easy. Just get the list of servers to check from a database and then let users add to the database via a form. Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165562 Share on other sites More sharing options...
God of Ikiliki Posted January 21, 2007 Author Share Posted January 21, 2007 I've found that code on another site Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165659 Share on other sites More sharing options...
inztinkt Posted January 21, 2007 Share Posted January 21, 2007 start by having a look at [url=http://www.phpfreaks.com/tutorials/142/0.php]http://www.phpfreaks.com/tutorials/142/0.php[/url] Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165674 Share on other sites More sharing options...
God of Ikiliki Posted January 21, 2007 Author Share Posted January 21, 2007 I don't get that.Thats nothing with a server status page isn't it.. Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165726 Share on other sites More sharing options...
Hypnos Posted January 21, 2007 Share Posted January 21, 2007 This is something like what I've used:[code=php:0]$server = "google.com";$port = 80;$timeout = 1;$isitalive = @fsockopen($server, $port,$errno,$errstr,$timeout); if(!$isitalive) { echo "Server is down"; }else { echo "Server is up"; }[/code]Just don't go crazy with this stuff. Using PHP fsock functions too much on shared hosting will usually get you kicked off pretty fast, because of CPU usage.The MySQL tutorial was linked to because you asked about storing servers. A database would be best for that. Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165741 Share on other sites More sharing options...
kevinkorb Posted January 21, 2007 Share Posted January 21, 2007 One thing I've found is the server may respond... however its not healthy and might as well be down...For example.. if you put in http://www.mydomain.com and it comes up as an apache error cause by a bad config file. Or your mysql database is not working so your page comes up but nothing works so it might as well be shot.You could have them create a page called server_check.php which contains a read from the database.Then you call their site..[code=php:0]$page_to_check = 'http://www.mytesthost.com/server_check.php';$check_page = file_get_contents($page_to_check);if($check_page != 'The page worked, the db val is 345.') { $result = 'host is down';}else { $result = 'host is up';}[/code]This should be a little more valuable. Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-165747 Share on other sites More sharing options...
God of Ikiliki Posted February 8, 2007 Author Share Posted February 8, 2007 I mean this.This is a example of the type of status page i mean.http://dodian.com/index.php?page=status Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-179790 Share on other sites More sharing options...
JasonO Posted February 8, 2007 Share Posted February 8, 2007 Continuing what Hypnos said you can have something like this :[code]$server= $_GET[ip];$port = $_GET[port];$timeout = 1;$isitalive = @fsockopen($server, $port,$errno,$errstr,$timeout); if(!$isitalive) { echo "Server is down"; }else { echo "Server is up"; }[/code]The url to the file will look something like [code]status.php?ip=127.0.0.1&port=80[/code]If you had checks to see if an ip or port was entered you can use this page. If you don't enter an ip or port the page shows an error and won't work.It's untested, so give it a try ::) Quote Link to comment https://forums.phpfreaks.com/topic/35081-server-status-page/#findComment-179794 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.