|
 |
|
อยากได้โค๊ตการตรวจสอบว่าipaddressซ้ำกันรึปล่าวอ่ะคับ ผมมีโค๊ตมาด้วยอ่ะคับคือไม่รู้ว่าต้องใส่ตรงไหนคั |
|
 |
|
|
 |
 |
|
<?php
$dsn ="IPP";
$user = "";
$pass = "";
$IPaddress = $_POST{"IPaddress"};
$Maxaddress = $_POST{"Maxaddress"};
$Department = $_POST{"Department"};
$Division = $_POST{"Division"};
$User = $_POST{"User"};
$Phone = $_POST{"Phone"};
$SystemAdmin = $_POST{"SystemAdmin"};
//$Date = $_POST{"Date"};
//$Time = $_POST{"Time"};
//$search = $_SERVER{"IPaddress"};//
//$field_name = $_POST{"field_name"};
$connect = odbc_connect($dsn, $user, $pass) or die("µÔ´µèÍ DSN äÁèä´é");
$sql = "insert into ipp (IPaddress, Maxaddress, Department, Division, User, Phone, SystemAdmin) values('$IPaddress', '$Maxaddress', '$Department', '$Division', '$User', '$Phone', '$SystemAdmin')";//àËÅ×Í¡ÒÃàªç¤IPaddressµéͧãÊèã¹Êèǹ¹Õé
//$sql = "select * from tablename where ip='192.168.xxx.xxx'
//echo "sql: ". $sql;
$exec = odbc_exec($connect, $sql);
//
function checkIPorRange ($ip_address) {
if (ereg("-",$ip_address)) {
// Range
$ar = explode("-",$ip_address);
$your_long_ip = ip2long($_SERVER["REMOTE_ADDR"]);
if ( ($your_long_ip >= ip2long($ar[0])) && ($your_long_ip <= ip2long($ar[1])) ) {
return TRUE;
}
} else {
// Single IP
if ($_SERVER["REMOTE_ADDR"] == $ip_address) {
return TRUE;
}
}
return FALSE;
}
odbc_free_result($exec);
odbc_close($connect);
echo "<Font Size=4 color=red><b>ºÑ¹·Ö¡¢éÍÁØÅàÃÕºÃéÍÂáÅéÇ</b></Font>";
echo "<Br><Br><A Href=\"ip3.php\">´Ù¢éÍÁÙÅ</A>";
echo "<Br><Br><A Href=\"ip1.php\">à¾ÔèÁ¢éÍÁÙÅÍÕ¡</A>";
echo "</B></Font>";
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
28 ก.ค. 2548 12:10:33 |
By :
MUSHU |
View :
3892 |
Reply :
0 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 03
|