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 Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
steviez Posted December 26, 2007 Author Share Posted December 26, 2007 Perfect, Thanks Quote Link to comment 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.