From 6d41eab506967dd2490352932f153cbaad6986d6 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Sun, 12 Mar 2017 19:16:29 +0000 Subject: [PATCH] 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 --- csrf.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/csrf.php b/csrf.php index ec4498a..8070047 100644 --- a/csrf.php +++ b/csrf.php @@ -19,6 +19,21 @@ class csrf * enter information in form and submit) */ 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 */ public function createToken () {