Captcha image verification

posted on June 24, 2006, 12:47 am
Comments
tomasz posted on December 25, 2007, 11:33 pm
hmm.. it works on my other page, when refreshing i have to reenter the code,

but on the other one it works without reentering... can you help me on this?

tomasz posted on December 25, 2007, 10:36 pm
Hi,

can you help me, code works, but when i refresh the posted form it doesnt say that the code is wrong, it continues, you can refresh as much as you want ...

Is there any way to fix it, when you post it, the code changes, and when you want to refresh the page, you have to reenter the code

Thanks

lian posted on December 24, 2007, 7:57 am
i will explain myself better....
i have put that code in my website. it works well, but i would like it to act like your form in which the submit does not open a new window if the verification code is mistyped. and just add a line says type again, and it should change a picture as well...
what have i done wrong ?
thank you.

Martellito posted on December 19, 2007, 11:25 pm
Thanks! It took a bit of fiddling around but it works now. The reason I printed the session variable on the screen was to make sure that the image's number matched the session variable in memory. In the web page, of course I won't print it, as it defeats the purpose of it. Thanks again, you've been extremely helpful!


Rodrigo Martell posted on December 19, 2007, 9:58 am
Great script! I have a tiny problem, howver, making it work. I created a test php file and called it testimage.php, the code is:<br />&lt;?<br />
session_start();
error_reporting(E_ALL ^ E_NOTICE);
?&gt;
&lt;td&gt;
&lt;input name=&quot;create_image&quot; type=&quot;text&quot; value=&quot;&quot;&gt;<br />
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&lt;img src=&quot;captcha.php&quot;&gt;
&lt;/td&gt;
&lt;?
echo(&quot;THis is the code: &quot;.$_SESSION['vercode']);
?&gt;
I notice that upon initial loading of testimage.php, the session variable isn't set so nothing is displayed in the echo statement in line 3 of captcha.php. If you refresh the page, a code is displayed in the echo statement, but it doesn't match the one on the image. I realized that the session variable is set and sent after the echo statement is executed in captcha.php line 3 so when testimage.php reads it in it's always lagged (displays the previous code before refresh). Can you please give me a pointer on how to fix this? I'm kind of pulling my hair out.</p>
Great script! I have a tiny problem, howver, making it work. I created a test php file and called it testimage.php, the code is:
Thanks!!

--------------------------------------
Veselin: what you can do is to set the session variable in your testimage.php and then the captcha.php to use that variable. But I do not see a reason why you want to print the value of session variable on your web page

Theo posted on December 14, 2007, 5:19 pm
Great script guys! Simple and effective! Is there any way though, to change the image background to something more complex? -just to give a harder time to OCR's... or you think it's not necessary?
---------------------
Veselin: you can just use a font with more difficult to read characters

shaid posted on December 11, 2007, 8:50 am
hi
thanks for the script
but i m facing problem with some unrecognized text likeand then the form...
can u please tell me why this is happening...
Thanks you

Jeremy posted on November 28, 2007, 1:51 am
I have added the script to my page, but when I enter the generated number and press submit, I get an \"incorrect verification code error\" I\'ve tried several times thinking I may have mistyped, but this is not the case. Any help would be much appreciated.

Matīss posted on November 8, 2007, 1:07 pm
I have installed this code on my page , and everything is just ok, but i cannot see any image? nor in form i put it, nor when i open captcha.php file..

any ideas why? if there`s no GD library, it show an error? Cannot see any info about GD lib in phpinfo(); :/

but code looks great. thx

Doug posted on November 2, 2007, 11:39 pm
great code, noticed question about switching numbers to letters, what would an array look like to do this and how would you call them at random?
---------------------
Veselin: it should be something like this

$template = "abcdefghijklmnopqrstuvwxyz";
$rndstring = "";
for ($a = 0; $a <= 5; $a++) {
&nbsp;&nbsp;&nbsp; $b = rand(0, strlen($template) - 1);
&nbsp;&nbsp;&nbsp; $rndstring .= $template[$b];
}

Pages:   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   
   
If you have any additions, suggestions or modifications for this example please contact us or use the form below.
   
Your name:
Your email: (email address will not be posted on the web site)
Comment:
Verification