Click to See Complete Forum and Search --> : looking for random code generation script for html or php form
sujata_ghosh
03-22-2007, 02:07 AM
Hi to All!
i am looking for random code generated script for a html/php registration form. I have seen it on Direct9ory submission form where prople submite their site on suitable directory. at the bottom there are an ramdom generated code which each people need to enter and without whom total process can't be completed.
Can any one give me some source from where i can get readymade script to use or any suggession will be highly appriciated.
Thanks in advance.
MrCoder
03-22-2007, 05:08 AM
Check out my reply to this post.
http://www.webdeveloper.com/forum/showthread.php?t=142504
PlainSense
03-22-2007, 12:31 PM
Make a page called captcha.php and put this on it:
<?
session_start();
$text = rand(10000,99999);
$_SESSION["vercode"] = $text;
$height = 25;
$width = 65;
$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;
imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
?>
Then put it into a folder on your server called verify
...excuse me for a minute, but that stupid flash commercial playing in the right column with the fly swatter is causing my computer to bog down. Real user friendly admin, you must have forgot that most people still connect to the Internet with dial-up.
Now, I'll try to finish this.
Then enter this into your form where you want the captcha to display:
Enter this Code into the box below:<img src="http://www.yoursite.com/verify/captcha.php"><br /><br />
<input type="text" name="vercode" />
And put this at the top of you formmail or whatever you're using:
session_start();
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
echo '<strong>Incorrect verification code.</strong><br>Please use your back Button and try again';
} else {
If the captcha passes the formmail will be processed.
sujata_ghosh
03-23-2007, 02:21 AM
Thanks PlainSense!
for your help and code it is working fine, but i have struct at here
session_start();
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
echo '<strong>Incorrect verification code.</strong><br>Please use your back Button and try again';
} else {
see i am using a shtml fil form which call a perl script to check each filed if all ok then it save it on dat file and send us email.
Please tell me how i will produce this checking on shtml file?
Thanks a lot once again.
PlainSense
03-24-2007, 07:27 AM
I abandoned shtml and cgi formmail a while ago for php, so my forms and my formmail is php. I'm not that familiar with pearl and don't know how you could modify that to work with your specific need.
But I'm sure that someone here does.