We deal with a lot of spam and bots on devbump and after a vulnerability was found in the version of captcha we were using for human verification I had to code a simple math test in its place. That solution is extremely trivial to bypass and so I started looking at alternatives. There are some interesting ones that use pictures instread of garbled numbers which I liked but the ones I saw just rotated a fixed number of images (probably easier to bypass than captcha if one tried). The solution I decided to try and code up was one that used pictures grabbed from flickr which will never be seen twice. So here is my attempt in a PHP4 class with example usage. Feel free to point out any glaringly obvious flaws in it that I might have missed. It does take some time to grab the images since it has to hit as many xml feeds as the number of images you use. It is also a good idea to use tag names that wouldn't normally be associated with eachother to avoid ambiguous images.
Example usage:
-
/**
-
* Flickcha class, for human verification
-
* Author: Ian Marsh
-
* Version 0.1
-
**/
-
class Flickcha {
-
var $tags; // tags for photos used in verification
-
-
/**
-
* Constructor: Contructs a new Flickcha
-
**/
-
function Flickcha($pass = "puppy,kitten,fish") {
-
}
-
-
/**
-
* Validate: Return true if code was corrent, false if not
-
**/
-
function validate() {
-
return true;
-
else
-
return false;
-
}
-
-
/**
-
* formPrint: Prints necessary code for html form.
-
**/
-
function formPrint($formID) {
-
// Print instructions
-
for($i = 0; $i <$len; $i++)
-
-
// Print out flickr photos in random order
-
$randTags = $this->tags;
-
for($i = 0; $i <$len; $i++) {
-
$rtag = $randTags[$i];
-
echo("onClick=\"document.$formID.flickcha.value+='$i';document.getElementById('thumb$i').style.display='none';\" /></div>");
-
}
-
-
// Encode correct code
-
$key = '';
-
for($i = 0; $i <$len; $i++) {
-
}
-
}
-
-
/**
-
* getThumb: Returns url for a flickr img of a given tag
-
**/
-
function getThumb($tag, $timeout = 10) {
-
$ch = curl_init();
-
curl_setopt($ch, CURLOPT_URL, "http://api.flickr.com/services/feeds/photos_public.gne?tags=".$tag);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
-
$feed = curl_exec($ch);
-
curl_close($ch);
-
}
-
}




