关键时刻还得google来解决问题……

作者: 站长 上传时间: 浏览: N/A 下载: N/A 格式: N/A 评分: N/A

This script that probes the Lancom router and pulls out the DHCP/BOOTP table. It may be used for all those who need to monitor such routers, and therefore I am sharing it. It also outputs a nice HTML table; the function BetterTable() can be used on any 2D array.

You will need to set IP, userid, and pwd (first three variables) in order to use the script on your router.


2){ // If repeating more than 2 times,
break; // the connection terminating..
}
}
$content = substr($content,410);

BetterTable($DhcpArray);

fclose($fh);

}
echo "End.\r\n";

//--------------------------------------------------------------------

function isValidIp($ip)
{/* PCRE Pattern written by Junaid Atari */
return !preg_match ( '/^([1-9]\d|1\d{0,2}|2[0-5]{2})\.('.
'(0|1?\d{0,2}|2[0-5]{2})\.){2}(0|1?'.
'\d{0,2}|2[0-5]{2})(\:\d{2,4})?$/',
(string) $ip )
? false
: true;
}

//--------------------------------------------------------------

function BetterTable($twoDimArray)
{
$i = 0;
echo "

";

echo "

";
echo '

';
foreach ($twoDimArray[0] as $fieldName => $fieldValue)
{
echo '

';
}echo '

';
$i = 0;

foreach ($twoDimArray as $rowName => $rowValue)
{
if ($i%2 == 0)
Echo "

";
else
Echo "

";
$fields = count($twoDimArray[$i]);
$y = 0;
echo '

';
foreach ($rowValue as $fieldName => $fieldValue)
{
echo '

';
$y = $y + 1;
}
echo '

';
$i = $i + 1;
}

echo '

Line # '.$fieldName. '
'.$i. ' '.$fieldValue. '

';
}

?>

Leave a Comment