Exemple #1
0
 static function validate($nonce, $action = '', $user = '')
 {
     /*
      * Function validates the nonce generated by self::create
      * $nonce		string		the nonce that is to be validated
      * $action		string		the action for which the nonce was made
      * $user		string		the user for whome the nonce was made
      */
     if (substr(Nonce::generate($action . $user), -12, 10) == $nonce) {
         return true;
     }
     return false;
 }
Exemple #2
0
 public function testCreation()
 {
     $nonce = new Nonce();
     $this->assertEquals(self::$nonce, $nonce->generate());
     $this->assertEquals(self::$nonce, (string) $nonce);
 }