connection_aborted
Check if the client is disconnected
connection_aborted()
function checks whether the client is disconnected.
If the connection has been terminated, the function returns 1, otherwise it returns 0.
Create a function that writes a log message when the client terminates the script:
<?php function check_abort ( ) { if ( connection_aborted ( ) ) error_log ( "Script $GLOBALS [ SCRIPT_NAME ] " . " $GLOBALS [ SERVER_NAME ] was aborted by the user." ) ; } // Some code to execute // Call the check_abort function at the end of the script register_shutdown_function ( "check_abort" ) ; ?>
connection_aborted ( )