I have a pay_form script where people fill in their credit card information and hit BUY. The BUY script processes the card and send the customer to a Thank You page. If they hit the Back button there they go back to the top of the BUY script and their credit card gets hit again. I'd like to put some kind of a PHP test at the top of the BUY script that senses whether the page is being called from the pay_form - the normal case - or is a return from the Thank You page - where it will cause a double charge.
I tried looking at $_SERVER['HTTP_REFERER'] but this shows the pay_form for both cases.