This is a discussion on newbie: is this data stored in a cookie? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; php version 5.2.0 From http://no.php.net/session I've read that a session is either stored ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
php version 5.2.0
From http://no.php.net/session I've read that a session is either stored in a cookie on the user side or is propagated in the URL. So if the session below (see code example below) isn't propagated in the URL then it's stored in a cookie? And also I'm wondering about how can I set the expire time of this cookie?. I mean I didn't use setcookie to create this cookie... <?php session_start(); $_SESSION['count'] = 3; ?> Sorry I'm just a newbie Jeff |
|
|||
|
Jeff wrote:
> php version 5.2.0 > > From http://no.php.net/session I've read that a session is either > stored in a cookie on the user side or is propagated in the URL. Or a POST value. > So if the session below (see code example below) isn't propagated in > the URL then it's stored in a cookie? Or not/not at all. No way to tell with this portion of the code. Check your requests and answers to the site. If you're using Internet Explorer, Fiddler is an invaluable tool. Likewise with LiveHTTPHeaders for Firefox. > And also I'm wondering about how can I set the expire time of this > cookie?. I mean I didn't use setcookie to create this cookie... session.gc_maxlifetime for expiring session session.cookie_lifetime for expiring session cookie Check the values in Runtime Configuration on the url you gave us. It's all there. -- Rik Wasmus |
|
|||
|
See my post below
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message news:e7cab$459d7add$8259c69c$13113@news2.tudelft.n l... > Jeff wrote: >> php version 5.2.0 >> >> From http://no.php.net/session I've read that a session is either >> stored in a cookie on the user side or is propagated in the URL. > > Or a POST value. > >> So if the session below (see code example below) isn't propagated in >> the URL then it's stored in a cookie? > > Or not/not at all. No way to tell with this portion of the code. Check > your > requests and answers to the site. If you're using Internet Explorer, > Fiddler is an invaluable tool. Likewise with LiveHTTPHeaders for Firefox. > >> And also I'm wondering about how can I set the expire time of this >> cookie?. I mean I didn't use setcookie to create this cookie... > > session.gc_maxlifetime for expiring session > session.cookie_lifetime for expiring session cookie > > Check the values in Runtime Configuration on the url you gave us. It's all > there. > -- > Rik Wasmus > > Thanks for your reply I tryed to set the expire time of the cookie in my app but I got a compile error: session.cookie_lifetime = 2; Parse error: parse error, unexpected '=' any suggestions? Jeff |
|
|||
|
Jeff wrote:
> "Rik" <luiheidsgoeroe@hotmail.com> wrote in message > news:e7cab$459d7add$8259c69c$13113@news2.tudelft.n l... >> Jeff wrote: >>> From http://no.php.net/session I've read that a session is either >>> stored in a cookie on the user side or is propagated in the URL. >> >> Or a POST value. >> >>> So if the session below (see code example below) isn't propagated in >>> the URL then it's stored in a cookie? >> >> Or not/not at all. No way to tell with this portion of the code. >> Check your >> requests and answers to the site. If you're using Internet Explorer, >> Fiddler is an invaluable tool. Likewise with LiveHTTPHeaders for >> Firefox. >> >>> And also I'm wondering about how can I set the expire time of this >>> cookie?. I mean I didn't use setcookie to create this cookie... >> >> session.gc_maxlifetime for expiring session >> session.cookie_lifetime for expiring session cookie >> >> Check the values in Runtime Configuration on the url you gave us. >> It's all there. > > I tryed to set the expire time of the cookie in my app but I got a > compile error: > session.cookie_lifetime = 2; > Parse error: parse error, unexpected '=' > > any suggestions? ini_set('session.cookie_lifetime',2); Or use session_set_cookie_params(); A cookie that lasts 2 seconds is hardly usefull though.... -- Rik Wasmus |
|
|||
|
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message news:42e70$459d89b7$8259c69c$19149@news2.tudelft.n l... > Jeff wrote: >> "Rik" <luiheidsgoeroe@hotmail.com> wrote in message >> news:e7cab$459d7add$8259c69c$13113@news2.tudelft.n l... >>> Jeff wrote: >>>> From http://no.php.net/session I've read that a session is either >>>> stored in a cookie on the user side or is propagated in the URL. >>> >>> Or a POST value. >>> >>>> So if the session below (see code example below) isn't propagated in >>>> the URL then it's stored in a cookie? >>> >>> Or not/not at all. No way to tell with this portion of the code. >>> Check your >>> requests and answers to the site. If you're using Internet Explorer, >>> Fiddler is an invaluable tool. Likewise with LiveHTTPHeaders for >>> Firefox. >>> >>>> And also I'm wondering about how can I set the expire time of this >>>> cookie?. I mean I didn't use setcookie to create this cookie... >>> >>> session.gc_maxlifetime for expiring session >>> session.cookie_lifetime for expiring session cookie >>> >>> Check the values in Runtime Configuration on the url you gave us. >>> It's all there. >> >> I tryed to set the expire time of the cookie in my app but I got a >> compile error: >> session.cookie_lifetime = 2; >> Parse error: parse error, unexpected '=' >> >> any suggestions? > > ini_set('session.cookie_lifetime',2); > Or use session_set_cookie_params(); > A cookie that lasts 2 seconds is hardly usefull though.... > -- > Rik Wasmus > > Yes 2 seconds are very short, but now when I know how to set the cookie_lifetime, the I can give it a more useful value |
|
|||
|
Jeff schrieb:
> php version 5.2.0 > > From http://no.php.net/session I've read that a session is either stored in > a cookie on the user side or is propagated in the URL. Can you post the ecact line you refer to? Did you read: "A visitor accessing your web site is assigned a unique id, the so-called session id. This is either stored in a cookie on the user side or is propagated in the URL. " Then you didn't read closely, it only mentions a session id, that is either send along in the url, e.g.: index.php?PHPSESSID=5902345klwrletweltwktl or in case the browser accepts cookies you will find the PHPSESSID inside a cookie on your client computer. > > So if the session below (see code example below) isn't propagated in the URL > then it's stored in a cookie? You have to differentiate, betweeen a session a session_id and session data. > > And also I'm wondering about how can I set the expire time of this cookie?. > I mean I didn't use setcookie to create this cookie... you cannot set the expiretime for something you don't have:-) > > <?php > session_start(); you start a new session that is stored on the server the server assigns a unique id (PHPSESSID) to it. > $_SESSION['count'] = 3; now you store a key value pair in the session. Now to access this data, the client needs to tell the server his session id, in case the browser accepted the session cookie, it will just send it along, in case his browser does not accept cookies he has to submit the id in the url, which will only be done if the php designer added the PHPSESSID=452n54k23n54k23 to the url. > ?> > > Sorry I'm just a newbie > > Jeff > > |