njdubois Posted January 10, 2012 Share Posted January 10, 2012 Please keep in mind that I started using php months ago. I can make it do what I want it to do and have managed to set up a full fledged membership system linked to other sql data sources for a client. But for the sake of the problem I will simplify my question, cause even I don't know what I am asking. I have a membership site, users can login and what not.... I want to email this user a url to a part of the page when an admin wants to alert the user of something. "www.mysite.com/member_home.php?pet=dog&size=lrg&age=old" please keep in mind this is a dummy down version. The problem is, if this user isn't currently logged in member_home will redir them to the login page. The login page redir the browser to the login checking script, which then needs to redir the user to the original url. How do I pass this url from the original email link, through the whole process? If i'm correct : "/member_login.php?redir=member_home.php?pet=dog&size=lrg&age=old" wont work. redir=member_home.php?pet=dog then it will see size and age as other variables. What do I need to learn to achieve what I am aiming for? Thanks in advance! Nick Quote Link to comment Share on other sites More sharing options...
jotorres1 Posted January 18, 2012 Share Posted January 18, 2012 You need to use the $_SERVER global. <?php $url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?> Where $_SERVER['SERVER_NAME'] would return www.mysite.com and $_SERVER['REQUEST_URI'] returns "/member_login.php?redir=member_home.php?pet=dog&size=lrg&age=old". You can use a session variable (example $_SESSION['redirect_url']) to store the url, and when the user logs in, check to see if a $_SESSION['redirect_url'] is available, and if it is, then redirect, else, do normal process. Quote Link to comment Share on other sites More sharing options...
njdubois Posted January 18, 2012 Author Share Posted January 18, 2012 awesome! I knew there had to be something built in. Many thanks! Nick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.