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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user tracking

Status
Not open for further replies.

lonelydragon

Programmer
Aug 5, 2004
75
US
i have one question on tracking the user?
how do a programmer know that the user close the browser and left?
thank you in advance
 
You won't have a deterministic way of knowing when the user shuts down the browser.

If you're using a session variable to store the user's current login, then when the user shuts down his browser, the session ID cookie will be deleted. So the next time the user comes to your site, he'll have to log in again.

PHP's session garbage-collection mechanism will sooner or later clean up excess data in your server session store.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
thank you for your reply.
but the point is how do i know that the usr left by closing the browser? i need that info to update the database.
thank you
 
That's just it -- you don't.

You must keep in mind how web applications work, specifically that they are discontinuous. A user connects his browser to your server, some information is exchanged, then the connection is terminated. After the moment that the connection is terminated, your script has no way of knowing whether that user's browser will ever connect again.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top