Take a look at the following code
if($session = login($username, $password)) {
session_start();
session_register("session");
$session_name = session_name();
$session_id = session_id();
header("location: http://$HTTP_HOST/$HTTP_ROOT/home.php?$session_name=$session_id");
exit;
}
without adding the session_id to the redirect the session_start() in home.php creates another session and anything registered in the session created on this page is effectivly lost. The above code solves this little problem but if the user allows cookies then the session_id added to the end of the redirect is unnecessary. My question is this. Is there a more eligant way to create a session then redirect to a page without losing the session_id? Or is there an all together better way of dealing with the above situition all together?