Cookies & sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying for the first time to use cookies. The manual contains the statement "Cookies
are part of the HTTP header, so setcookie() must be called before any output is sent to
the browser." 

When I first started using sessions, I was alarmed to read a very similar statement about
sessions, but I soon found that if I started my program with the statement
"session_start();" I could then set up, access, modify or clear any session variable at
any time in my program. This is enormously useful, as I can put the session handling at
any convenient point in my program, and can precede them with diagnostics if I need to.

However I have almost immediately found that while I appear to be able to read cookies at
any time, I cannot set them when I would like to. Is there any similar trick which will
work with cookies? If I really have to work out what they should be, and then set them up,
before issuing any diagnostics, etc, it will make life decidely more complicated. (I
assume that I can set several cookies using successive calls to setcookie()?)

I was also somewhat surprised to find that a cookie is used to implement sessions. Does
this place any limitations on using both sessions and cookies in the same program?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux