Welcome Guest, Not a member yet? Register   Sign In
Is CI (User Agent Class)->referrer() safe?
#1

[eluser]taewoo[/eluser]
I know PHP's $_SERVER['REFERER'] isn't... is this CI library safe? Will it gurantee correct referer string?
#2

[eluser]Seppo[/eluser]
It is impossible to have a gurantee referer. The only way to get it is from the client HTTP request data, and it's not reliable.
#3

[eluser]aroman[/eluser]
@seppo hi seppo, so what should be the proper way for referring url in ci? most of my code is using this $_SERVER[’REFERER’] for redirecting back to the previous page..and also i tried using the session->set_flashdata('cur_url', $url_here) for storing the current uri and then later,get the current value of session->flashdata('cur_url') to redirect the page..
#4

[eluser]Seppo[/eluser]
Well, the second method is safer, although referer might be OK if you are just gonna use it to link to other page... But it's not safe to check, for example, permissions.
#5

[eluser]brettalton[/eluser]
Hey everyone, this is the method I use for redirects (specifically when using an authentication/member system): http://ellislab.com/forums/viewreply/801348/

It involves simply passing the page you want the user to go through in the URI.




Theme © iAndrew 2016 - Forum software by © MyBB