PHP code example of cruxoid / slim2-csrf

1. Go to this page and download the library: Download cruxoid/slim2-csrf 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/ */

    

cruxoid / slim2-csrf example snippets


 $csrf_token = $_POST['csrf_token'];
 $session_csrf_token = $_SESSION['csrf_token'];

if($csrf_token == $session_csrf_token){
//successfully token match, proceed with the form submission
} else {
//CSRF Voilated, error!!
}