Page 1 of 1
Simple Question(I think)
Posted: Fri Jun 18, 2010 12:42 pm
by fall0utm0dd
I'm trying to make a text based RPG online, and I just want a simple script in continue.php that redirects players to 'Location'.html, which is set by a cookie named Location.
Code: Select all
header( "Location: http://www.mysite.com/" . $_COOKIE['Location'] . ".html" ) ;
When I try to use it it just takes me to
www.mysite.com/.html, which of course throws an error. The cookie does have a value, I checked, so why is it just ignoring the variable?
Re: Simple Question(I think)
Posted: Fri Jun 18, 2010 12:50 pm
by AbraCadaver
It's not. Just before your header(), do:
Re: Simple Question(I think)
Posted: Fri Jun 18, 2010 1:07 pm
by fall0utm0dd
It stays on continue.php, but I know Location has a value because in the cookie editor it says it has the value of 'start', which is what it should have...
Re: Simple Question(I think)
Posted: Fri Jun 18, 2010 1:26 pm
by AbraCadaver
fall0utm0dd wrote:It stays on continue.php, but I know Location has a value because in the cookie editor it says it has the value of 'start', which is what it should have...
I don't have any idea what the cookie editor is, but if you echo it and it doesn't display anything, then it doesn't have a value. The problem may be where you set the cookie value. If you set it on a page then it won't be available until the next page load or refresh.
Re: Simple Question(I think)
Posted: Fri Jun 18, 2010 5:20 pm
by fall0utm0dd
Got it working. Imbecilic tutorial template for setting a cookie didn't explain that specifying a site that it can be used on doesn't include all subdirectories.