Maybe don’t use strip_tags on the CSRF token? It could be possible that the hash_hmac function creates output which strip_tags interprets as HTML or PHP code.
Normally, input sanitation is good, but this is a simple value which either does or doesn’t match the expected value. What usage of this variable would require it to be sanitized?
I can’t get it to work either… I have something like this for each of my form page and I have about 4 form pages…:
// $csrf = strip_tags($_POST[‘csrf’]);
// if($csrf !== $_SESSION[‘key’]) {
// echo “”;
I have stored it into a session in my previous form…If i implement this, then sometimes, it won’t let me signup or complete my registration successfully…
I’m sorry, but again, why do you use strip_tags on the CSRF? Why does it need to be sanitized? It either matches or it doesn’t, so why does it matter if someone uploads some HTML code or an otherwise invalid token?
Please remove that processing of the token and then see if it still gets rejected.