DeanWhitehouse Posted April 22, 2008 Share Posted April 22, 2008 How can i ban someones ip, i am assuming that when they sign up i need to collect that data and post it to the database, then how can i ban it(if what i said is right) i would like to do the same with there username and email. Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/ Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 IP's can be dynamic, so don't store it on signup. Store bans, and check it their IP when they access the page against the ban table. You can get there IP by tracking the IP/username combo from which a message was posted (assuming you're building a forum). Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523489 Share on other sites More sharing options...
Northern Flame Posted April 22, 2008 Share Posted April 22, 2008 you can also do it via .htaccess Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523494 Share on other sites More sharing options...
DeanWhitehouse Posted April 22, 2008 Author Share Posted April 22, 2008 how do i track there IP and how do i actually ban it? Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523500 Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 how do i track there IP and how do i actually ban it? $ip = $_SERVER['REMOTE_ADDR']; Then you can do whatever you want with it. Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523501 Share on other sites More sharing options...
Northern Flame Posted April 22, 2008 Share Posted April 22, 2008 or with .htaccess you can do this: .htaccess <Limit GET POST> order allow,deny deny from {ip address} allow from all </Limit> replace {ip address} with the ip address you want to ban Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523502 Share on other sites More sharing options...
DeanWhitehouse Posted April 22, 2008 Author Share Posted April 22, 2008 using one of them methods, is it possible to show them a message if there ip is banned and if it isn't show them something else, something like this $ip = $_SERVER['REMOTE_ADDR']; //how can i store this address to ban them as this only shows the address??? if($ip == user1); { echo "go away"; } else { echo "Hello, we like you"; } Quote Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523506 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.