steviez Posted December 26, 2007 Share Posted December 26, 2007 Hi, I am trying to ban IP addresses on my site by putting all the banned IPs in to a database, When more than one IP is in the databae it wont work. Here is my code so far: <?php $bans = sql_row("SELECT * FROM bans"); if($bans['ip'] == $_SERVER['REMOTE_ADDR']){ $banned = true; } $smarty->assign("your_banned",$lang['banned']); $smarty->assign("banned",$banned); $smarty->assign("banned_ip",$banned_ip); ?> Thanks in advance Link to comment https://forums.phpfreaks.com/topic/83227-solved-ban-ips/ Share on other sites More sharing options...
rajivgonsalves Posted December 26, 2007 Share Posted December 26, 2007 your code should be something like the following <?php $bans = sql_row("SELECT * FROM bans where ip='{$_SERVER['REMOTE_ADDR']}'"); if($bans['ip']){ $banned = true; } $smarty->assign("your_banned",$lang['banned']); $smarty->assign("banned",$banned); $smarty->assign("banned_ip",$banned_ip); ?> Link to comment https://forums.phpfreaks.com/topic/83227-solved-ban-ips/#findComment-423377 Share on other sites More sharing options...
steviez Posted December 26, 2007 Author Share Posted December 26, 2007 Perfect, Thanks Link to comment https://forums.phpfreaks.com/topic/83227-solved-ban-ips/#findComment-423380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.