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 3.2KB

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