Friendly, easy, lightweight, self-hostable CAPTCHA service. https://captcheck.netsyms.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 2.7KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Captcheck
  2. =========
  3. Easy, light, self-hostable CAPTCHA service. Works on all modern browsers and
  4. IE9+. Uses icons from Font-Awesome.
  5. How to use
  6. ----------
  7. In your form, put an empty div with the class "captcheck_container".
  8. Add `captcheck.js` (or `captcheck.dist.js`) into your page.
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>Captcheck Sample Form</title>
  13. <meta charset="UTF-8">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <script src="captcheck.js"></script>
  16. </head>
  17. <body>
  18. <form action="submit.php">
  19. <input type="text" name="form_field" placeholder="Some random form field" />
  20. <div class="captcheck_container">
  21. </div>
  22. <button type="submit">Submit Form</button>
  23. </form>
  24. </body>
  25. </html>
  26. When the form is submitted, your server will receive two extra form fields:
  27. `captcheck_session_code` and `captcheck_selected_answer`.
  28. In your form handling code, send a request to `http(s)://captcheck-url/api.php`.
  29. Pass the variables `session_id` and `answer_id` with the values sent with the form,
  30. and also pass the variable `action` with the value `verify`.
  31. You will receive a JSON response with (among other things) `"result": true` or
  32. `"result": false`. If result is false, the user failed the test, and another
  33. variable `msg` is available with an explanation.
  34. Example URL:
  35. `http(s)://captcheck-url/api.php?action=verify&session_id=<captcheck_session_code>&answer_id=<captcheck_selected_answer>`
  36. Example responses:
  37. `{"session":"some_session_id","result":true}`
  38. `{"session":"some_session_id","result":false,"msg":"Answer incorrect."}`
  39. Installation
  40. ------------
  41. 1. Run composer install.
  42. 2. Copy settings.template.php to settings.php and plug in your settings.
  43. 3. Install the database.
  44. 4. Customize captcheck.js with the correct api_url.
  45. 5. Follow the How to Use section and the example setup in test.html and test.php.
  46. Execution Flow
  47. --------------
  48. JS = captcheck.js, API = api.php, FORM = parent form,
  49. SITE = form processing code, -> = some action taken on the right by the left
  50. JS -> API: Request session ID, question, and answers (with scrambled random codes)
  51. API -> JS: Sends info, saves session ID, correct answer, and scrambled answer codes in DB
  52. JS -> API: Requests answer images by sending scrambled value and session ID
  53. JS -> FORM: Adds hidden field with value=session ID, displays question and images (or text box)
  54. [USER SUBMITS FORM]
  55. SITE -> API: Sends session ID and answer
  56. API -> SITE: Responds with true/false to indicate if the answer is valid, marks session as expired to prevent CAPTCHA reuse