how would you check if a value exists in a database? i want to use this for ip blocking so it will check if your ip is on the list and if so, it will not let you access a specfic page.

I believe there's a php command to get a user's IP address. Store that in a variable and compare it to all the values in the database where you have blocked IP's stored.

Something like this in PHP I think would do it.

$isBlocked = false;
$result = mysql_db_query("$database", "SELECT blocked_ip FROM ip_table");
//loop through all rows returned by result
while ($row = mysql_fetch_array($result))
{
if ($user_IP = $row["blocked_ip"])
{
$isBlocked = true;
}
}
if ($isBlocked)
{
 
//redirect to YOU ARE BLOCKED page
}

Also, as this seems related to your subject of ip blocking:
http://daniweb.com/techtalkforums/thread2176.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.