mlse
04-10-2005, 10:54 AM
Hi.
I'm not sure whether or not this is a PHP issue or server issue, or both! Probably both. What I want to do is to prevent the server from processing repeated requests more than once.
For example:
page_X.php (or page_X.html, or whatever) submits form data to page_Y.php at the server.
page_Y.php does it's funky thing (e.g. inserting data into a MySQL database, etc) and returns its output to the client.
Yep, nothing amazing going on there ... but what if the client repeated hammers the brower refresh button like a chimpanzee and the server receives 50 million identical requests? In the above example, page_Y.php will do 50 million identical database insertions! :eek: (depending on how I've coded it)
I have written some code in page_Y.php which checks to see whether the current IP address of the client and the contents of $_REQUEST were identical to the last time a request was received, but this has meant that I have an extra bit in the database to store this information for each and every user that logs on (because it is all sessioned and the requests need to be compared independently for each user). This is all a bit over-complicated and I wonder if there is a neat, easy, simple (i.e. built-in) way of doing this! I figure I need to know about something in the browser standard that enables the browser to know when it is submitting the same request twice - and handle it appropriately.
TIA, Mike.
I'm not sure whether or not this is a PHP issue or server issue, or both! Probably both. What I want to do is to prevent the server from processing repeated requests more than once.
For example:
page_X.php (or page_X.html, or whatever) submits form data to page_Y.php at the server.
page_Y.php does it's funky thing (e.g. inserting data into a MySQL database, etc) and returns its output to the client.
Yep, nothing amazing going on there ... but what if the client repeated hammers the brower refresh button like a chimpanzee and the server receives 50 million identical requests? In the above example, page_Y.php will do 50 million identical database insertions! :eek: (depending on how I've coded it)
I have written some code in page_Y.php which checks to see whether the current IP address of the client and the contents of $_REQUEST were identical to the last time a request was received, but this has meant that I have an extra bit in the database to store this information for each and every user that logs on (because it is all sessioned and the requests need to be compared independently for each user). This is all a bit over-complicated and I wonder if there is a neat, easy, simple (i.e. built-in) way of doing this! I figure I need to know about something in the browser standard that enables the browser to know when it is submitting the same request twice - and handle it appropriately.
TIA, Mike.