By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,654 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,654 IT Pros & Developers. It's quick & easy.

connection_status()

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try register_shutdown_function('logout');

ju**************@ntlworld.com (James Griffiths) wrote in message news:<8b*************************@posting.google.c om>...
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

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.