PHP code example of crodas / csrf-token
1. Go to this page and download the library: Download crodas/csrf-token library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crodas / csrf-token example snippets
CSRF::setSecret($strong_secret_key);
if (empty($_POST['_csrf']) || !CSRF::verify($_POST['_csrf'])) {
throw new Exception("CSRF Token is invalid");
}
html
<input type="hidden" name="_csrf" value=" echo CSRF::generate()