I.P. range authentication

From: Date: Tue, 18 Mar 2003 22:04:39 +0000
Subject: I.P. range authentication
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140206@lists.php.net to get a copy of this message
I am having trouble verifying if a user is within a specified I.P. range. The idea is that if a user is at a library within an I.P. range like 231.55.*.* and their I.P. address is 231.55.122.226 a session would be registered for them. See my code below. This works but only for some I.P.'s in a range. Can anyone suggest a solution or resource that can help me? $sql = "select * from customers where ip1 <=\"$remote_address\" and ip2 >=\"$remote_address\""; $sql_result = mysql_query($sql,$connection) or die("Couldn't execute query. AUTO SIGN IN SELECT"); while ($row = mysql_fetch_array($sql_result)) { $ip1 = $row["ip1"]; $ip2 = $row["ip2"]; $fname = $row["fname"]; $lname = $row["lname"]; $institution = $row["institution"]; $num = mysql_num_rows($sql_result); $sign_in="$fname $lname $institution"; if($num>0){ session_register("sign_in"); } else{echo" you can't see this page"} ----------------------- Electronic Publications Eurekah.com Landesbioscience.com

« previous php.general (#140206) next »