umarzuki 78 Report post Posted May 31, 2014 ni kod saja main2, maklumlah baru belajar sendiri index.html root@lamp:/var/www/tools/portcheck# cat index.html <html> <body> <form action="check.php" method="post"> IP: <input type="text" name="IP"><br> TCP Port: <input type="text" name="portNumber"><br> <input type="submit"> </form> <!-- Sumber: http://www.w3schools.com/php/php_form_complete.asp http://www.ewhathow.com/2013/09/check-if-a-tcp-port-like-http-port-80-is-open-using-php/ --> </body> </html> check.php root@lamp:/var/www/tools/portcheck# cat check.php <html> <body> Server IP: <?php echo $_POST["IP"]; ?><br> Port: <?php echo $_POST["portNumber"]; ?> <?php $host = $_POST["IP"]; $port = $_POST["portNumber"]; $tbegin = microtime(true); $fp = fsockopen($host, $port); $responding = 1; if (!$fp) { $responding = 0; } $tend = microtime(true); fclose($fp); $mstime = ($tend - $tbegin) * 1000; $mstime = round($mstime, 2); if($responding) { echo "<br />$host responded to requests on port $port in $mstime milliseconds!\n"; } else { echo "<br />$host is not responding to requests on port $port!"; } ?> </body> </html> yang aku rasa perlu tambah periksa input & implemen RBL/blacklist/whitelist untuk elak spammer pilihan limit hanya untuk http & https Quote Share this post Link to post Share on other sites