NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP

Peter Sawczynec psaw at pswebcode.com
Tue Jan 11 15:19:02 EST 2005


Couple of alternate solutions (viable but got pitfalls):

1) Tiny JavaScripted popup or popunder window polls the opener page for it's
existence. When opener page disappears, the popup window does location
change to PHP logout page, processes, and then closes itself. 

2) 1x1 transparent gif src points to PHP script page that polls for
"connectin_aborted" and fires logout script when true.

Peter

 

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of charlie derr
Sent: Tuesday, January 11, 2005 2:59 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP


What about using <meta http-equiv="Refresh" content="60; http://yoururl"> in
the header of the page?

As i understand it, this would try to grab a new copy of the page every
minute (modify the 60 if you want a longer or shorter time).  By keeping
track of when the reloads cease, you'd know when the visitor closed the
browser (or lost network connectivity) even if she/he didn't hit the logout
button.

And surely it'll be no picnic to integrate something like this with your
already existing authentication code (so that it works seamlessly and
doesn't demand a new login on every automatic refresh once a minute).  And
if your pages are places where people can input data (via forms), it'd be a
real drag to have the page automatically reload (and lose the paragraph or
so of text that your visitor just entered in a form field(s)).


	good luck,	
		~c

Peter Sawczynec wrote:
> This is a possible "almost does it" option.
> 
> The time of every new page hit by the user can be entered as the 
> newest logout time. So if they never formally logout we at least have 
> an approximate Log Out time. If they really Log Out, we get the Log 
> Out time for real.
> 
> By the by, there is a way to rig something with JavaScript and the 
> onUnload event. But it has pitfalls too.
> 
> I am surprised now that PHP doesn't offer "on session start" and "on 
> session end" event capturing, or am I wrong?
> 
> Thanks,
> 
> Peter
> 
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org 
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Rahmin Pavlovic
> Sent: Tuesday, January 11, 2005 2:17 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] PHP
> 
> 
> 
> 
> On Tue, 11 Jan 2005 14:06 , Peter Sawczynec <psaw at pswebcode.com> sent:
> 
> 
>>Using PHP, is there a simple way to capture browser shutdown or a
>>session termination event, so that a user's departure time from a site 
>>can be captured when they don't use the formal Log Out button.
>>
>>I need to track user time logged into a site. I am using PHP sessions.
>>Currently, capturing the user Log In efforts and capturing the user Log 
>>Out time when they hit Logout button.
>>
>>Any solution suggestions for capturing log out time of users who just
>>close the browser?
>>
> 
> 
> A possible solution would be log 'on-site' time by saving a timestamp 
> of every page view.  We do that in-part to prevent additional log-in's 
> from the same account during a given active timeframe.
> 
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP) 
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP) 
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org

_______________________________________________
New York PHP Talk
Supporting AMP Technology (Apache/MySQL/PHP)
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org





More information about the talk mailing list