Results 1 to 3 of 3

Thread: [Resolved] header faster than setcookie?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    121

    Resolved [Resolved] header faster than setcookie?

    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:
    Code:
    <?
    @setcookie("lister_id", $_GET['l'], time()+18144000, "/");
    
    @header('Location: '.base64_decode($_GET['re']));
    ?>
    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, "/");
    
    echo '<script> document.location="'.base64_decode($_GET['re']).'"; </script>';
    ?>
    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?
    Many thanks.
    Last edited by solitario; Sep 11th, 2007 at 09:19 AM. Reason: sufficient answer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width