CodeIgniter: Dynamic post-login redirection?

When they hit the restricted page record the uri and set it as session data with this->session->set_userdata('redirect', 'page/uri/here') then redirect them to the login / register after they login check to see if 'redirect' is present with if($this->session->userdata('redirect')) { redirect($this->session->userdata('redirect')); } if it doesn't then take them wherever you normally take them after a login.

When they hit the restricted page record the uri and set it as session data with this->session->set_userdata('redirect', 'page/uri/here'); then redirect them to the login / register after they login check to see if 'redirect' is present with if($this->session->userdata('redirect')) { redirect($this->session->userdata('redirect')); } if it doesn't then take them wherever you normally take them after a login.

Brilliant, thanks! – Jakobud Jan 25 '10 at 5:39.

When attempt to access is intercepted: redirect('/public/login/r'. $this->uri->uri_string()); so in your case, after redirection the url might look like this: example.com/public/login/r/project/detai... if the login is successful $uri = $this->uri->uri_string(); $redirect = substr($uri, strpos($uri, '/r/')+2); redirect($redirect); will redirect to the original resource. (and no, the +2 should not be +3).

Build it into a library, so you can call the following: $this->mylibrary->login($user); and $this->mylibrary->is_logged_in($user); on top of each page and automatically redirect visitors to your main site.

I think you misunderstood the question. – Jakobud Jan 28 '10 at 0:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions