What is the php for banning certain email addresses from posting a form?

hi guys,

ive got an email form which uses a php script and everything works as it should.

the thing is im getting spammers, mainly using the same email addresses, submitting the form and was wondering if there is a line of code i can add to my php which block any submissions from these addresses?

many thanks and i hope to hear from you.

sp

Test for it with a simple IF statement ?

hi brian,
thanks for your reply. im really sorry to ask but im not that great in php, could you let me know what the statement would be please?
thank you very much

You should do an if statement that compares to an array so you have your array of emails you don’t want:


$bannedEmails = array('foo@bar.com', 'yay@email.com');

Then run your array in an if statement


$bannedEmails = array('foo@bar.com', 'yay@email.com');

if ( in_array($the_form_field_that_email_address_submission, $bannedEmails) )
{
  // do something "ban" here
}
else
{
  // do something continue through your form process here
}

one thing I suggest is that you don’t actually do anything to deter your “spammers” cause they will come back w/ different email addresses. so what you can do is allow them to submit the form, it just doesn’t email or post to a database or anything of that nature, but it looks like it does.

I’ve wrote a captcha php class that you can plug in, it works very well against spammers and uses simple questions like “What color is the sky?” and is customizable via xml. If you post your php mailer script I can integrate it into it for ya!