View Full Version : Trying to make counter

04-26-2006, 08:56 AM
i want to write a hit counter script. i record the visitor's IP in a temp DB. but when a user leaves my site, i want to delete this IP from DB. how can i get notified that visitor leave it.

that is, i want to run a script on body unload.

Please help. urgent

04-26-2006, 01:31 PM
his has been asked here a dozen times before --> run a search for more info.

short answer: you can't catch all possible ways of users leaving your site. the closes thing you can do is update the tempDB each time the users requests a page (for instance updating a 'datetime_lastrequest' timestamp column). and then have a cron job running every X minutes that deletes all records where the datetime_lastrequest < (Now - X minutes)