Connecting Tech Pros Worldwide Forums | Help | Site Map

Tracking user activity in PHP

kasterborus@yahoo.com
Guest
 
Posts: n/a
#1: Mar 8 '06
Hi,

My client is using the UBB Threads forum and I was recently asked to
look into adding the ability to track the activity of each of the users
to see who is more active than others. Users are identified by a
cookie.

Now can this be done at the server level somehow? Or would it be easier
to include a tracking function in each page that records a per user hit
count?

Obviously I don't want to give the server more work to do than is
necessary.

Thanks in advance,
Dave


Gordon Burditt
Guest
 
Posts: n/a
#2: Mar 8 '06

re: Tracking user activity in PHP


>My client is using the UBB Threads forum and I was recently asked to[color=blue]
>look into adding the ability to track the activity of each of the users
>to see who is more active than others. Users are identified by a
>cookie.[/color]

Take the value from $_COOKIE['userid'] and use it to increment a
counter in a database for the user. Or log the user id, page,
timestamp and IP address in a database. It depends on how much
detail you need.
[color=blue]
>Now can this be done at the server level somehow?[/color]

Yes.
[color=blue]
>Or would it be easier
>to include a tracking function in each page that records a per user hit
>count?[/color]

The counting would have to be done on each page, or in common
code included from each page. I believe Apache has a capability
of specifying a header file for each PHP page in a directory so
you could use that without editing existing pages.

Client-side tracking is difficult because Javascript is Turned
Off(tm), a single user does not necessarily mean a single computer
with a single browser, and the data, being stored on the client,
isn't as accessible when you need it.
[color=blue]
>Obviously I don't want to give the server more work to do than is
>necessary.[/color]

Gordon L. Burditt
Closed Thread