Re: detect user click "stop" button in browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux