php captcha needed on my contact form

Discussion in 'PHP' started by fadetoblack22, Jun 11, 2008.

  1. #1
    I am currently getting spam attacked through my contact form and I don't know how to add a spam question. I just need something like "what is 1+seven"?

    thanks

    <?php
      $name = $_REQUEST['name'] ;
      $email = $_REQUEST['email'] ;
      $message = $_REQUEST['message'] ;
    
    
      if (!isset($_REQUEST['email'])) {
        header( "Location: http://www.site/contact.php" );
      }
      elseif (empty($email) || empty($message)) {
       
       header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
        header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
        header( "Cache-Control: no-cache, must-revalidate" );
        header( "Pragma: no-cache" );
    
    ?>
    
        <html>
        <head><title>Error</title></head>
        <body>
        <h1>Error</h1>
        <p>
        Oops, it appears you forgot to enter either your
        email address or your message. Please press the BACK
        button in your browser and try again.
        </p>
        </body>
        </html>
    
       <?php
    
    
    
      }
      else {
        mail( "email address", "title",
          "$message", "From: $name <$email>" );
        header( "Location: http://www.site.com" );
      }
    ?>
    PHP:
     
    fadetoblack22, Jun 11, 2008 IP
  2. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    #2
    PM me and Ill hook you up with this.
     
    ryandanielt, Jun 11, 2008 IP
  3. sky22

    sky22 Guest

    Messages:
    59
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sky22, Jun 11, 2008 IP