Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,549 members, 7,958,686 topics. Date: Wednesday, 25 September 2024 at 08:53 PM |
Nairaland Forum / Science/Technology / Webmasters / How To Use Ajax For Image Verification Aka CAPTCHA (7113 Views)
The Meaning Of CAPTCHA & 6 Types Of CAPTCHA / Form Validation Tutorial Using Javascript, Php And Ajax! / Dynamic Web Design Tutorials Ft Javascript,Ajax,DOM,PHP,MySQL... (2) (3) (4)
How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 3:54pm On Jan 04, 2009 |
So now we are going to have a short workshop on how to protect your site from bots by doing what we call a CAPTCHA (C[/b]ompletely [b]A[/b]utomated [b]P[/b]ublic [b]T[/b]uring test to tell [b]C[/b]omputers and [b]H[/b]umans Apart): A category of technologies used to ensure that a human is making an online transaction rather than a computer. Developed at Carnegie Mellon University, random words or letters are displayed in a camouflaged and distorted fashion so that they can be deciphered by people, but not by software. Users are asked to type in the text they see to verify they are human. [b]CAPTCHAs were created in response to bots (software agents) that automatically fill in Web forms as if they were individual users. Bots are used to overload opinion polls, steal passwords (see dictionary attack) and, most popular, to register thousands of free e-mail accounts to be used for sending spam. CAPTCHAs were designed to circumvent non-humans from performing such transactions. The feature of the one we are going to use is going to be with ajax such that you can use it without reloading your page. Demo link http://mwebng.net/demos/captcha/ Download link : http://mwebng.net/?net=dl |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:34pm On Jan 04, 2009 |
The files there are listed as follows: index.php - the form we want to secure captcha.php - the image generator verdana.ttf - the font file used on the server for the image post.php - your form submission script refresh.gif - the captcha refresh button
|
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:36pm On Jan 04, 2009 |
index.php
|
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:38pm On Jan 04, 2009 |
The script portion
This contains 2 functions - one for refreshing the image and another function for validating the form. You do not need to manipulate the reset_captcha function. |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:39pm On Jan 04, 2009 |
<input style="width:200" type="text" autocomplete="off" name="captcha"> holds the typed value for the captcha while <img src="captcha.php" id="imgCaptcha"> will load the captcha image from captch.php - which actually renders an image |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:41pm On Jan 04, 2009 |
Ehm, This code is a bit long - but i will just say what it does - it creates an image using randomly generated text it uses the text to create an image and keeps the text into session data as $_SESSION["security_code"] You may need to readup image generation functions in php - but not needed to use this tool. captcha.php
|
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 4:43pm On Jan 04, 2009 |
post.php
This looks simple iight? it just compares the stored session autogenerated captcha with wat was just submitted and is able to tell if it is right or wrong. *************************************** The End ******************************************* Questions can now fall in - if any that is. |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by AbidemiA: 12:53pm On Jan 05, 2009 |
Good Job, thank you. But one thing If you click the submit button without typing the correct values on the image, the content of the datafield is not retained after generating new image value. Assuming I am a user, and I have completed a form with over 20 textboxes, does it mean I will loose all I have entered because I made mistake while typing the image value? |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 2:54pm On Jan 05, 2009 |
@abidemi, good of you to show yourself here - now i am expecting you to give us that are not good with asp a similar solution with aspx. Anyway, as for your question - i am tryin to keep codes simple so that those that wish to learn - can learn easily. I will eventually have to talk about form validation in one of my threads - not yet. Meanwhile the codes i have been posting so far are extracts from my past works - i just remove the tech parts and break it down into simple codes for ppl to follow - the idea is not to be posting codes indiscriminately! |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by c7(m): 9:32pm On May 26, 2010 |
Good job bro, |
Re: How To Use Ajax For Image Verification Aka CAPTCHA by Nobody: 9:44pm On May 26, 2010 |
thx man |
(1) (Reply)
How To Start A Web Hosting/Development Company / Help Adsense Account Has Been Disaproved For The Second Time / How To Subscribe To Airtel 6GB For #500 And 2GB For #200
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 32 |