Hi there, I have been trying to make a simple monitor script using fsockopen. here it is ------Start Code-----
<?php error_reporting(0); include 'config.php'; $domain = $_POST['domain']; ?> <html> <head> <title>monitor script</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#000000" text="#FFFFFF" link="#0000FF" vlink="#0000FF" alink="#FF0000"> <table width="40%" border="2" cellpadding="5" cellspacing="5" bordercolor="#666666" align="center"> <tr> <td width="50%">HTTP Server :</td> <td width="50%"><?php // Http port connection $http = fsockopen($domain, $httpport, $errno, $errstr, 30); if (!$http) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>FTP Server :</td> <td><?php //ftp port connection $ftp = fsockopen($domain, $ftpport, $errno, $errstr, 30); if (!$ftp) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>POP Server :</td> <td><?php //pop port connection $pop = fsockopen($domain, $popport, $errno, $errstr, 30); if (!$pop) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>IMAP Server :</td> <td><?php //Imap server connection $imap = fsockopen($domain, $imapport, $errno, $errstr, 30); if (!$imap) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>SMTP Server :</td> <td><?php //ssh port connection $smtp = fsockopen($domain, $smtpport, $errno, $errstr, 30); if (!$smtp) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>SSH Server :</td> <td><?php //ssh port connection $ssh = fsockopen($domain, $sshport, $errno, $errstr, 30); if (!$ssh) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> <tr> <td>Bogus Server :</td> <td><?php // bogus port $test = fsockopen($domain, $bogusport, $errno, $errstr, 30); if (!$test) { echo ("<img src=\"fail.jpg\"><img src=\"fail.jpg\"><img src=\"fail.jpg\">"); } else { echo ("<img src=\"pass.jpg\"><img src=\"pass.jpg\"><img src=\"pass.jpg\">"); } ?> </td> </tr> </table> </body> </html> ----END CODE---- all seems to work ok , except that the http and smtp ports always come up ok even when the domain doesnt exist. I am thinking mabey it has something to do with verisign playing with the .com names lattley?. any ideas and help would be appreciated :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php