This is due to preventing the re- submission of web forms , but this time the context is a web RPG. After the player defeats the monster, he will lose the item. Therefore, I would like for the user not to click the back button or to update to “fool” the drop element.
How often an element falls, using DB to store a unique "drop-transaction-id" seems impossible to me. I am entertaining the idea below:
For each battle, create a unique value based on the current date-time, user ID and save it in the database and session. It is possible that given a user id you can return a value
If the value from the session exists in the database, then the "battle" is valid and allows the user to access all pages related to the battle. If it does not exist in the database, a new battle state is launched.
When the cue ball is over, a unique value is cleared from the database.
Values of 30 minutes in the database are cleared.
Any opinions, improvements or pitfalls to this method are welcome.
source
share