Page 1 of 1

To long of url to redirect

Posted: Sat Aug 21, 2004 10:12 pm
by pinehead18
Ok, yesterday i wrote this script which worked fine for like 3 hours. It is this.


$_SESSION['go_to'] = $_SERVER["HTTP_REFERER"];
$go_to = $_SESSION['go_to'];
$url = explode("/", $go_to);
$lurl = "/".$url[3]."/".$url[4]."/".$url[5]."/".$url[6];

This gives the last url, if it does exist. For example if the person tries to login from the forums it give sthe address /forums/id_of forum/ and when the person logs in the header() sends it back to them.
header("location: ".$lurl."");

It works great if you are logging in from the forums, however if you are logging in from index.php then i get the following popup error from firefox.

"redirection limit for this url exceeded. unable to load the requested page, this may be caused by cookies that are blocked.

Thank you all

P.S at least i'm writing my own stuff now and having probs vs always asking how to write :)

- Anthony

Posted: Sun Aug 22, 2004 12:10 am
by feyd
I've had this error, when I was accidently infinitely redirecting.. so you may want to look into where you are redirecting to.. to make sure it's not a self referencing one..

Posted: Sun Aug 22, 2004 1:47 am
by pinehead18
So basically, if this re-direct was being re-directed towards a page that had another re-direct. That would be it, i am getting the error only ont he page that is doing the re-directing. So i should just put in a simple if statement
like if it = a certain page send here instead.

You've been a big help once again.

At least your not writing code for me like you used to :) Lets hope it stays that way.

Posted: Sun Aug 22, 2004 1:49 am
by feyd
I hope it stays that way too ;)