Anti spam web email form

/ Published in: PHP
Save to your folder(s)

Stop a spam email form header injection attack - ie stop spammers from hijacking a web form to send junk mail

Copy this code and paste it in your HTML
  1. foreach( $_POST as $value ){
  2. if( stripos($value,'Content-Type:') !== FALSE ){
  3. mail('[email protected]','Spammer Bot Attempt',$_SERVER['REMOTE_ADDR']);
  4. exit("{$_SERVER['REMOTE_ADDR']} Has been Recorded");
  5. }
  6. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.