-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f9b960
commit 3ebf0ff
Showing
1 changed file
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,87 @@ | ||
## Notice | ||
## Getting Started | ||
|
||
Generate CSRF token | ||
|
||
```php | ||
|
||
require('vendor/autoload.php'); | ||
use AvatarPHP\Glide; | ||
|
||
$csrf=new Glide(); | ||
|
||
echo $csrf->token(); | ||
|
||
``` | ||
|
||
In html file | ||
|
||
|
||
```html | ||
|
||
<input type="hidden" name="csrf_token" value="<?php echo $csrf->token(); ?> | ||
"> | ||
|
||
``` | ||
|
||
|
||
Verify the token | ||
|
||
```php | ||
|
||
require('vendor/autoload.php'); | ||
use AvatarPHP\Glide; | ||
|
||
$csrf=new Glide(); | ||
|
||
$token=$_POST['csrf_token']; | ||
|
||
|
||
if(Glide::validate($key)){ | ||
//next phase | ||
}; | ||
|
||
``` | ||
Destroy CSRF token | ||
##### destroy () | ||
```php | ||
$csrf->destroy(); | ||
``` | ||
|
||
Get session id | ||
##### id () | ||
```php | ||
$csrf->id(); | ||
``` | ||
Regenerate session id | ||
|
||
##### Regenerate () | ||
|
||
```php | ||
$csrf->regenerate(); | ||
``` | ||
|
||
Put session value | ||
|
||
##### put () | ||
|
||
```php | ||
$csrf->put($key,$value); | ||
``` | ||
Get session value | ||
|
||
##### get () | ||
|
||
```php | ||
$csrf->get($key); | ||
``` | ||
##### token () | ||
Get token value | ||
```php | ||
use Glide\Token\Engine; | ||
|
||
$token = Engine::token(); | ||
``` | ||
|
||
|
||
|
||
|
||
Working on documentation |