Try register_shutdown_function('logout');
junk2.jamesgriff@ntlworld.com (James Griffiths) wrote in message news:<8b3c2aa1.0311301334.91acaad@posting.google.c om>...[color=blue]
> Dear all,
>
> My spec:
> Win 98
> Apache 2.0.46
> PHP 4.3.2
>
> I am making a chat program which needs to log out the user if they
> close the window or press 'Stop'.
> I used the following code:
>
> set_time_limit(0);
> ignore_user_abort(TRUE);
>
> while(1) {
> if (connection_status()) {
> logout();
> }
> }
>
> where logout() is a function.
> This had no effect, apparently because i needed to send data to the
> client to be able to tell whether the connection was still active. So
> I used the following code:
>
> set_time_limit(0);
> ignore_user_abort(TRUE);
>
> while(1) {
> echo "\n";
> flush();
> if (connection_status()) {
> logout();
> }
> }
>
> This, however, died when I pressed 'Stop'.
> Anyone have any bright ideas?
>
> Regards,
>
> James[/color]