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! 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 == "[email protected]") { echo "You are not allowed to post";} else { // handle post.}[/code] 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? 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.} 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?? 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] 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
Archived
This topic is now archived and is closed to further replies.