Session/Captcha/Registration Page --- Error
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
Session/Captcha/Registration Page --- Error
I have a user registration page, in which a CAPTCHA image is created. How could I get the next page which processes the registration to "get" the code that the CAPTCHA gave the user, without making it within the HTML that the user receives on the registration page.
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
The function you'll want is md5() or something similar.
Then on whatever page this form is submitted to, run the fieldForUserToType value through md5() and compare it to the value for 'hashed'.
Code: Select all
//generate captcha image
$hashed_captcha = md5($whateverStringWasGeneratedByCaptcha);
echo <<<FORM
<form ...>
<input type = "hidden" value = "$hashed_captcha" name = "hashed">
<input type = "text" name = "fieldForUserToType">
</form
FORM;Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
ok, but how could I do this with this senerio.
The same as before, I have a page that has the form with the CAPTCHA code image on it, but the image is displayed by this code:
How could I make the first page still have the code encrypted on it.
The same as before, I have a page that has the form with the CAPTCHA code image on it, but the image is displayed by this code:
Code: Select all
<img scr=".../CAPTHCHA/security_image.php">- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Session/Captcha/Registration Page --- Error
Usually the Captcha script (that generates the image) generates an new code each time it is called and saves the code in a session variable. Then the script that receives the submitted code compares the POST value with the value in the session.tecktalkcm0391 wrote:I have a user registration page, in which a CAPTCHA image is created. How could I get the next page which processes the registration to "get" the code that the CAPTCHA gave the user, without making it within the HTML that the user receives on the registration page.
(#10850)