38 $this->sSalt=
'fdsfA34T679hjfdsAfef';
42 $this->sSessionVar=
'xsrfTokenArray';
60 private function genToken($iTime){
61 return sha1($this->sSalt.$iTime);
80 $sToken=$iTime.
'####'.$this->genToken( $iTime );
82 if($this->bUseSession){
83 $this->saveToken($iTime.
'####'.$this->genToken( $iTime ));
89 private function saveToken($InputToken){
90 if(!isset($_SESSION[$this->sSessionVar])){
91 $_SESSION[$this->sSessionVar]=array();
94 $_SESSION[$this->sSessionVar]=$InputToken;
97 private function isTokenSaved($sToken){
98 if($_SESSION[$this->sSessionVar]==$sToken){
103 private function unsaveToken(){
104 $_SESSION[$this->sSessionVar]=null;
114 $tToken=preg_split(
'/####/',$sInputToken);
117 if( (time()-$iTime) >= $this->iLifetime ){
118 $this->sMsg=
'msg_tokenInvalidTimeout';
121 if($sToken!=$this->genToken($iTime)){
122 $this->sMsg=
'msg_tokenInvalidCorrupt';
125 if($this->bUseSession){
126 if(!$this->isTokenSaved($sInputToken)){
127 $this->sMsg=
'msg_tokenUnknown';
130 $this->unsaveToken($sInputToken);
static getConfigVar($sCatAndVar, $uDefaut=null)