Everything seems to work in all modern browsers, and there aren't any obvious flaws.
|4 years ago|
|images||4 years ago|
|nbproject||4 years ago|
|.gitignore||4 years ago|
|LICENSE||4 years ago|
|api.php||4 years ago|
|captcheck.js||4 years ago|
|composer.json||4 years ago|
|composer.lock||4 years ago|
|database.mwb||4 years ago|
|database.sql||4 years ago|
|index.php||4 years ago|
|readme.md||4 years ago|
|required.php||4 years ago|
|settings.template.php||4 years ago|
|test.html||4 years ago|
|test.php||4 years ago|
Easy, light, self-hostable CAPTCHA service. Works on all modern browsers and IE9+. Uses icons from Font-Awesome.
How to use
In your form, put an empty div with the ID "captcheck_container".
captcheck.js into your page.
<!DOCTYPE html> <html> <head> <title>Captcheck Sample Form</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="captcheck.js"></script> </head> <body> <form action="submit.php"> <input type="text" name="form_field" placeholder="Some random form field" /> <div id="captcheck_container"> </div> <button type="submit">Submit Form</button> </form> </body> </html>
When the form is submitted, your server will receive two extra form fields:
In your form handling code, send a request to
Pass the variables
answer_id with the values sent with the form,
and also pass the variable
action with the value
You will receive a JSON response with (among other things)
"result": true or
"result": false. If result is false, the user failed the test, and another
msg is available with an explanation.
- Run composer install.
- Copy settings.template.php to settings.php and plug in your settings.
- Install the database.
- Customize captcheck.js with the correct api_url.
- Follow the How to Use section and the example setup in test.html and test.php.
JS = captcheck.js, API = api.php, FORM = parent form, SITE = form processing code, -> = some action taken on the right by the left JS -> API: Request session ID, question, and answers (with scrambled random codes) API -> JS: Sends info, saves session ID, correct answer, and scrambled answer codes in DB JS -> API: Requests answer images by sending scrambled value and session ID JS -> FORM: Adds hidden field with value=session ID, displays question and images [USER SUBMITS FORM] SITE -> API: Sends session ID and scrambled answer API -> SITE: Responds with true/false to indicate if the answer is valid, marks session as expired to prevent CAPTCHA reuse