db = $db; $this->event = $event; } // Generate a random token from /dev/urandom or with uniqid() public static function generateToken() { if (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { $token = file_get_contents('/dev/urandom', false, null, 0, 30); } else { $token = uniqid(mt_rand(), true); } return hash('crc32b', $token); } }