You shouldn't have to store the sessionID. It's going to be new each time
someone comes to the site, anyhow. Once the log in, you should know who they
are. Save the "tracking" information you want in your database and pull it
out based on their username.

You have to use a database or a file to "remember" things like this.
Sessions are only good for that browser session. Cookies last longer and you
could use them to reference things, or even to store the data, but they can
be tampered with on the user side.

---John Holmes...

----- Original Message -----
From: "Vicki" <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 2:51 PM
Subject: [PHP] Newbie ? on sessions

> 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
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to