marcus Posted October 1, 2007 Share Posted October 1, 2007 ips.txt 66.66.66.66 12.34.56.78 127.0.0.2 127.0.0.0 98.55.26.1 127.0.0.1 ips.php <?php $file = file_get_contents("ips.txt"); $ip = $_SERVER['REMOTE_ADDR']; $e = explode("\n",$file); $ipa = array(); foreach($e AS $f){ $ipa[] = $f; } if(count($ipa) > 0){ if(in_array($ip,$ipa)){ echo "Your IP: " . $ip . " has been baniated!"; }else { echo "NOT BANIATED!"; } }else { echo "NO IPS BANIATED!"; } ?> Tested on localhost. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359619 Share on other sites More sharing options...
env3rt Posted October 1, 2007 Author Share Posted October 1, 2007 Same problem as before.. If only the bottom IP will work. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359632 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 It worked for me, what's your problem? Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359633 Share on other sites More sharing options...
env3rt Posted October 1, 2007 Author Share Posted October 1, 2007 Only the bottom IP in the list is working for me so if I put my ip at the bottom of the list, it works but then if I move it to the middle it doesn't. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359636 Share on other sites More sharing options...
pocobueno1388 Posted October 1, 2007 Share Posted October 1, 2007 It all works for me as well...I have no idea why it won't for you. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359637 Share on other sites More sharing options...
env3rt Posted October 1, 2007 Author Share Posted October 1, 2007 Omg is where you are hosting your test at free? Because it might be the host that is messing it up. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359638 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 I'll test my real IP. works. Your IP: 71.234.x.xxx has been baniated! Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359642 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 I own my own dedicated server. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359643 Share on other sites More sharing options...
env3rt Posted October 1, 2007 Author Share Posted October 1, 2007 Did it work when you put you're ip in the middle of the list? Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359644 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 I'll try. //sleep(15); Sure did Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359646 Share on other sites More sharing options...
env3rt Posted October 1, 2007 Author Share Posted October 1, 2007 Omg I give up lol Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359647 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 Um, if you want more indepth help, add me to MSN. Quote Link to comment https://forums.phpfreaks.com/topic/71434-solved-help-with-ip-ban-simple/page/2/#findComment-359648 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.