mrrodger Posted July 24, 2006 Share Posted July 24, 2006 I'm sure this is simple but can someone please help? I would like to add a script to my existing php form processing page that would ban a specific IP and/or email address. I keep getting spam from the same email address about 50 times a day. Please help!! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/ Share on other sites More sharing options...
trq Posted July 24, 2006 Share Posted July 24, 2006 This should fix it for all of 30 seconds.[code=php:0]if ($email == "foo@bar.com") { echo "You are not allowed to post";} else { // handle post.}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/#findComment-62996 Share on other sites More sharing options...
mrrodger Posted July 24, 2006 Author Share Posted July 24, 2006 Thank you- that worked! Do you know how to do the same thing but with IP addresses? Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/#findComment-63005 Share on other sites More sharing options...
trq Posted July 24, 2006 Share Posted July 24, 2006 Carefull though... ip's are unreliable.[code=php:0]if ($_SERVER['REMOTE_ADDR'] == "192.168.12.89") { echo "You are not allowed to post";} else { // handle post.} Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/#findComment-63011 Share on other sites More sharing options...
gm04030276 Posted July 24, 2006 Share Posted July 24, 2006 im just browsing here and wondered if you could use a flatfile database or a mysql database to hold and retrive the information for checking the email/ip against?? Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/#findComment-63022 Share on other sites More sharing options...
ShogunWarrior Posted July 24, 2006 Share Posted July 24, 2006 You could have them in a text file like so:[code]203.188.122.186222.172.213.221123.123.154.224[/code]Then at the start of your script:[code]<?php$ip = @ $_SERVER['REMOTE_ADDR'];$ips = file('ips.txt');if( in_array($ip,$ips) ){die('You are not allowed to post.');}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15513-help-with-banning-email-or-domain/#findComment-63138 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.