Page 1 of 1

Reposting Upon Page Refresh

Posted: Tue Sep 10, 2013 1:19 am
by Epiales
Here is my scenario:

I have a tabbed menu for my market so far. Image below:


Image

Now when I have an unsuccessful transaction as you see in the image, all I have to do is refresh the page and it redoes the transaction. Even if I tab over to the regular market, and someone refreshes, it will redo the transaction that was in the black market. How can I avoid this without redirecting the page after submit? Thanks!

Re: Reposting Upon Page Refresh

Posted: Tue Sep 10, 2013 6:00 am
by MikuzA
Hello,

I'm understanding that:

1. You have Regular Market which is more of an normal market, you trade items for gold.
2. You have a Black Market which is has cheaper items(?), you trade items for half of the gold compared to Regular but with a chance to loose your money.
3. You go into black market and take your chances, Amount : 100 -> Buy. $_POST is sent.
4. You were unlucky, transaction failed, you lost your 100.
5. Refresh the page, transaction successful, you gained the 100.
6. Refresh the page, transaction failed. you lost your 100.
7. Refresh the page, transaction failed. you lost another 100.

And to make a point, if you start by having '200'.
4. -> 100.
5. -> 200.
6. -> 100.
7. -> 0.

So, refresh is fine if the player want to 'redo' last action.

But if you want to block this, you need to add some kind of detection for this, like a control table and perhaps a transaction id, transaction id is generated to the form and if it already exists/been sent. It errors.

Hope this helps :)