verifying use of form ("please enter code below")

Discussion in 'HTML & Website Design' started by MattBOnline, Mar 12, 2013.

  1. #1
    Hi,

    I have developed a form using HTML and PHP.

    How easy is it to get a code verification box to stop spammers?

    I want a box that above it says "please enter the code in the box below". The code would be random every time.

    Hope you can help,

    Matt.
     
    MattBOnline, Mar 12, 2013 IP
  2. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #2
    User this captcha code http://www.google.com/recaptcha
     
    creativewebmaster, Mar 12, 2013 IP
  3. markjayswal

    markjayswal Greenhorn

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #3
    Code for creating captcha box:
    <img src="captcha_code_file.php?rand=<?php echo rand(); ?>"
    id="captchaimg" >
    <label for="message">Enter the code above here :</label>
    <input id="6_letters_code" name="6_letters_code" type="text">
    Add this code to your html form before submit code.
    After this ,add below code to verify
    <?php
    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
    if ($_POST['captcha'] == $_SESSION['cap_code'])
    {
    // Captcha verification is Correct. Do something here!
    }
    else
    {
    // Captcha verification is wrong. Take other action
    }
    }
    ?>..
    Thanks...
    :)
     
    markjayswal, Mar 13, 2013 IP
  4. MattBOnline

    MattBOnline Member

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    Hi CreativeWebmaster.

    I have used their code. And the ReCaptcha box appears. But it does not work with the form. How do I integrate it so that people cannot click send without entering the code?


    Matt.
     
    MattBOnline, Mar 13, 2013 IP