Re: detect user click "stop" button in browser
| From: | weetat | Date: | Fri, 23 Jun 2006 02:48:11 +0000 |
| Subject: | Re: detect user click "stop" button in browser | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238539@lists.php.net to get a copy of this message | ||
Hi Andrei,
I have tried the connection_aborted() in my code , however it not working at all , below is my code:
If i close the browser window(IE) , the script still running and call the difference() function as shown below:
Any ideas what is happening ? Thanks
ignore_user_abort(true);
$options = array("complexType" => "object");
$xml_util = new XMLUtil($filepath, $options);
$xml_util->unserializer_XML(false);
$xml_error = $xml_util->getXMLError();
$_logger->logdebug("xml error listflag.php", $xml_error);
if (!$xml_error) {
$data = $xml_util->getUnserializedData();} else {
$errorMessage = 'XML file is not well-formed. Please amend XML file before upload.';
echo $errorMessage;
}
if (!connection_aborted()) {
$diffresult = difference($data); <----call function even close browser window
$_SESSION['diffresult'] = $diffresult;
header('Location: ../difference.php');
exit;
} else {
$_logger->logdebug("program aborted");
header('Location: ../difference.php');
exit;
}
Andrei wrote:
Check int connection_aborted ( ) in the PHP manual Andy weetat wrote:Hi all, Can we detected if user have clicked the "X" button in browser or close browser ? I have tested in my php program ,when i click "X" in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the "X" button or close browser ? Thanks - weetat