Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 11-01-2008, 07:45 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding a Picture Captcha to your register Page

Seen these on some forums and looks a good idea to share it here with you guys, its easy to program and you can add your own pictures, use it along side your existing captcha setup, any further ideas on its improvement, welcomed.

Pic-Capture



Pic-Capture is a photo CAPTCHA system whereby a website visitor has to identify a picture to proceed. A human can identify a picture, a spambot cannot.

The web is awash with spambots that attack contact forms, guestbooks, forums etc. Up until now, the main line of defence against them was the CAPTCHA. A CAPTCHA is a test to tell humans apart from computers (spambots in this case) that relies on the user entering a string of characters presented to them in an image. This worked well for a while until the bots began to overcome them by reading them with OCR (optical character recognition) programs. Another problem with the traditional CAPTCHA is that they are sometimes difficult to read. The advantage of the Pic-Capture system is that a computer cannot tell what a picture is of but a human can clearly see what it is.

Using this system means that spam on your site will be drastically reduced, with the minimum inconvenience to genuine users.

This site demonstrates some photo CAPTCHA ideas and shows you how to implement them on your website. The code for this system is written in PHP and that is what is shown on this site but you could write a similar system in other languages. Its up to you.

To make your own photo CAPTCHA like the Picture above, put this HTML code on your Register page:...

HTML Code:
<table border="0">
<tr><td colspan="3">Security test.  Please identify the pictures:</td></tr>
<tr><td><img src="pic-capture_1.jpg" alt=""></td><td><img src="pic-capture_2.jpg" alt=""></td><td><img src="pic-capture_3.jpg" alt=""></td></tr>
<tr><td>
<select name="pic-capture_selected[1]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Clock</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td><td>

<select name="pic-capture_selected[2]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Clock</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td><td>

<select name="pic-capture_selected[3]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Clock</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td></tr></table>
Put this code in the PHP script that handles your registration form:

PHP Code:
<?php

if(!isset($_REQUEST['pic-capture_selected'])){exit;}

$pic-capture[1] = "Apple";
$pic-capture[2] = "Flower";
$pic-capture[3] = "Fork";

if(
$_REQUEST['pic-capture_selected'] !== $pic-capture){print "You have failed to identify the pictures correctly.  Please try again.";  exit;}

?>
You will need a photo of the 3 items shown in the picture above download them from google and size them all the correct size for your forum

In the code above, the input has to match exactly the identity of your pictures AND the order of the pictures. Call each one like this pic-capture_1.jpg,pic-capture_2.jpg etc..

Some points.

The drop-down options giving the potential solutions to the identity of the pictures contain ten possible solutions. You can make as many options here as you wish but you have to balance bamboozling the bots with inconveniencing the visitor.

If you make the lists too long, it could be counter productive. You can see that the lists are all the same but they don't need to be. You can put anything you like in there so long as the correct solution is included for the picture in question. Try not to put conflicting options in the list. You can see from the list that I have made, that the solution is quite obvious. If you were to put "animal" and "dog" (for example) in the same list, this would be confusing.

There are ten selection options above for each picture. This means that the chances of guessing the correct solution, if a bot were to try this (debatable?) would be 1,000:1 (10 x 10 x 10).

You can lengthen the odds by adding more pictures or more selection options. Adding more pictures would be the best way to lengthen the odds. Showing four pictures with ten options for each makes the odds 10,000:1 (10 to the power of 4: 10 x 10 x 10 x 10) for guessing the correct solution.

Having say, 15 solutions for four pictures would give odds of 50,625:1. Eight pictures with ten options each gives odds of 100,000,000 (one hundred million):1!

You are strongly urged to customize your photo CAPTCHA system. If everyone uses the same pictures with the same solutions then it wouldn't take long for spammers to take advantage of this

So there you have it a little something to ponder on this weekend

enjoy



--------------- Added [DATE]1225618928[/DATE] at [TIME]1225618928[/TIME] ---------------

Single Picture Captcha

A different type of Pic-Captcha system is the use of one or more pictures where the visitor types an answer to identify a picture and is not given a list to choose from.

The advantage of this is that a bot is not presented with the solution somewhere in a list (although it would have to be a very persistent bot that would make thousands (or millions) of attempts to get into each site it visits). The disadvantage of this method is that it is more work for the visitor and handling the input is trickier because you are relying on the user to spell the solution correctly or give it in a way that you expect.



To make your own Pic-Captcha photo CAPTCHA like the picture above, put this HTML code on your form:

HTML Code:
<table>
<tr><td>Security test.  Please identify the picture:</td></tr>
<tr><td><img src="Pic-captcha_4.jpg" alt=""></td></tr>
<tr><td><input type="text" name="Pic-Captcha_answer"></td></tr>
</table>
Put this code in the PHP script that handles your form:

PHP Code:
<?php

if(!isset($_REQUEST['Pic-captcha_answer']) || strlen($_REQUEST['Pic-captcha_answer']) > 15){exit;}

$Pic-captcha_solutions = array('bicycle','bike');

foreach(
$Pic-captcha_solutions as $value)
{

if(
stristr($_REQUEST['Pic-captcha_answer'],$value)){$set 1; break;}

}

if(!
$set){print "You have failed to identify the picture correctly.  Please try again.";  exit;}


?>
In the code above, the line shown below limits the length of the input to 15 characters, this is to stop bots throwing dictionaries at it:

PHP Code:
strlen($_REQUEST['Pic-captcha_answer']) > 15 
The array shown below contains the values that you check against the input:

PHP Code:
$Pic-captcha_solutions = array('bicycle','bike'); 
If any of these values appear anywhere in the input, then the answer is correct. So "bike" would be a correct answer and "it's a bike!" would also be correct. You have to be mindful when using this version of Pic-captcha that you could get various answers that would be correct.

Instead of asking a visitor to identify a picture, you could ask them a question about a picture. You could have a picture of a man laughing, and ask "what is this man doing?". Use your imagination!

Things to consider. Random display of pictures. Limit number of attempts. Showing larger pictures for visually impaired people.

This one is small enough to place on individual pages, like the contact us.

Enjoy
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03746 seconds
  • Memory Usage 2,189KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_html
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete