Looking to redirect the user of my site to the page they were trying to access when they have logged in. I am using a function to protect my pages until the user has logged in, if a user tries to access a secure page they are redirected to a "continue" page to sign in. I am trying to make it so that once the user has logged in, they will go straight back to the page they were trying to look at? Is this possible?
function protect_page() {
if (logged_in() === false) {
header('Location: continue.php');
exit();
}
}