Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/Sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of jstar88  >  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: 2013-09-18 16:22
Size: 412 bytes
 

Contents

Class file image Download
<?php

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

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

$token = function ()
{
    return 
"_" mt_rand(1200) . md5(mt_rand(2100));
}
;

$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>";

?>