I would like to know how do I stop the PHP process if the user closes the screen or aborts the page request? At first I found this question in stackoverflow: continue processing php after sending http response I would take care of it if it was the other way around.
I need this PHP code to run only if the screen is not aborted or closed by the user.
<?php
ob_start() ;
echo str_pad('',4096);
function flush_buffers() {
ob_end_flush();
ob_flush();
flush();
ob_start();
}
echo "";
flush_buffers();
sleep(5);
//execute function
setCounterVisitor();
?>
Can anybody help me?