if (!empty ($REMOTEIP)) {
function Err () {
Die ("Sorry, this IP address is not validClick here to return ");
}
//define the prompt to submit the wrong IP
$ips =explode (".", $remoteip);
//use. Split IP address
if (intval ($ips [0]) <1 or intval ($ips [0]) >255 or Intval ($ips [3]) <1 or intval ($ips [3]>255)) Err ();
//If the first and last IP numbers are less than 1 or greater than 255, an error is prompted
if (Intval ($ips [1]) <0 or Intval ($ips [1]) >255 or Intval ($ips [2]) <0 or intval ($ips [2]>255)) Err ();
//If the number of the second and third IP is less than 0 or greater than 255, an error is prompted
$closed = This port is currently in a closed state.;
$opened = This port is currently open!;
$close = "Off";
$open = "open";
$port =array (21,23,25,79,80,110,135,137,138,139,143,443,445,1433,3306,3389);
$msg =array (ftp,telnet,smtp,finger,http,pop3,location Service,netbios-ns,netbios-dgm,netbios-ssn,imap,https, Microsoft-ds,mssql,mysql,terminal Services);
//After checking by IP format, define the service name and status of each port with an array
echo "
echo "
echo "
echo "
echo "
";
";
The IP you scanned: ". $remoteip." | ";
";
";
echo "
echo "
echo "
echo "
echo "
echo "
echo "
//Output display table
For ($i =0; $i < span="">
{
$fp = @fsockopen ($remoteip, $port [$i], & $errno, & $errstr, 1);
if (! $fp) {
echo "
} else {
echo "
}
}
//Use the Fsockopen function to connect the relevant port of the remote host with the For statement, and output the result
echo "
echo "
echo "
";
";
Port | ";
Service | ";
Test results | ";
Describe | ";
";
". $port [$i]." |
". $msg [$i]." |
". $close." |
". $closed." |
";
". $port [$i]." |
". $msg [$i]." |
". $open." |
". $opened." |
";
"; echo "Continue scanning >>> | ";
";
echo "
echo "
echo "
echo "
echo "
";
echo "";
echo "";
echo "";
exit;
http://www.bkjia.com/PHPjc/486202.html www.bkjia.com true http://www.bkjia.com/PHPjc/486202.html techarticle php $youip = $HTTP _server_vars["REMOTE_ADDR"]; $remoteip = $HTTP _post_vars[remoteip]; HTML head titlephp implements port online detection/ Title Meta http-equiv= "Content-type" content= "text/h ...