Help with the contact form spammers

Discussion in 'Site & Server Administration' started by rederick, May 19, 2006.

  1. #1
    Hi, I am getting lots of contact form submissions with characters like ×¢²áÏã¸Û¹«Ë¾ in the form fields...

    What would be the best way to block these, and basically not send the email out if the posted fields contain these type of characters.

    Thanks
     
    rederick, May 19, 2006 IP
  2. ian_ok

    ian_ok Peon

    Messages:
    551
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try something like:
    
    function validate_fields($s) {
      $forbidden = array('\r', '\n', 'mime', 'MIME', 'charset', 'bcc', 'Bcc');
      foreach ($forbidden as $f)
        if (strpos($s, $f) !== false) return false;
      return true;
    }
    
    if (!validate_fields($_POST['from'])) {
    echo "what ever";
    }
    Code (markup):
    Ian
     
    ian_ok, May 20, 2006 IP