faqts : Computers : Programming : Languages : PHP : Common Problems : Ecommerce

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 30 people (57%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How can I store session data for a user?
How can I keep track of a user and their data?

Mar 19th, 2000 20:11
Dave Garth,


If php isn't compiled as a mod for apache http authentication wont work. 
In order to authenticate users and then keep track of them and their 
data I gave each user a sessionID which was created using $sessionID = 
uniqid(rand()). The sessionID was stored on their computer using a 
cookie with a short expiry, and every time they visited a page on my 
site it would be refreshed. Any data associated with that user would be 
stored in a database, and then retrieved every time it was needed.
Table Session
varchar SessionID
varchar Variable
varchar Value