[SOLVED] Redirect from string in URL
Posted: Sat Feb 14, 2004 7:57 am
This is probably something really obvious, but can anyone see a bug in this script?
print "<script language='javascript'>";
if (strlen($redirect) == 0) { $redirect = "members_home.phtml"; }
print "self.location = '" .$redirect. "';";
print "</script>";
All this is supposed to do is find out if $redirect is set in the URL, if it is then redirect them to that page using JavaScript, and if it isn't, redirect them to members_home.phtml. The reason I need this is so that if someone is logging in from a different page, eg the forums, it would be handy to redirect them back to there rather than to members_home.phtml.
Anyone got any suggestions? There's no syntax error that I know of, but it just doesn't work a lot of the time.
print "<script language='javascript'>";
if (strlen($redirect) == 0) { $redirect = "members_home.phtml"; }
print "self.location = '" .$redirect. "';";
print "</script>";
All this is supposed to do is find out if $redirect is set in the URL, if it is then redirect them to that page using JavaScript, and if it isn't, redirect them to members_home.phtml. The reason I need this is so that if someone is logging in from a different page, eg the forums, it would be handy to redirect them back to there rather than to members_home.phtml.
Anyone got any suggestions? There's no syntax error that I know of, but it just doesn't work a lot of the time.