473,379 Members | 1,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Big CAPTCHA Problem

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
4 2160
Atli
5,058 Expert 4TB
Hi.

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
Jeigh
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):

[PHP]
function make_seed() {
// from http://php.net/srand
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}

function rand_color() {
global $bg_type,$rand_func;
if($bg_type==3)
{
// 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
ImageColorTransparent($temp_im,$bg);

// fill bg
ImageFill($temp_im,0,0,$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
ImageDestroy($temp_im);

return $im;
}

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

// kill GD images (removes from memory)
ImageDestroy($im);
ImageDestroy($im2);
ImageDestroy($pic);
if(!empty($im3))
{
ImageDestroy($im3);
}
exit();
}
[/PHP]

And the image is called with:

<img src="freecap.php" id="freecap">
Jun 14 '08 #3
Jeigh
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.

Thanks.
Jun 14 '08 #4
Atli
5,058 Expert 4TB
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

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

Similar topics

4
by: Krishna Kumar | last post by:
Hai all, I am doing a project in .net and in that project I have a problem in capturing text from an image. i.e images like CAPTCHA images . which has inbuilt text with in the image.So,...
5
by: Barry Morris | last post by:
Hello One web site I have written has a 'register your interest' form which simply e-mails the data, this is working fine except some people seem to get off on repeatedly using the form to send...
0
by: want2learn | last post by:
Hi. I have this CAPTCHA image for .Net in C-Sharp and translate it into VB and as Code_Behind. http://www.mbarrick.com/blog/d6plinks/20061221-01 If i run the site/script i get the site but...
4
by: xeiter | last post by:
Hi, I have a captcha script on my website located at /captcha.php. What it does it generates an image with the code, displays the image (gd2) and saves the value of the code in session. How do I...
11
by: Twayne | last post by:
Hi, Learning PHP code; playing with various methods of generating captcha codes: In the code below, how would I change the size of the text displayed in the captcha code? Is it even possible...
7
by: =?Utf-8?B?bWF0dCBw?= | last post by:
Steve Orr has a neat Captcha control: http://steveorr.net/articles/CAPTCHASP.aspx but aside from "dragging the control onto your toolbox.." Does anyone have any installation instructions: e.g....
0
by: readnlearn | last post by:
hai, i have written this below code for displaying captcha image whenever i entered incorrect uname,password in login page. for that i disable the controls of captcha like textbox,labels,button and...
15
by: sb5309 | last post by:
When one uses CAPTCHA (form with verification code), a session is required to keep the session data. In examples that I have seen on the net, I did not see a session is closed after use. ...
10
by: jeddiki | last post by:
Hi, I have a captcha script which should pick up a background image and add some random letters to it and re-display This is the part of the form that the captcha image is part of: <span...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.