CSRFVerifyToken()

Validates the given token against the same stored in the session for a specific key.

CSRFVerifyToken( token=string, key=string, remove=boolean );

Returns: Boolean

Argument Description Default
token
string, required

Token that to be validated against the token stored in the session.

key
string, optional

The key against which the token be searched.

remove
boolean, optional

Also remove the token from the session if it exists.

Introduced: 6.2.1.11

false

Examples

key = "+nn7jqV+3hYHM++RuvE47g==";
new_token = CSRFGenerateToken(key, true);
dump(CSRFVerifyToken(new_token,key)); //true

See also