A friend of mine starts his Session this way.
<?php
session_start();
session_regenerate_id();
session_destroy();
unset($_SESSION);
session_start();
?>
Are there any security advantages, against Session hijacking etc.
Just wondering why as against the usual session_start();
All you’d need is
That’ll start the session and change its ID on each request. However, this will not prevent session hijacking. If the attacker can get the user’s session cookie and sent a request back to the server BEFORE the user can, then the attacker gets a brand new session ID, and the user is left with an invalid session token and is effectively logged out.