BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 is there an site that i can goto where i can get info on how to block ips in php script the blocked ips will be in a databaseplz tell me thanks Link to comment Share on other sites More sharing options...
GingerRobot Posted July 15, 2006 Share Posted July 15, 2006 Ok, well the short answer is dont. IPs are unreliable and many people's IP address change very regularly. Also, some ISPs force all their clients through a proxy, making all their IPs the same. If you were to ban one person from that ISP, all would be banned. Link to comment Share on other sites More sharing options...
Gast Posted July 15, 2006 Share Posted July 15, 2006 You can do if you want to, by putting this code at the top of the page:[code]<?php// Array of all IPs blocked, you can get this from a database if you wish$ips = array("255.255.255.255", "123.45.678.90", "11.111.11.111");if(in_array($_SERVER['REMOTE_ADDR'], $ips)) { print("You have been banned from this website and are unable to view it."); exit();}?>[/code] Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Author Share Posted July 15, 2006 why is there an exit Link to comment Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 So the rest of the page doesn't load. Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Author Share Posted July 15, 2006 oh ok thanks Link to comment Share on other sites More sharing options...
SharkBait Posted July 15, 2006 Share Posted July 15, 2006 [quote author=BillyBoB link=topic=100657.msg397635#msg397635 date=1152958637]is there an site that i can goto where i can get info on how to block ips in php script the blocked ips will be in a databaseplz tell me thanks[/quote]Perhaps the best queston would be, why do you want to ban them?In regards to the post that talks about how an ISP might change their clients IPs regularly, then you should ask yourself. What are these people doing that makes you want to ban them? If they are users on your website. You could block their login username. If they try to sign up again, you can check to see if they are trying to use the same email address. Sure people can create multiple email addresses, but then you could just limit the email addresses of your users to that of their ISP (yes I know some ISPs can allow up to 10 emails or even more).Just some thoughts. Personally I'd ban the IP. Another thing I have thought about is banning the ISP. You do a reverse lookup to see what domain they are from and ban that. If there are multiple users from the ISP, then you could do a ignore type thing to ignore those who are good. Then after a while if the trouble seems to calm down you could lift the ISP ban.This is what we've done on MUDs that I've helped maintain etc. Though its a bit of a pain if alot of users are from a particular banned ISP. Link to comment Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 And don't people with dialup get new IP addresses all the time? Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 15, 2006 Share Posted July 15, 2006 I think that they generally will each time they Dial-Up, and even during the session for certain ISPs like AOL. Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Author Share Posted July 15, 2006 can i ban isps ? cuz then i could just ban all the dial up isps and get over that small glitch Link to comment Share on other sites More sharing options...
Gast Posted July 16, 2006 Share Posted July 16, 2006 Like GingerRobot said above, if you ban an ISP you cna ban thousands of people who havent even been to your website. If they visit they could then have been banned and have not done anything. Link to comment Share on other sites More sharing options...
redarrow Posted July 16, 2006 Share Posted July 16, 2006 Why do you need to band an ip address, if your site is properly coded with the correct valadation code then there should'nt be a problam.what problam have you got? Link to comment Share on other sites More sharing options...
BillyBoB Posted July 16, 2006 Author Share Posted July 16, 2006 yea i know but it would keep the speed up on my site cuz i wouldnt have a bunch of slow ppl Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 16, 2006 Share Posted July 16, 2006 Whaaaaat does that mean?? Link to comment Share on other sites More sharing options...
AndyB Posted July 16, 2006 Share Posted July 16, 2006 [quote author=BillyBoB link=topic=100657.msg398288#msg398288 date=1153078419]yea i know but it would keep the speed up on my site cuz i wouldnt have a bunch of slow ppl[/quote]Wrong. The speed at which http requests are passed across the internet has nothing to do with the speed of your server. Link to comment Share on other sites More sharing options...
BillyBoB Posted July 16, 2006 Author Share Posted July 16, 2006 ok well i still want to know how to do it :) Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 16, 2006 Share Posted July 16, 2006 Well there isn't really a way to know if they're on Dial-Up I think.And anyway Dial-Up people will use LESS bandwidth than broaband users. Link to comment Share on other sites More sharing options...
BillyBoB Posted July 16, 2006 Author Share Posted July 16, 2006 thats not wat i mean i want to ban isps like dial up isps is there a way to ban isps? Link to comment Share on other sites More sharing options...
pixy Posted July 16, 2006 Share Posted July 16, 2006 If you're not having people doing things to your site, then you should have no reason to ban them. Link to comment Share on other sites More sharing options...
BillyBoB Posted July 16, 2006 Author Share Posted July 16, 2006 i didnt ask for a reason just for ansers ;D Link to comment Share on other sites More sharing options...
AndyB Posted July 16, 2006 Share Posted July 16, 2006 This thread is no longer serving any useful purpose.I suggest using Google to look for the information you need. When you have some code written, if you can't get it to work then open a new thread. Meantime, look at what Gast posted since that will set you on the way. Link to comment Share on other sites More sharing options...
Recommended Posts