Some coding that I lifted, I haven't checked it.
In the authorisation checking page... send them to ur login page with current page attaached into the url.
$redirect = $_SERVER['PHP_SELF'];
header("Refresh: 5; URL=login.php?redirect=$redirect");
In the login page... once they're logged in, redirect them using the info from the URL
header ("Refresh: 5; URL=" . $_POST['redirect'] . "");