Menu

The latest security update for PHP Captcha

Help
j1010
2007-12-24
2013-06-03
  • j1010

    j1010 - 2007-12-24

    The latest security update to PHP Captcha is not applied on Form Generator 3.0

    "To stop spammers viewing the security code once and then continually submitting the form without requesting a new security image/code you should add the line unset($_SESSION['security_code']); when you are processing the form to clear the session"
    -----------------------------------------------------------------------------
    <?php
       session_start();
       if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
          // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
          unset($_SESSION['security_code']);
       } else {
          // Insert your code for showing an error message here
       }
    ?>
    --------------------------------------------------------------------------------
    Is this corect way to apply to form generated by v3.0. Any errors? Uhhh coding is so complicated...
    ---------------------------------------------------------------------------------
    <?php

    $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

       session_start();
       if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
         
    mail("webmaster@example.com","Contact Requested","Data:

    Name: " . $_POST['field_5'] . "
    Company Name: " . $_POST['field_6'] . "
    City: " . $_POST['field_7'] . "
    State: " . $_POST['field_8'] . "
    Zip Code: " . $_POST['field_9'] . "
    Phone: " . $_POST['field_10'] . "
    Fax: " . $_POST['field_11'] . "
    E-mail: " . $_POST['field_12'] . "
    Message: " . $_POST['field_14'] . "

    ')"
          unset($_SESSION['security_code']);
         
    include("../thank_you.htm");
         
       } else { 

    echo "Error: Image Verification Failed";
         
       }
    ?>

     
    • TNTEverett

      TNTEverett - 2007-12-26

      Sounds resonable.  Did you try it?  Does it work?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.