Skip to content

Instantly share code, notes, and snippets.

/test.php Secret

Created September 1, 2016 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6b4a906273f489e95e2dfac3c247c68c to your computer and use it in GitHub Desktop.
Save anonymous/6b4a906273f489e95e2dfac3c247c68c to your computer and use it in GitHub Desktop.
ini_set('session.use_cookies', 1);
ini_set('session.save_handler', 'files');
session_name('PHPSESSID');
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
}
if (isset($_GET['set_cookie'])) {
// Emulate Symfony authentication `$session->migrate(true)`
if (!session_regenerate_id(true)) {
throw new \RuntimeException('Failed to regenerate the session');
}
// Emulate Symfony rememberme
// Buggy behavior.
header(sprintf('Set-Cookie: REMEMBERME=value; expires=Sat, 03-Sep-2020 05:38:43 GMT; path=/; domain=%s; httponly', $_GET['set_cookie']));
// Uncomment to get the right behavior.
// setcookie('REMEMBERME', 'value', time() + 12345, '/', $_GET['set_cookie']);
}
session_write_close();
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment