Skip to content

Commit

Permalink
Update Description
Browse files Browse the repository at this point in the history
  • Loading branch information
jcavenue authored May 31, 2021
1 parent 6424d67 commit a42f767
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# csrf-token
Generate random token for CSRF
# CSRF-token
This CSRF-TOKEN is written in PHP and very simple to use. It generate random token in every refresh of the browser page.

## Generate token
```
<?php
<form action="index.php" method="post">
<input type="hidden" name="token" value="Token::generate()>"/>
<input type="text" name="action" placeholder="Enter an action."/>
<input type="submit" value="Submit" name="sub"/>
</form>
?>
```
+ Place this static function on a hidden input field value.

## Check Token
```
<?php
if(Token::check() == True ){
// Token Validated
} else {
// Do something to restrict
}
?>
```
+ You can check if the token is valid using Token::generate();

0 comments on commit a42f767

Please sign in to comment.