\CSRF

Protect from CSRF attacks

Summary

Methods
Properties
Constants
__constructStatic()
check()
get()
getParam()
getInput()
No public properties found
No constants found
No protected methods found
$token
N/A
No private methods found
No private properties found
N/A

Properties

$token

$token : 

Current session's CSRF token

Type

Methods

__constructStatic()

__constructStatic() 

Create a CSRF token and set it as a cookie if it doesn't exist

check()

check(boolean  $echo = true) : boolean

Check if CSRF token matches form data's token

Parameters

boolean $echo

Should error message be printed if it doesn't match

Returns

boolean —

Whether it match

get()

get() : string

Get the CSRF token

Returns

string —

Token

getParam()

getParam() : string

Get as a query paramter

Returns

string —

"&csrfToken=..."

getInput()

getInput() : string

Get as an <input> field tag

Returns

string —

HTML of tag