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 () {