src/CSRF.php
public static function generateToken($token_name = self::TOKEN_NAME)
	{
		// generate as random of a token as possible
		$salt   = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : uniqid();
		$_SESSION[$token_name]  = sha1(uniqid(sha1($salt), true));
	}
public static function generateToken($token_name = self::TOKEN_NAME)
	{
		// generate as random of a token as possible
		$salt   = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : uniqid();
		$_SESSION[$token_name]  = sha1(uniqid(sha1($salt), true));
	}
public static function generateToken ( $ token_name = self :: TOKEN_NAME ) { // generate as random of a token as possible $ salt = ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ? $ _SERVER [ 'REMOTE_ADDR' ] : uniqid ( ) ; $ _SESSION [ $ token_name ] = sha1 ( uniqid ( sha1 ( $ salt ) , true ) ) ; }
(Re-)Generate a token and write it to session

@param string $token_name - defaults to the default token name
@return void
( Re - ) Generate a token and write it to session