September 4, 2010
Home
|
Contact Us
are you a human?
Home
HIP Tests
Community
About Us
Contact Us
PHP Graphical Distorted Text Example
Bogus account creation page
Account Created!
"; SendData($content); } function SendData($content) { print $content; } function GetData($url) { // you will need php5-curl install for this work. // on debian, it's apt-get install php5-curl. // be sure to run apt-get update first :) $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // Download the godaddy CA cert and tell curl about it via: // curl_setopt($c, CURLOPT_CAINFO, "/path/to/cert"); // Once this is done, change CUROPT_SSL_VERIFYPEER to 1 // // See http://curl.rtin.bz/docs/sslcerts.html for more info curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); $response = curl_exec($c); curl_close($c); return $response; } function ShowEnterCodeForm($msg) { $key = GenerateRandomKey(); // // This represnts a typical "create an account" form. // The portions of this form that are specific to the CAPTCHA // are the 'id' and 'code' fields. // $content = "
Bogus account creation page
Username:
Enter Code:
$msg
"; SendData($content); } function GenerateRandomKey() { // // Generate a 32-byte alphanumeric ID that is passed to the CAPTCHA system // $key = ""; $alphabet = array(); $i = 0; //0 - 9 for($i = ord('0'); $i <= ord('9'); $i++) { $alphabet[] = chr($i); } //a - z for($i = ord('a'); $i <= ord('z'); $i++) { $alphabet[] = chr($i); } //A - Z for($i = ord('A'); $i <= ord('Z'); $i++) { $alphabet[] = chr($i); } while(strlen($key) < 32) { $key .= $alphabet[(int)rand(0, sizeof($alphabet))]; } return $key; } HandleRequest(); ?>