Google

用php调用ping命令

2007-07-13 16:43 来源: windlike.cublog.cn 作者:windlike 网友评论 0 条 浏览次数 14
 

<?php
// created by joe lumbroso

// see some other good php3 scripts

// goto http://www.dtheatre.com/scripts


echo "<font color=\"red\"><blink><b>Pinging</b></blink></font><br>";
$to_ping = "google.com";
$count = 3;
$psize = 65;
echo " Please be patient, this can take a few moments...\n<br><br>";
flush();

while (1) {
?>
    <pre>
    <?
    exec("ping -c $count -s $psize $to_ping", $list);
    for ($i=0;$i < count($list);$i++) {
        print $list[$i]."\n";
    }
    ?>
    </pre>
<?
    flush();
    sleep(3);
}
?>

exec功能这么强大,看来也必给系统带来不少安全隐患。
上一篇: 下一篇:

相关主题:php

网友评论