add csrf meta tag (for use with xhr, for example)

This commit is contained in:
glaszig
2019-07-30 17:22:03 +02:00
parent 87fe8948b8
commit 20bb9fe42f
2 changed files with 10 additions and 0 deletions

View File

@@ -67,6 +67,15 @@ function CSRFToken()
<?php
}
/**
* Retuns a CSRF meta tag (for use with xhr, for example)
*/
function CSRFMetaTag()
{
$token = htmlspecialchars($_SESSION['csrf_token']);
return '<meta name="csrf_token" content="' . $token . '">';
}
/**
*
* Validate CSRF Token