|
Posted by Berimor on 11/06/05 20:19
On Sun, 6 Nov 2005 14:49:20 +1300, windandwaves <winandwaves@coldmail.com>
wrote:
> Berimor wrote:
> .....
>> session_start() should first in output to browser. Try to place
>> thesetcookie() after session_start().
>
> Ok, interesting ;-) Can you explain me why that is? Just so that I
> understand.. Will do
the PHP Manual says
" ... Note: If you are using cookie-based sessions, you must call
session_start() before anything is output to the browser.
"
the nature of sesion mechanism is more complex than just cookie. You can
set cookie at any place of script - you just make easy operation - write
the information to broweser's cookie. When session starts it uses cookie
only to save session identificator but behind the curtains huge piece of
work being done - session prepares the, so called, session environment. I
have never dig it deeply though :)
Let mne know if this helped.
>
>
>>
>>
>>> //function to include session ID in case they do not accept cookies
>>> function sid($withamp) {
>>> if($_COOKIE["CookieTest"] == "t") {
>>> return '';
>>> }
>>> $s = session_id();
>>> if($s) {
>>> if($withamp) {
>>> $v = '&';
>>> }
>>> $v .= 'PHPSESSID='.$s;
>>> return $v;
>>> }
>>> }
>>> /* end of startup.php */
>
>
--
Exact Meta Search | Major Search Engine
http://exactsearcher.com
Navigation:
[Reply to this message]
|