public function generate($key)
	{
		$key = $result = preg_replace('/[^a-zA-Z0-9]+/', '', $key);

		$extra = sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
		// time() is used for token expiration
		$token = base64_encode(time() . $extra . $this->randomString(32));
		$this->session->set($this->session_prefix . $key, $token);

		return $token;
	}
public function generate($key)
	{
		$key = $result = preg_replace('/[^a-zA-Z0-9]+/', '', $key);

		$extra = sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
		// time() is used for token expiration
		$token = base64_encode(time() . $extra . $this->randomString(32));
		$this->session->set($this->session_prefix . $key, $token);

		return $token;
	}
public function generate ( $ key ) { $ key = $ result = preg_replace ( '/[^a-zA-Z0-9]+/' , '' , $ key ) ; $ extra = sha1 ( $ _SERVER [ 'REMOTE_ADDR' ] . $ _SERVER [ 'HTTP_USER_AGENT' ] ) ; // time() is used for token expiration $ token = base64_encode ( time ( ) . $ extra . $ this -> randomString ( 32 ) ) ; $ this -> session -> set ( $ this -> session_prefix . $ key , $ token ) ; return $ token ; }
Generate a CSRF token

@param  string $key Key for this token
@return string
Generate a CSRF token