Emi Posted March 8, 2007 Share Posted March 8, 2007 Hello,In my application, I user enter any page he must login.So if he didnot login he will find a link to register or login page.My question is that how can I make him directly back to the same pagethat he was on pefore log in????Thanx. Link to comment Share on other sites More sharing options...
pulpfiction Posted March 8, 2007 Share Posted March 8, 2007 To check if the user is logged in, you must be checking in every page session or something and if session not set then you redirect to login page, before this redirect, store the current page URL [ http://www.powerasp.com/content/new/get-current-page-url.asp ] in a session. and in the login page, if the user login is valid check for this session, if it contains some URL then redirect to that path else redirect to default page. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 8, 2007 Share Posted March 8, 2007 You don't have to store it in the session, you can just push it on to the end of the url: if (!$logged_in){ header("Location: login.php?ref=" . $_SERVER['SCRIPT_NAME']); exit();} Then get the ref variable on the login page and redirect back there if it's not empty.Oops, this is ASP, isn't it? if not logged_in then Response.Redirect("login.asp?ref=" & Request.ServerVariables("SCRIPT_NAME")) Response.End()end if Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now