• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirection to the action i were before/actually

Hi everyone,
Following situation:
I have 2 controllers: blog and user(it's the redux authentification library/controller).

I have the following layout that is built in the blog controller:

In the right navigation i have the usercontrol panel (login/logout link and things like this).
The logout link refers to the "user/logout" function listed here:

function logout ()
    $this->redux_auth->logout(); // Destroy the session variables.

With the redirect command it will show me the mainpage (controller: blog/index())
even if i was in the blog/viewpost action before.

What i want:
If i'm looking a blogpost and click the logout link on the right side, it should log me out (user/logout()) but then it should redirect me to the page i was before -> viewing a post in this situation (blog/viewpost())

How is this possible?

You can use $this->input->server('HTTP_REFERER'); to fetch the page where the user come from

Or you can pass it in every link you generate...
echo anchor('login/logout/' . $this->uri->uri_string());

redirect(implode('/', array_slice($this->uri->segment_array(), 2)));

You are genius..thanks so much!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.