I've been having a look through a few posts to see ways of protecting against various forms of 'injection' attack.
What's the best method for sanitizing user input with PHP? is an AWESOME post, and very helpful for databases, however one thing I'd like to do is defend against my mail server being used by someone 'registering' and using a string of comma delimited email addressees to spam people. This is a topic that didn't seem to see is addressed often.
Yes, Captcha (or equivalent) is in place, this is more for the nasty user who cuts and pastes into the email field a long list of comma separated values.
I was hoping that exploding and then only taking the zero element in the array would be the best way to throw way the rest, however if any one has other ideas, or approaches, then very happy to read them.
$emails_passed = explode(",", $_POST['email_field']); // could also use $_GET
$email_to = $emails_passed[0];