https://github.com/mathsgod/jwt-recaptcha
using json web token for recaptcha, without session, without database
https://github.com/mathsgod/jwt-recaptcha
Last synced: 4 months ago
JSON representation
using json web token for recaptcha, without session, without database
- Host: GitHub
- URL: https://github.com/mathsgod/jwt-recaptcha
- Owner: mathsgod
- License: mit
- Created: 2020-04-07T09:53:02.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-04T03:01:12.000Z (over 1 year ago)
- Last Synced: 2025-08-25T01:43:34.178Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 156 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jwt-recaptcha
using jwt for recaptcha in php
## Server generate hash
```php
$secret="your secret key";
$re = new ReCaptcha($secret);
$hash = $re->hash();
echo $hash["token"]; //token sent to user, use for verify later
echo $hash["image"]; //recaptcha image
```
## Server verify recaptcha code
```php
$re = new ReCaptcha($secret);
$code;//get from user
$token;//get from user sent before
if($re->verify($code,$token)){
//correct code
}else{
//incorrect code
}
```
### Demo
```php
$re = new ReCaptcha($secret, [
"charset" => "1234567890",
"code_length" => 4,
"num_lines" => 1,
"perturbation" => 0.5
]);
$hash = $re->hash();
$image_src = $hash["image"];
```
