<?php
$line = file("ban.txt");
$ip = getenv("REMOTE_ADDR");
for ($i=0; $i<sizeof($line); $i++) {
$ip2 = $line[$i];
if($ip2 == $ip){
print "You were banned";
break;
}
else
continue;
}
print $ip;
?>
I've got a file ban.txt with this format:
127.0.0.1
127.0.0.2
127.0.0.3 (for example)
...
Everything works fine when your ip is 127.0.0.3. If your ip is 127.0.0.1 or 127.0.0.2, nothing happens...
So, conclusion: if the ip is on the last line, everything works, else nothing works. So it only goes wrong when it isn't the last line. Has that someting to do with /n or what?
Who can help me? I don't understand it.. 🙁
tnx