Create CAPTCHA Protection with PHP and AJAX


CAPTCHA is a simple test to determine if a user is a computer or a human. It is used to prevent spam abuse on the websites. So if you use CAPTCHA on your web site forms, this can help in stopping some bots and making life harder for other bots in accessing or using your forms.In brief the CAPTCHA protection works by generating a random string, writing it to an image, then storing the string inside of a session or by some other method. This is then checked when the form is submitted.
We need 4 files, name:
ajax_captcha.js // This file process ajax post for form.
captcha.php // This will check if captcha submited is valid or not
create_image.php // This file will creat an image from session string
index.php // This is demo file, will show a captcha image and form to test


So, here we go:
1, ajax_captcha.js

2, captcha.php

3, create_image.php

4, index.php


Other Posts you may be interested in:

  1. Unikey – phần mềm gõ tiếng việt không cần cài đặt cho Windows/Linux/Mac
  2. PHP – Chỉ cho chạy trên 1 domain
  3. Creative Cloud 2014 – Adobe CC 2014 Direct Download Links
  4. Tình xưa nghĩa cũ 2 – Jimmy Nguyễn
  5. Bộ hình nền máy tính Bikini chất lượng Full HD 1920×1080
  6. Fix: Windows 10 Start Menu not work
  7. Cách dùng và công dụng của mật ong


Leave A Reply