Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MachiavelSST authored Dec 26, 2019
1 parent 1728ca3 commit 3288dbe
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# PHP-Block-CSRF
Secures requests and blocks CSRF attempts.

## Requirements
PHP version 5.x (+) is required for running this.

## Features
- Block CSRF Attempt.

## Integration (PHP side) #1
```php
require_once('CSRF.php');
$CSRF = new CSRF();

if(isset($_POST['submit'])){
switch($CSRF->checkToken($_POST['token'])){
case false:
/* Your code, if the token is bad. */
echo "Request denied.";
break;
default:
/* Your code, if the token is valid. */
echo "Request allowed.";
break;
}
}
```

## Integration (HTML side) #2
```html
<form method="POST">
<input type="text" name="token" value="<?php echo $CSRF->getToken(); ?>"/>
<input type="submit" name="submit" value="Check"/>
</form>
```

0 comments on commit 3288dbe

Please sign in to comment.