Welcome Guest, Not a member yet? Register   Sign In
Passing referer to a page
#1

[eluser]jaswinder_rana[/eluser]
I am using DX_Auth library. When users log in , it redirects them to base_url(). But, I want it to redirect back to page where it came from.

I am accessing my page like http://domain/auth/login/ref/test_page

then for testing, I tried in my Auth controller's constructor
Code:
$this->load->library('URI');
print_r($this->uri->uri_to_assoc());

But, it's printing empty array. What am I doing wrong here?

I also tried it in login() function but same result.

I posted here as I din't want to clutter DX_Auth thread with this as this is just an extra requirement.



Thanks
#2

[eluser]sofbas[/eluser]
Seems like someone has asked on the DX_Auth thread (and looks like you replied with an answer Smile).

Unfortunately, I had to clutter the thread...

Have a look at my reply at DX_auth thread.

In short I use flashdata to store the URL. You can set_flashdata('url', uri_string()) to set the page referred from, get the flashdata('url') to redirect to on successful login, or you can keep_flashdata('url') to keep the referral when the user does not login successfully.

Hope that helps.
#3

[eluser]jaswinder_rana[/eluser]
Thanks.

Not sure how i missed that post. I think we posted around same time and I din't refresh my browser before posting.




Theme © iAndrew 2016 - Forum software by © MyBB