fullyloaded Posted March 13, 2007 Share Posted March 13, 2007 hi i was wondering if anyone can tell me of a place to get a ip banning script that will save the ips to a text file or to the database and also have it so i can add the ip from a text box thanks Link to comment https://forums.phpfreaks.com/topic/42437-solved-ip-banning/ Share on other sites More sharing options...
emehrkay Posted March 13, 2007 Share Posted March 13, 2007 its not hard to do. just create a table called banned_ips you need fields for id, ip and date_added create a function that will run on every page load to check that table for the current user's ip function checkIpBan($ip){ $query = "SELECT COUNT(id) AS number FROM banned_ips WHERE ip = '". $ip ."'"; $result = mysql_query($query); //you can add the ordie cluase here if you want $num = mysql_num_rows($result); if($num > 0){ header("Location: banned.php"); } } that should do it for you Link to comment https://forums.phpfreaks.com/topic/42437-solved-ip-banning/#findComment-205870 Share on other sites More sharing options...
HoTDaWg Posted March 13, 2007 Share Posted March 13, 2007 or u can also have a status column in ur mysql database and once u want to block a user itll insert the word, "banned" in the database. That way, if the user goes ona different computer he cant even log in to his account. Link to comment https://forums.phpfreaks.com/topic/42437-solved-ip-banning/#findComment-205900 Share on other sites More sharing options...
fullyloaded Posted March 13, 2007 Author Share Posted March 13, 2007 cool thanks a lot you guys Link to comment https://forums.phpfreaks.com/topic/42437-solved-ip-banning/#findComment-205918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.