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. 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). 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 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? 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. 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 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"; } Link to comment https://forums.phpfreaks.com/topic/102242-ip-ban/#findComment-523506 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.