Re: Credit card debiting and preventing the user from aborting
| From: | Juan Luis Baptiste M. | Date: | Wed, 23 Aug 2000 14:56:05 +0000 |
| Subject: | Re: Credit card debiting and preventing the user from aborting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13161@lists.php.net to get a copy of this message | ||
I have never used it, but I found this in the manual, hope it helps :-)
"If you do not tell PHP to ignore a user abort and the user
aborts, your script will terminate. The one exception is if you have registered
a shutdown function using register_shutdown_function(). With a
shutdown function, when the remote user hits his STOP button, the next time
your script tries to output something PHP will detect that the
connection has been aborted and the shutdown function is called. This shutdown
function will also get called at the end of your script terminating
normally, so to do something different in case of a client diconnect you can
use the connection_aborted() function. This function will return true if
the connection was aborted".
You could register a shutdown function to detect if the user hit the stop
button, and if he did it, you could make that function show a message saying
that the last transaction was already sent or something like that.
The url is:
http://www.php.net/manual/features.connection-handling.php
Juan Luis Baptiste M.
Stefen Lars wrote:
> I think a combination of what Bruin suggested and what you are suggesting
> (should it work :-)) ) is a very good idea.
>
> I shall get to work.
>
> S.
>
> >From: "James Moore" <James@phpuk.org>
> >To: "Stefen Lars" <stefenlars@hotmail.com>
> >CC: <php-general@lists.php.net>
> >Subject: RE: [PHP] Credit card debiting and preventing the user from
> >aborting
> >Date: Wed, 23 Aug 2000 10:41:42 +0100
> >
> >
> > > I were to register ignore_user_abort and the user were to abort,
> > > would does
> > > this mean that nothing would be displayed in the browser when the
> > > script has
> > > come to its' logical end?
> >This is indeed the case
> >
> >
> > > I still have the problem that money has been debited from the customer's
> > > card, but he/she does not know about it, as nothing has been displayed
> >in
> > > this/her browser. Hence, he/she could (maybe) try again and debit
> >his/her
> > > card again.
> > >
> > > Am I missing something here?
> >
> >As far as I know when a browser stops a connection it will not accept any
> >further input, one option would be to use javascript. In the body tag do
> >somthing along the lines of
> >*Persudo Javascript*
> >onUnload="mymsgbox() onLoad="setflag()"
> >
> >Then just before the body you set up the following:
> ><script lang=javascript>
> >int flag = 0;
> >
> >function mymsgbox() {
> > if(flag == 0) {
> > ALERT("ARGGGHH YOU SILLY FOOL DONT PRESS STOP....");
> > }
> >}
> >
> >function onLoad() {
> > flag = 1;
> >}
> ></script>
> >
> >Not promising it will work but it might.
> >
> >Another option (That I have never tried and have no idea if it would work)
> >would be to register ignore_user_abort() and then send them off to a quick
> >loading page with header() this has lots of dis advantages though as errors
> >will not be shown.. Perhaps you should look at implementing a status bar if
> >it takes so long.... Or just make it very clear to the user the they cannot
> >cancel the transaction..
> >
> >
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net