![]() |
[solved] How to write the current URL into a session (Comfort-Login) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [solved] How to write the current URL into a session (Comfort-Login) (/showthread.php?tid=7400) |
[solved] How to write the current URL into a session (Comfort-Login) - El Forum - 04-07-2008 [eluser]tschunde[/eluser] Hi all :-) In order to bring a little comfort into the login part of my application I want to do the following: Step 1. A guest visits a protected page (he needs to be logged insave the current URL the user visits into the session). Step 2. The user is redirected to a login page while the url he wanted to view is saved into a session. Step 3. After logging in the user is redirected to the protected page he wanted to visit last time. On protected Controller Functions I make this call: $this->acl->check(); //My Own ACL Class that checks if the user is logged in. If not he is redirected to login. So I want to modify check() to save the current url into the session in order to redirect back after logging in. How realize this this? Kind Regards tschunde [solved] How to write the current URL into a session (Comfort-Login) - El Forum - 04-07-2008 [eluser]Kinsbane[/eluser] FIrst, use this function combined with your $config('base_url') value to get the URL (unless there's a better way, which there probably is): Code: $this->uri->uri_string() Then, use this to set the value into the session: Code: $this->session->set_userdata('some_name', 'some_value'); [solved] How to write the current URL into a session (Comfort-Login) - El Forum - 04-07-2008 [eluser]wiredesignz[/eluser] You can read this thread http://ellislab.com/forums/viewthread/74855/ and then try a forum search. Welcome to CI forums [solved] How to write the current URL into a session (Comfort-Login) - El Forum - 04-07-2008 [eluser]tschunde[/eluser] Whoa! You guys are really fast! Thank you very much... I already did some searches but didn't find this thread. I think now I'm gonna make it... Great support ![]() [solved] How to write the current URL into a session (Comfort-Login) - El Forum - 04-07-2008 [eluser]tschunde[/eluser] okay I implemented it now ![]() nice... works like a charm |