That's cool, I already have a captcha script that I created myself. But another neat thing to do is to create one that uses a math equation instead of an image.
This is a discussion on implement captcha within the Programming forums, part of the Web Designing & Development category; For users who have a solid grounding in PHP and how HTML forms work, this example will show how to ...
For users who have a solid grounding in PHP and how HTML forms work, this example will show how to implement a captcha test:
1. Enable the GD extention in your site's PHP settings by logging into OnSite. Once you are logged in go to the PHP Configurator which is under the Other Tools heading. Within the PHP Configurator click on the Extensions link on the left hand side of the page. You will now see a heading for Graphics, make sure the checkbox for the GD extention is checked. Now click on the Save Changes button near the top of the page.
2. Download (in Firefox, right-click and choose "Save link as..." or in Internet Explorer, right-click and choose "Save target as...") this captcha-gen.php PHP script and place it in the same directory as your form.
3. Add the following image and text input to your form:
4. Inside the action script of your form, make sure to call session_start(); and add the following check before you process the form information.Code:<img src="captcha-gen.php" width="200" height="80"> <br /> Captcha Text: <input type="text" name="phrase">
Code:<?php if( isset($_REQUEST['phrase']) && isset($_SESSION['phrase']) && strlen($_REQUEST['phrase']) > 0 && strlen($_SESSION['phrase']) > 0 ) { if( $_REQUEST['phrase'] == $_SESSION['phrase'] ) { //This is where you will process the form input. //This will prevent the form from being //resubmitted multiple times. unset($_SESSION['phrase']); } else { //This is where you want to process // a bad guess at the Captcha phrase. print( "I'm sorry the Captcha phrase was incorrect!" ); } } else { //This is where you want to process // a direct request or a re-submision // after the phrase was removed from // the session. print( "You must pass the Captcha test to use this form!" ); } ?>
Make sure that all three of the above files are in the same directory and it should work.
The above method uses a PEAR module to create the captcha image. You can either look at the source code of captcha-gen.php or look at the Test_CAPTCHA site http://pear.php.net/package/Text_CAPTCHA/docs to learn more. The site also has another example of how to implement a captcha test.
You can read more about the CAPTCHA project here: Captcha.net
That's cool, I already have a captcha script that I created myself. But another neat thing to do is to create one that uses a math equation instead of an image.
I provide SEO services and business website design
That is good plz share it with us.
post you script here.
nice share
It is a very useful tool,thanks a lot for sharing this.
Captcha code used in the most of in register page.Now a days Captcha code implement by the PHP.By Using PHP securtiy makes the high.
Thanks for sharing this post.I really appreciate your work.
Bookmarks