Web Hosting Talk







View Full Version : Sessions and Cookies


Xandra
09-14-2002, 04:22 PM
Please include why, since Im working on a script and would like a few opinions.

The Prohacker
09-14-2002, 04:36 PM
Opions about what??

What to use???

Really a combination of sessions and cookies are good...

prosayist
09-14-2002, 04:39 PM
depends on what you're tryinna do.
$essions
{'anything with mysql','only keepin\' track of data in the current "session"';}
cookies
{'keep track of user-specific data from one visit to the next';}
.htaccess
{'stop thief from linking your images','protect directories';}

what's your script tryinna do?

Xandra
09-14-2002, 05:34 PM
It's nothing big like a board or anything. It's just a script that calculates custom plan prices but after someone submits, it gets logged into a database. I'd need an admin panel for that.

Someone suggested I use sessions since they cause less problems but I've noticed a lot of scripts using .htaccess as well.

Rich2k
09-14-2002, 07:36 PM
Yeah it really depends, if you are trying to determine login details I force 401 authentication in the php header and then use the in built username and password variables. I never store passwords in cookies.

mAgz
09-14-2002, 08:22 PM
I store pws in cookies only after i crypt("$string","salt"); them...

prosayist
09-14-2002, 08:45 PM
no, don't do that
just store a 'key' in the cookie that can be used to open up the password (stored on the server)
crypt("$string","salt"); the key ;)

Alturus
09-14-2002, 09:40 PM
Sessions: For shipping carts, people who don't want to stay logged in, passing info transparently from page to page.

Cookies: So they don't have to log in every time they visit a site.
Storing passwords in cookies isn't a terrible idea, just make sure you md5 anything that's being passed via http

prosayist
09-15-2002, 03:10 AM
Originally posted by Alturus
Storing passwords in cookies isn't a terrible idea, just make sure you md5 anything that's being passed via http

yeah, I guess.. I'm just paranoid

Xandra
09-15-2002, 07:44 AM
If I do use cookies, I'm going to have a timeout- I'm just too paranoid. Just wonering what the benifits to sessions and .htaccess were since every php programmer that I've spoken to seems to hate cookies and love sessions.

cyhosting
09-15-2002, 09:21 PM
Depending on what you are trying to do. But I prefer cookies.

Good luck.