By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,947 Members | 500 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,947 IT Pros & Developers. It's quick & easy.

Big CAPTCHA Problem

P: 73
My host has been 'upgrading' lately and its caused me a whole mess of problems. The last of which being that my CAPTCHA form no longer works. I remember to get the CAPTCHA working it took me weeks to do (this was a long time ago too), and at some point I recall editing it in a Hex editor before finally getting it to work, basically I do not have a clue what this thing needs to do to work.

One day I tried my registration form (without editing anything), and it just kept refreshing itself when it submitted. So I sent an email to the support people and whatever they did messed up my CAPTCHA, it just shows up as a red X now. Here is what they said:

"We had noticed that the custom php.ini file for your account was not setup fine. Hence, you were experiencing issues with the functionality of the registration form at the URL "

"We would like you to know that we have now reset the custom php.ini file for your account properly from our end. "

Would this file being reset be a likely cause for the CAPTCHA not working?

I'm using 'freecap' which was the script I downloaded for the CAPTCHA.

If anyone here has any ideas on what could be going wrong I'd greatly appreciate any help. If theres any specific snippets of code you'd like me to post, please tell me.

Thank You.
Jun 13 '08 #1
Share this Question
Share on Google+
4 Replies

Expert 5K+
P: 5,058

Could you show us the code that generates and shows the image, and perhaps the code that receives and validates the code?

This could be a problem with register_globals. Many hosts have disabled this now that PHP is not longer supporting it.
Jun 13 '08 #2

P: 73
Hi thanks for the response, here is a snippet of code that I think will be the most relevant (the entire thing is quite long):

function make_seed() {
// from
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);

function rand_color() {
global $bg_type,$rand_func;
// needs darker colour..
return $rand_func(10,100);
} else {
return $rand_func(60,170);

function myImageBlur($im)
// w00t. my very own blur function
// in GD2, there's a gaussian blur function. bunch of bloody show-offs... :-)

$width = imagesx($im);
$height = imagesy($im);

$temp_im = ImageCreateTrueColor($width,$height);
$bg = ImageColorAllocate($temp_im,150,150,150);

// preserves transparency if in orig image

// fill bg

// anything higher than 3 makes it totally unreadable
// might be useful in a 'real' blur function, though (ie blurring pictures not text)
$distance = 1;
// use $distance=30 to have multiple copies of the word. not sure if this is useful.

// blur by merging with itself at different x/y offsets:
ImageCopyMerge($temp_im, $im, 0, 0, 0, $distance, $width, $height-$distance, 70);
ImageCopyMerge($im, $temp_im, 0, 0, $distance, 0, $width-$distance, $height, 70);
ImageCopyMerge($temp_im, $im, 0, $distance, 0, 0, $width, $height, 70);
ImageCopyMerge($im, $temp_im, $distance, 0, 0, 0, $width, $height, 70);
// remove temp image

return $im;

function sendImage($pic)
// output image with appropriate headers
global $output,$im,$im2,$im3;
header(base64_decode("WC1DYXB0Y2hhOiBmcmVlQ2FwIDEu NCAtIHd3dy5wdXJlbWFuZ28uY28udWs="));
// add other cases as desired
case "jpg":
header("Content-Type: image/jpeg");
case "gif":
header("Content-Type: image/gif");
case "png":
header("Content-Type: image/png");

// kill GD images (removes from memory)

And the image is called with:

<img src="freecap.php" id="freecap">
Jun 14 '08 #3

P: 73
For now I've just wrote a new registration script (the other one was beyond salvagable). So at least people visiting my site can register now but there is no CAPTCHA (which for now is not a problem). If anyone still has any ideas as to why that may have happened please post or if you can recommend another CAPTCHA script I could look into I'd appreciate that.

Jun 14 '08 #4

Expert 5K+
P: 5,058
I can't see where you create, save or retrieve the captcha validation code.
What is in the 'freecap.php' file?
Jun 14 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.