CodeIgniter Forums
Passing referer to a page - 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: Passing referer to a page (/showthread.php?tid=14178)



Passing referer to a page - El Forum - 12-21-2008

[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


Passing referer to a page - El Forum - 12-21-2008

[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.


Passing referer to a page - El Forum - 12-22-2008

[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.