csrf : manage multiple CSRF tokens in the same PHP call (and provide the same result) : pseudo-singleton

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3410 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-03-12 19:16:29 +00:00
parent 0591656532
commit 6d41eab506

View File

@@ -19,6 +19,21 @@ class csrf
* enter information in form and submit) */ * enter information in form and submit) */
private $csrfTimeout = 3600; private $csrfTimeout = 3600;
/** Manage the singleton */
public function __construct ()
{
if (isset ($GLOBALS["domframework"]["csrf"]))
{
$this->csrfToken = $GLOBALS["domframework"]["csrf"]->csrfToken;
$this->field = $GLOBALS["domframework"]["csrf"]->field;
$this->csrfTimeout = $GLOBALS["domframework"]["csrf"]->csrfTimeout;
}
else
{
$GLOBALS["domframework"]["csrf"] = $this;
}
}
/** This function return the token */ /** This function return the token */
public function createToken () public function createToken ()
{ {