Need a way to prevent user refreshing page
Hi everyone, I have a problem with a piece of code I have just written for my website and am hoping some genius here can help me out!
Basically I have a php script that when executed, will increase a database value by x. The value is received from a hook in the order system after an invoice has been paid.
Unfortunately, when refreshing the page the script repeats itself, and due to the way its written it increases the database value depending on what it is at the time its executed. For example:
Script executes -
Database value is Y -
Script adds X to Y -
Script calculates the new Y value and updates database -
Script ends -
If the user refreshes the script, they will be able to continuously repeat the database update adding X each time they refresh the page. I am only a beginner developer and have no idea how to stop this!
If anyone could suggest any methods of preventing this I would be very grateful!
Thanks
|