 |
|
<?php
$ips_array=array("[ Computer 2 ] Server Freebsd 7.x [ kbschool ]:192.168.9.1"," [ computer 2 ] Ubuntu 9.04 [ kbschool ]
:192.168.9.9");
function ping($PC,$ip){
$cmd=shell_exec("ping -c 1 -w 1 $ip");
$dati_mount=explode(",",$cmd);
if (eregi ("0", $dati_mount[1], $out)) {$connesso="<img src=\"off.gif\">";}
if (eregi ("1", $dati_mount[1], $out)) {$connesso="<img src=\"on.gif\">";}
$esito="$connesso <font size='1' face='MS Sans Serif' color='00000'> $PC</font><br>";
return $esito;
}
while(list($k,$v)=each($ips_array)){
$dati_ip=explode(":",$v);
$esito=ping($dati_ip[0],$dati_ip[1]);
echo $esito;
}
?>
จากโค๊ดด้านบน แสดงผลดังนี้ http://rachun.no-ip.org/acc.php
จาก code ด้านบน อยากจะสร้างฐานข้อมูลเพื่อเก็บ ip เช่น 192.168.9.1
แล้วนำค่านั้นมาเช็ค ให้แสดงผล ดังตัวอย่าง
จาก code หากเราจะเพิ่ม ip อื่นเราต้องมาพิมพ์ที่ .php
อยากจะเพิ่มลงฐานข้อมูล มากกว่าครับ แนะนำหน่อยครับ มือใหม่ php จริงๆครับ ขอบคุณครับ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-06-15 12:02:52 |
By :
rachunsun |
View :
1131 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |