PHP Classes
elePHPant
Icontem

File: start.php

Recommend this page to a friend!
  Classes of Malik umer Farooq  >  PHP CSRF Token Generation  >  start.php  >  Download  
File: start.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CSRF Token Generation
Generate tokens to protect against CSRF attacks
Author: By
Last change: Apply fixes from StyleCI
Date: 25 days ago
Size: 471 bytes
 

Contents

Class file image Download
<?php

require_once 'init.php';

$security = new CSRF();

$security->DeleteUnnecessaryTokens();

if (
is_submit('submit')) {

   
//i use my input class you can as well use _GET or _POST method thanks

   
if ($security->Verify(input('token'))) {
       
$security->Delete(input('token'));

        echo
'<div class="container">'.restore_new_lines(input('q')).'</div>';
    } else {
        echo
'invilid request';
    }
}

//only for debug purpose

//$security->Debug();