Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking users in a db

Status
Not open for further replies.

travisbrown

Technical User
Dec 31, 2001
1,016
Somebody tell me if this is ill-conceived;

I want/need to log usage on a site. It is really a onepage site. What I'm thinking is creating a global.asa file that will insert a record (SessionID, date/time, auth_user, referrer) in a table when a session starts. Then, on the asp page, create an insert command that will execute every time the page is loaded. This will insert into a child table the sessionID, page title, url w/ querystring, date/time, referring URL.

Then, on Session_OnEnd, I'd like to update the record in the primary table to add a session end time so I can do a differential annd see how long a session was.

What I need to know is, are sessionIDs unique just during concurrent sessions, or unique from for every session ever on the server. Will I ever get a duplicate sessionID?

If so, I will have to create an autonumber primary key in the DB and get the asp page to call the id where the record in the db equals the sessionID and use the record ID to insert in the child table.

I'd make the inserts a stored procedure, I think.

I haven't really worked with gobal.asa files before, save showing active users etc.
 
Just as an FYI...

I did the same thing, (the tracking of users), But I did it a little differelty. I have users login, and write a cookie. Then, on each page (or during each "action") I call my WriteLog(user,action) function. I put the function in a "Functions.asp" page that all my other pages include. It writes the date/time/who/what to the db, which I can review on my admin page.

I do it this way rather than at an "onload" because it lets me write a custom message based on what the user did, such as "Accessed Page", "Changed Status". vs a page using onload can only have one generic "Action" to report for the enitre page. (Assuming you have pages that call themselves).

Anyways, this does not answer your question, its just another way to do it.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top