Beispiel #1
0
 private static function __get_code()
 {
     if (!empty(self::$current_code)) {
         return self::$current_code;
     }
     self::$current_code = base64_encode(rand(1000000000000.0, 9999999999999.0));
     self::$current_code = preg_replace('#[\'"=%]#', '_', self::$current_code);
     self::__setkey(self::$current_code, self::$validity_count);
     return self::$current_code;
 }
Beispiel #2
0
 private static function __get_code()
 {
     // don't generate a CSRF token in case the user is not signed-in
     if (!self::__is_logged_in()) {
         return false;
     }
     if (!empty(self::$current_code)) {
         return self::$current_code;
     }
     self::$current_code = base64_encode(rand(1000000000000, 9999999999999));
     self::$current_code = preg_replace('#[\'"=%]#', '_', self::$current_code);
     self::__setkey(self::$current_code, self::$validity_count);
     return self::$current_code;
 }