473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

connection_status()

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
1 1869
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alexander Gilman Carver | last post by:
I have written a pair of scripts that are supposed to work together to display an index of files and then, upon the user choosing the files (with checkboxes on an HTML form submitted to itself),...
2
by: mike_j | last post by:
I'm writing a download script in php. This script sends files using echo in order to limit download speed. My script has to do something after connection abort. Everything is ok unless client...
0
by: mike_j | last post by:
I'm writing a download script in php. This script sends files using echo in order to limit download speed. My script has to do something after connection abort. Everything is ok unless client...
12
by: WebRod | last post by:
Hi, i have a script (script1) which needs to call another script (script2). It should not wait for the answer, so script2 should run in the background. I really need to call the php script...
15
by: shyren | last post by:
Hi All, I have a php program which calls a c++ program using exec. However when user presses stop button in the browser or closes it this program keeps on running on the server. How can I stop it...
13
by: Shailesh Humbad | last post by:
Here is an advanced PHP question. Can anyone think of a way to detect the number of bytes written to output when a script is aborted? I am sending a large file to the client, and I want to record...
0
by: FB2006 TEAM | last post by:
Apache 2.0 PHP 4.4 MySQL 5.0 ========= Ok, here what is going on! Every time when I trying to login into system I’m getting message (its last “else” in F_LogIn function): “Nothing is working”...
1
by: Alex | last post by:
Hello, I'm trying to write a little php script to transfert some files from a server to clients (web/http). It's working fin with small files. But transfering big files (try on 1Gb) failed!...
2
by: Man-wai Chang | last post by:
If a user hit stop button on his/her browser after a php has started, will the php script be continued to the end? -- iTech Consulting Co., Ltd. Expert of ePOS solutions Website:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.