安全天使——端口在线检测php代码
<?php
$ip=$HTTP_SERVER_VARS["REMOTE_ADDR"];
?>
<html>
<head>
<title>安全天使——端口在线检测</title>
<meta http-equiv="Content-Type" content="text/html; charset=??????">
<style TYPE="text/css">
<!--
BODY { FONT-SIZE: 12px; FONT-FAMILY: Verdana;color:#000000;
}
TD {
FONT-SIZE: 12px;
FONT-FAMILY: Verdana;
color:#000000;
line-height: 14px;
}
.en {
font-family: Verdana;
font-size: 11px;
}
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body>
<center>
<table border="0" cellpadding="15" cellspacing="0">
<tr>
<td align="center"><strong>您的IP:<?php echo"<font style="color:red">".$ip."</font>";?></strong></td>
</tr>
</table>
<table cellpadding=5 cellspacing=1 bgcolor="#636194">
<tr bgcolor="#7371A5" align="center">
<td><span class="style1">端口</span></td>
<td><span class="style1">服务</span></td>
<td><span class="style1">检测结果</span></td>
<td><span class="style1">描述</span></td>
</tr>
<?php
$closed='此端口目前处于关闭状态。';
$opened='<font color=red>此端口目前处于打开状态!</font>';
$close="关闭";
$open="<font color=red>打开</font>";
$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'
);
for($i=0;$i<sizeof($port);$i++)
{
$fp = @fsockopen($ip, $port[$i], &$errno, &$errstr, 1);
if (!$fp) {
echo "<tr bgcolor="white"><td align="center">".$port[$i]."</td><td>".$msg[$i]."</td><td align="center">".$close."</td><td>".$closed."</td></tr>";
} else {
echo "<tr bgcolor="#F4F7F9"><td align="center">".$port[$i]."</td><td>".$msg[$i]."</td><td align="center">".$open."</td><td>".$opened."</td></tr>";
}
}
?>
</table>
<table border="0" cellpadding="15" cellspacing="0">
<tr>
<td align="center"><b class="en">Powered by: Angel</b></td></tr>
</table>
</center>
</body>
</html>