Client close Event

General discussions related to php

Moderators: macek, egami, gesf

larenge
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Dec 27, 2011 6:40 am

Client close Event

Postby larenge » Thu Jun 07, 2012 6:00 pm

I want some PHP script to be executed when client closes the connection or close the browser. or
I want some PHP script to be executed when client connects to the Server first time.

How can i have the above possible, please provide me some solution.

User avatar
ejsexton82
New php-forum User
New php-forum User
Posts: 86
Joined: Mon Jun 04, 2012 10:05 pm
Location: Ankara, Turkey
Contact:

Re: Client close Event

Postby ejsexton82 » Tue Jun 12, 2012 3:30 am

Determining when a user connects to a website for the first time should be pretty easy with the proper use of Sessions.


The tricky part would be determining when the client leaves the website. The best you could do would be to monitor the user's activity on the website, and then execute a script when the user has been inactive for several minutes. I imagine such a solution would use cron tasks to identify users which are recently inactive, and then execute a PHP script.

I hope that helps. Good luck!


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest