register_shutdown_function

From: Date: Tue, 11 Apr 2000 10:16:34 +0000
Subject: register_shutdown_function
Groups: php.dev 
Request: Send a blank email to php-dev+get-17797@lists.php.net to get a copy of this message
Hello, to log which users are using a streaming connection (something like a chat) i make in insert into a user table as soon as they start the stream. Now i want to kick them of the list as soon as the connections is aborted (e.g. hitting the stop button). I tried to register a shutdown function called delete_user that does a database query to delete the user entry. My problem is that the function is not called regulary. After a while (something like 5 mins) the server seems to register that the connections was aborted and does the delete_user - but only sometimes. I even do a echo at the end to trigger the shtdown function as described in the manual. My code is looking like that: function delete_user() { >> delete user << }; register_shutdown_function (delete_user); while (!connection_aborted()) { >> do the stream << }; echo "something to trigger the shutdown"; Any suggestions? Michael

« previous php.dev (#17797) next »