It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming PHP and MySQL Forum

cookies in PHP

Moderator: Malcolm

cookies in PHP

Postby tornado on Thu May 17, 2007 10:35 am

As I am working on this http://www.deonlinecasino.com. I want to maintain cookies on my site. I know that cookies are created as temporary cookies which are store in the browsers memory. When browser is closed, these temporary cookies will be erased. Can anybody help me to know more about cookies in PHP and how to maintain cookies?
tornado
 
Posts: 3
Joined: Thu Mar 01, 2007 7:38 am

Postby flabbyrabbit on Sat May 26, 2007 7:36 pm

Ok here I go, ive only just really worked out how to use cookies lately but it seems to be quite simple. The first thing is how long will you need to store the information, will you only need it for that session or will you need to keep it for longer?? If you only need it for that session then sessions should be used instead of cookies. Sessions are lost when the user closes their browser were as cookies are kept for a set time. So which will you need??

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 707
Joined: Thu Jan 25, 2007 2:10 pm
Location: Midlands, England

Postby litebulb1 on Fri Sep 28, 2007 1:01 am

If you are going to be using cookies you can just set the life time for the cookies so that they expire.
litebulb1
 
Posts: 21
Joined: Fri Sep 28, 2007 12:10 am

Postby bobbyblades on Fri Sep 28, 2007 1:38 am

don't set an expiration date for the cookie if you want it to last for only a browser session, otherwise you set the expire time as a unix timestamp of some future date. Sessions should not be used over cookies they cost much more in terms of overhead unless your storing objects or large chunks of data over multiple pages, or if people don't have cookies turned on.
User avatar
bobbyblades
50+ Club
 
Posts: 85
Joined: Fri Aug 24, 2007 9:38 pm
Location: hawaii or bust


Who is online

Users browsing this forum: No registered users and 1 guest