Just abit of code that I was playing with, what I basically want it to do is check a users ip against my ip table and if it is the first time the user visits the site capture the ip and display a message, if it's a known ip do something else and not capture it. When I run that code it captures the ip even if it is already in my table.
Language: PHP
$ip = $_SERVER[';REMOTE_ADDR';];
$ip_query = "SELECT ip_address FROM ip";
$result = mysql_query($ip_query);
while ($row = mysql_fetch_array($result)){
$known_ip = $row[';ip_address';];
if ($ip != $known_ip) {
$ip_insert = "INSERT INTO ip (ip_address) VALUES (';$ip';)";
$result2 = mysql_query($ip_insert);
echo "Unknown IP";
} else {
}
A word to the wise ain't necessary - it's the stupid ones that need the advice.
Student Number:72793775