I've been wondering about this for some time now and now I need to have an answer for work.
When I write something like the following, the cookie doesn't get set:
But, when I replace PHP's header() with a client-side redirect the cookie gets set properly:Code:<? @setcookie("lister_id", $_GET['l'], time()+18144000, "/"); @header('Location: '.base64_decode($_GET['re'])); ?>
The only thing I can think of is that since setcookie() has to deal with an actual file (the cookie on the client's machine) that the first command is not getting executed by the time the server gets to the header() command. Is that what's going on? Also, is there some way I can slow down this process so I don't have to incorporate a JavaScript redirect?Code:<? @setcookie("lister_id", $_GET['l'], time()+18144000, "/"); echo '<script> document.location="'.base64_decode($_GET['re']).'"; </script>'; ?>
Many thanks.




Reply With Quote