Check the session against CSRF attacks by POST. Checks that POSTs are done from this site. 2 different cases are accepted but the first is safer:
The request contains a parameter whose name is token and value is the value of the token of the current session.
If the token isn't in the request, we analyse the HTTP referer to be sure that the request comes from the current site and not from another which can be suspect
If the request doesn't match any of these two cases, this method will consider that it's a CSRF attack.
Tags:
return: true if no csrf attack by post is detected
Parameters:
mixed
$redirect
if string, redirect to the $redirect error page if the token is wrong if false, do not redirect