1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Efficient Captcha As Simple as Possible?

Discussion in 'PHP' started by scottlpool2003, May 13, 2013.

  1. #1
    I hate using Captcha's as I get a little nervous that the user may be put off proceeding if it is unreadable, too difficult, too long etc.

    I used a simple addition, but I seem to get more spam coming through now than I did in the first place so I'm trying to outsmart it as simple as possible.

    Would something like:

    III
    How many are above?

    With it being a capital i instead of a 1 do you think this would be effective?

    Thanks.
     
    scottlpool2003, May 13, 2013 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    Haven't used this before, but technology like this seems to be what the future holds for human verification. I think if you can earn revenue from something and improve ux that seems pretty good to me.

    http://www.minteye.com/
     
    HuggyStudios, May 13, 2013 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    Or try to make use of honeypots to catch spammers!
     
    EricBruggema, May 13, 2013 IP
  4. WeddiGo

    WeddiGo Greenhorn

    Messages:
    40
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    18
    #4
    I've built one that is using a combination of PHP session variable and AJAX, works ok for me.

    have a look at http://www.weddigo.com/contact.php

    Buy me a beer and you can have the code if you like it :)
     
    WeddiGo, May 14, 2013 IP
  5. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #5
    You've got the number in a <h2> tag though so that's going to be easy to bypass?
     
    scottlpool2003, May 14, 2013 IP
  6. WeddiGo

    WeddiGo Greenhorn

    Messages:
    40
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    18
    #6
    woops, my bad didn't update that page on the site I was looking at my local version :)

    Have a look again, it can be done more elegantly packing everything into a single getcheckCaptcha.php but the logic is there

    have a look again, there is nothing now in the <h2>
     
    WeddiGo, May 14, 2013 IP
  7. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #7
    Strange, I can't see it viewing the source code but I can view it using Inspect Element in Chrome so I'm guessing there is a way to bypass it...
     
    scottlpool2003, May 14, 2013 IP
  8. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #8
    I have a question, why are you placing it in the page with JS? Wouldn't it be easier to just have it stored in the script with a session?
     
    HuggyStudios, May 14, 2013 IP
  9. WeddiGo

    WeddiGo Greenhorn

    Messages:
    40
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    18
    #9
    nope because if it was all in PHP then you would have to render the numbers on the screen.

    Here is the mechanics behind it:

    1. create a getCaptch.php page that generates a random 5 digit number and initiates a session variable
    <?php
    session_start();
    $max=94785;
    $min=19362;
    $pRan = rand($max,$min);
    $_SESSION["captch"] = $pRan;
    echo $pRan;
    ?>

    2. have on the page a place holder with an ID to display the numbers for the viewer

    <div id="capt"></div>

    3. use ajax to call the getCaptch.php and initiate the session variable but also to return the numbers and populate the div "capt" with the numbers

    $(document).ready(function() {

    $.post("getCaptch.php", {},
    function(data){
    $('#capt').html(data);
    })
    });


    4. have a text field in your form with an id like "ran"
    <input name="ran" type="text" id="ran" size="5">

    5. create checkCaptch.php that checks if the session variable initiated in getCaptch.php is matching whatever is sent through the form
    <?php
    session_start();
    if($_REQUEST["capt"] == $_SESSION["captch"]){
    echo "ok";
    }
    else
    {
    echo "no";
    }
    ?>

    5. when the user types into the field and reaches 5 characters check that what they've typed matches the session variable, so again use ajax for that

    $(document).ready(function() {
    $('#ran').bind('keyup', function (event) {
    var pVal = document.getElementById("ran").value;
    if(pVal.length==5){
    $.post("checkCaptch.php", {capt: $('#ran').val()},

    function(data){
    if(data=="ok"){
    $("#sendBut").css("display","block");
    $("#sendBut2").css("display","none");
    }
    else
    {
    $("#sendBut").css("display","none");
    $("#sendBut2").css("display","block");
    }
    });
    }
    else
    {
    $("#sendBut").css("display","none");
    $("#sendBut2").css("display","block");
    }
    });

    6. what I am doing here is to have 2 submit form buttons, 1 enabled and one disabled so if the user has enetered a correct number I am showing them in turn.
    You could off course have the buttons created on the fly with javascript

    7. finally as an extra test, the page that get's the form data compares the session variable with the value of the "ran" field sent through the form.

    THat should be clear as mud so shout if you want me to elaborate more
     
    WeddiGo, May 14, 2013 IP
  10. HussainMHB

    HussainMHB Member

    Messages:
    62
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #10
    hi man I'm strange to ajax and i know javascript little bit. Now i've a doubt here, is the no 5 ajax coding needed? Because we've already verified captcha in the above php file...
     
    HussainMHB, May 14, 2013 IP
  11. Sarah Needham

    Sarah Needham Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #11
    http://confidentcaptcha.com/demo is another one that is easy for the user (just click on some pictures), easy to install, and gives you the option to earn some $$ through advertising.
     
    Sarah Needham, Jun 5, 2013 IP