Reposting Upon Page Refresh

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Reposting Upon Page Refresh

Post 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!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
MikuzA
Posts: 394
Joined: Thu Aug 08, 2013 8:57 am

Re: Reposting Upon Page Refresh

Post 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 :)
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Post Reply

Return to “Beginner Help and Support”