I have a set of scripts which work fine 99.5% of the time.
This is how they are supposed to work:
1. Customer completes order form and hits submit (once!)
2. Perl script contacts bank and waits for a reply
3. If the reply is negative, the script sends the error message to the customer's browser.
4. If the reply is positive, the script redirects the customer's browser to another script using Print location. This second script gives the customer access to whatever it is he has ordered.
The problems start if the customer hits the submit button twice. Then we have two instances of the same script running. This is what happens:
1. The first instance is waiting for a reply from the bank - sometimes this can take a while.
2. The second instance also contacts the bank, but because it has the same unique reference number, the bank immediately recognizes it as a duplicate and returns an error message, which goes to the customer's browser. So no double charge to credit card luckily.
3. In the meantime, the first instance has finally come back with a positive response, BUT it cannot get back to the customer's browser to give him access to his order. The Print location command fails and the script ends.
I would rather not rewrite the entire system for 0.5% of impatient customers, so I was wondering if there is way for the first successful instance of the script to tell if it has lost contact with the browser. Then it can maybe send an email with instructions how to access the order.
Would getting the script to detect the browser version be a possibility?
Any other suggestions?
Thanks.
In reply to Hitting submit twice by pcwsp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |