Topic: How do I block an email in my forms? (Read 1525 times)
Metal slug addict
Posts: 18
140 credits Members referred : 0
« on: Aug 05, 2008, 11:39:05 pm »
I have a simple PHP contact form. But I have email spammer that keeps filling out my form. How do I add a block so that email cannot even be sent from the spammer? Here my code:
Code:
<?php
// get posted data into local variables $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "smurfmebaby@yahoo.com"; $Subject = "Our Form"; $FirstName = Trim(stripslashes($_POST['FirstName'])); $LastName = Trim(stripslashes($_POST['LastName'])); $Phone = Trim(stripslashes($_POST['Phone'])); $Reason = Trim(stripslashes($_POST['Reason'])); $IP=$_SERVER['REMOTE_ADDR'];
// validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=oops.html\">"; exit; }
Metal slug addict
Posts: 18
140 credits Members referred : 0
« Reply #2 on: Aug 06, 2008, 03:35:31 pm »
Thanks, that was good info to read. But I am looking for more of a block that won't allow a certain email to be used in the form. Like an @gmail.com. So if they add name@gmail.com. It will give them the error page. Is that possible? I guess I am tryiing to make @gmail.com a banned or bad word?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
Thanks, that was good info to read. But I am looking for more of a block that won't allow a certain email to be used in the form. Like an @gmail.com. So if they add name@gmail.com. It will give them the error page. Is that possible? I guess I am tryiing to make @gmail.com a banned or bad word?
what you're trying is not the solution, after you block his address he will use the next one, you need to stop BOTs. You need something else like a captcha validation
Metal slug addict
Posts: 18
140 credits Members referred : 0
« Reply #4 on: Aug 06, 2008, 04:49:39 pm »
Oh I see now. Stop it all and they can't change the email and do it agian. Thanks so much for your help.
Radical Sales Monster
Computer Avant Garde
Posts: 206
430 credits Members referred : 0
« Reply #5 on: Aug 09, 2008, 08:42:15 pm »
What about using e-mail confimration. If you do this it will not matter if he signs up. He will not confirm the e-mail and you have nothing to worry about. I do this and so do my clients. Capthca on an e-mail form is a pain and can sometimes cost you less web savvy readers.