Newbie ? on sessions

From: Date: Thu, 13 Jun 2002 18:51:03 +0000
Subject: Newbie ? on sessions
Groups: php.general 
Request: Send a blank email to php-general+get-102035@lists.php.net to get a copy of this message
I'm very new to PHP/mySQL so please forgive me if this is a silly question. I'm mostly trying to understand the concepts involved in tracking user activity with sessions, and despite hours of reading I'm still confused. I have a membership site with users authenticated by a mySQL database. I have incorporated sessions into the login script which passes the session variables to a page restricted to members-only that contains links to articles. Here's the question: If a member logs out (session_destroy()) or closes the browser, the session data is gone, right? How, then, would I go about storing information about the member's activity on the site? The next time they log in, I'd like to greet them with a message that says "Hi, $username. You last visited the site on $date and you viewed the following articles: $article1, $article2." Do I need to store the sessionid in the database and register more variables to track the activity, or should I write a separate script that stores details of their activity, perhaps as a separate table in the database? What I really don't understand is whether this sort of tracking is done with sessions or by writing to a database. (OK that's more than one question.) Also, if I do need to store the session ID in the database and I don't have access to the php.ini file, is there a way to set the session_save_handler to user through .htaccess or some other means? Thanks very much for any help you can provide. Vicki

« previous php.general (#102035) next »