Topic: Cookies Vs. Sessions
Totage's photo
Wed 02/18/09 02:02 PM
Which do you prefer, cookies or sessions? Why?

I have e107 installed on my site and I have it set to sessions, just because, but I would like to hear some opinions from others.

chrish's photo
Fri 02/20/09 08:35 AM
To be honest, there isn't much of a difference.

Sessions refers to PHPs own session handler ($_SESSION) which is saved in the TMP directory of your web server.
PHP can either store the session ID in a cookie, or by appending the sessions ID to URLs.

Cookie, sounds like e107 have their own session handling code, and will write there own cookies, and store the session in MySQL.

Seeing 99% have cookies enabled, I'd go with Cookie as e107 might have or need extra functionality from its own session handler as some point in the future. Also, I hate ugly URLs.

Of course, hopefully e107 will have abstracted their session handling code, and my point might be moot, but you never know.

(P.S. I can't be arsed to read the e107 source and find out.)


Ta,

Chris.

no photo
Fri 02/20/09 08:38 AM
White chocolate macadamia are my preferred cookie

Totage's photo
Fri 02/20/09 02:13 PM

To be honest, there isn't much of a difference.

Sessions refers to PHPs own session handler ($_SESSION) which is saved in the TMP directory of your web server.
PHP can either store the session ID in a cookie, or by appending the sessions ID to URLs.

Cookie, sounds like e107 have their own session handling code, and will write there own cookies, and store the session in MySQL.

Seeing 99% have cookies enabled, I'd go with Cookie as e107 might have or need extra functionality from its own session handler as some point in the future. Also, I hate ugly URLs.

Of course, hopefully e107 will have abstracted their session handling code, and my point might be moot, but you never know.

(P.S. I can't be arsed to read the e107 source and find out.)


Ta,

Chris.



Thanks for the information.

I did notice that if I use cookies, then the Remember me feature is available, but with sessions it's not available, that seems to be about the only difference between the two.