<select> based CAPTCHA ?

  • joebert
  • Genius
  • Genius
  • User avatar
  • Posts: 13511
  • Loc: Florida

Post 3+ Months Ago

What do you think about this ?

HTML Code: [ Select ]
   if( ! @$_SESSION['reason'])
      $_SESSION['reason'] = rand(1,5);
   if( ! empty($_POST['submit']))
      echo @$_POST['reason'] == $_SESSION['reason'] ? 'success' : 'fail';
   $opts = array(1 => 'first', 'second', 'third', 'fourth', 'fifth');
<form action="test.php" method="post">
<select name="reason">
   <option value="1">select</option>
   <option value="2">the</option>
   <option value="3"><?php echo $opts[$_SESSION['reason']]; ?></option>
   <option value="4">option</option>
   <option value="5">please</option>
<input type="submit" name="submit" />
  1. <?php
  2.    session_start();
  3.    if( ! @$_SESSION['reason'])
  4.    {
  5.       $_SESSION['reason'] = rand(1,5);
  6.    }
  8.    if( ! empty($_POST['submit']))
  9.    {
  10.       echo @$_POST['reason'] == $_SESSION['reason'] ? 'success' : 'fail';
  11.       do_on_success();
  12.    }
  14.    $opts = array(1 => 'first', 'second', 'third', 'fourth', 'fifth');
  15. ?>
  16. <form action="test.php" method="post">
  17. <select name="reason">
  18.    <option value="1">select</option>
  19.    <option value="2">the</option>
  20.    <option value="3"><?php echo $opts[$_SESSION['reason']]; ?></option>
  21.    <option value="4">option</option>
  22.    <option value="5">please</option>
  23. </select>
  24. <input type="submit" name="submit" />
  25. </form>
  • trevHCS
  • Novice
  • Novice
  • trevHCS
  • Posts: 34
  • Loc: NW England, UK

Post 3+ Months Ago

Interesting approach and pretty universal assuming people can count. Only thing is, wouldn't it be better to have the text above the selection box telling them which one to select, then just have the list of options below, eg:

Please select the fifth option from the list below.

Option 1
Option 2
Option 3
Option 4
Option 5

Would still be hard for bots and actually possibly harder as in HTML the instruction and the actual box would be further apart. Can't imagine anyone programming a bot specifically to work this out anyway.

Of course if you really wanted to get clever, you could use something like animal names in there or well anything else, but I guess that requires a little more intelligence from the public and I never too convinced that exists... :)

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5143
  • Loc: SC-USA

Post 3+ Months Ago

This seems similar to the practice of having the user respond to a mathematical operation, for example "Human verification: What is 2 + 4? <input>"

Is there a reason this would be more or less efficient?
  • joebert
  • Genius
  • Genius
  • User avatar
  • Posts: 13511
  • Loc: Florida

Post 3+ Months Ago

I don't know about efficient, but it's not something I've seen used before. Which means it would be impervious to spam bots that aren't specifically designed with a certain site in mind, at least for a little while.

I use a similar thing on my contact form, basically I have a reasons <select> element with random options that say "I want to send you spam" mixed in with the real answers. I drop submissions that don't use one of the real options. Since I started using it my spam almost vanished, at least for the time being. :)

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 31 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.