Re: [PHP] sessioncookies?

2005-03-21 Thread Jochem Maas
William Stokes wrote:
Hello,
I have a following line in my code to set a session cookie when user logs 
in. It works fine.
setcookie(sess_id,$sess_id,0,/);

Can I store more information to the session cookie? I mean other variables. 
what are you trying to do? (do you need the info in the cookie on the 
client?
or does it need to be 'permanent'?
explicitly-without-sarcasm
do you know what a php session is? I get the impression you either don't
or that there is some kind of misunderstanding.
/explicitly-without-sarcasm
if you want to use the native php session functionality then you don't
have to use setcookie(), instead have good look at:
http://php.net/session
and in particular:
http://php.net/session_start
tiny hint: you 'start' the session on each page (maybe an include file would
come in handy) and then make use of the $_SESSION superglobal (which can store
allsorts [but not all**] of types of variables accross requests).
**resources,filehandles,streams,etc
Like I tried it like this with no success.
setcookie(sess_id,$sess_id,$another_variable,0,/);
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sessioncookies?

2005-03-21 Thread Richard Lynch
On Fri, March 18, 2005 8:30 am, William Stokes said:
 OK. so can I set 2 or more session cookies for the same user? Like this:
 setcookie(sess_id,$sess_id,0,/);
 setcookie(cookie2,$another_variable,0,/);

 If so is there a limit?

The browser is not required to keep more than N cookies.

I think N is 30.

It *also* is not required to keep more than X kilobytes in all the cookies
from your server combined.

X is some reasonable number.

It doesn't matter because...

 Or is it a bad idea for some other reason?

It's a Bad Idea because it's just more crap going back and forth over HTTP
(slow) and more annoying to those of us who surf with some discretion over
Cookies.  If your site sends too many Cookies for me to decide if they are
okay or not, buh-bye.

Use session_start() which sends *ONE* cookie, and then you can store
whatever you want in $_SESSION to tie it all to me

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] sessioncookies?

2005-03-19 Thread Ken
if you check your cookies (if you are using firefox) you should see
multiple cookies from many sites. It is allowed and I think you can
set as much as possible. However I wouldn't because you'll probably
end up forgetting some of them and it'll become a hassle. Besides,
some browsers might reject cookies, so don't rely too heavily on
cookies. And then there is the security factor to consider... you
don't want to store too many cookies that might give away
passwords/usernames.

That's all the bad reason I can think of.

Good luck :D


On Fri, 18 Mar 2005 18:30:58 +0200, William Stokes [EMAIL PROTECTED] wrote:
 OK. so can I set 2 or more session cookies for the same user? Like this:
 setcookie(sess_id,$sess_id,0,/);
 setcookie(cookie2,$another_variable,0,/);

 If so is there a limit? Or is it a bad idea for some other reason?

 Thanks
 -Will

 Ken [EMAIL PROTECTED] kirjoitti
 viestissä:[EMAIL PROTECTED]
  No, you'll have to use another cookie name.
  Alternatively, you can use arrays
 
  setcookie('cookiename['arrayname']', $value, time());
 
 
  On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes [EMAIL PROTECTED]
  wrote:
  Hello,
 
  I have a following line in my code to set a session cookie when user logs
  in. It works fine.
  setcookie(sess_id,$sess_id,0,/);
 
  Can I store more information to the session cookie? I mean other
  variables.
  Like I tried it like this with no success.
  setcookie(sess_id,$sess_id,$another_variable,0,/);
 
  Thanks
  -Will
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



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



[PHP] sessioncookies?

2005-03-18 Thread William Stokes
Hello,

I have a following line in my code to set a session cookie when user logs 
in. It works fine.
setcookie(sess_id,$sess_id,0,/);

Can I store more information to the session cookie? I mean other variables. 
Like I tried it like this with no success.
setcookie(sess_id,$sess_id,$another_variable,0,/);

Thanks
-Will

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



Re: [PHP] sessioncookies?

2005-03-18 Thread Ken
No, you'll have to use another cookie name.
Alternatively, you can use arrays

setcookie('cookiename['arrayname']', $value, time());


On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes [EMAIL PROTECTED] wrote:
 Hello,
 
 I have a following line in my code to set a session cookie when user logs
 in. It works fine.
 setcookie(sess_id,$sess_id,0,/);
 
 Can I store more information to the session cookie? I mean other variables.
 Like I tried it like this with no success.
 setcookie(sess_id,$sess_id,$another_variable,0,/);
 
 Thanks
 -Will
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] sessioncookies?

2005-03-18 Thread William Stokes
OK. so can I set 2 or more session cookies for the same user? Like this:
setcookie(sess_id,$sess_id,0,/);
setcookie(cookie2,$another_variable,0,/);

If so is there a limit? Or is it a bad idea for some other reason?

Thanks
-Will


Ken [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 No, you'll have to use another cookie name.
 Alternatively, you can use arrays

 setcookie('cookiename['arrayname']', $value, time());


 On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes [EMAIL PROTECTED] 
 wrote:
 Hello,

 I have a following line in my code to set a session cookie when user logs
 in. It works fine.
 setcookie(sess_id,$sess_id,0,/);

 Can I store more information to the session cookie? I mean other 
 variables.
 Like I tried it like this with no success.
 setcookie(sess_id,$sess_id,$another_variable,0,/);

 Thanks
 -Will

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

 

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