PHP Classes

File: examples/Sample.php

Recommend this page to a friend!
  Classes of Nicola Covolo   PHP CSRF Protection class   examples/Sample.php   Download  
File: examples/Sample.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CSRF Protection class
Prevent CSRF request security attacks
Author: By
Last change: Merge branch 'master' of https://github.com/jstar88/CSFR_Protector
Date: 10 years ago
Size: 412 bytes
 

Contents

Class file image Download
<?php

require ("../CSRFProtector.php");

$error = function ()
{
    die(
"Nice try dude");
}
;

$token = function ()
{
    return
"_" . mt_rand(1, 200) . md5(mt_rand(2, 100));
}
;

$time = 120; //in seconds
$min = 1; //in seconds

$jsPath = "CSRFProtector";


$csrf = new CSRFProtector($jsPath, $error, $token, $time, $min);
$csrf->run();
echo
"<html><body><a href=\"Sample.php\">click me</a></body></html>";

?>