Forum Moderators: coopster

Message Too Old, No Replies

refresh postdata. how to stop?

Stop postdata requestin more info..

         

ezyid

10:25 am on Jan 23, 2006 (gmt 0)

10+ Year Member



Hello there,
I’m having a very strange issue with my programme.
Its built in PHP and is working well. Until I start to use the refresh or back buttons.

Basically I have a system that has a users account and they can purchase items off me.
Now, the system does what its supposed to do, but when I click back or refresh, the browser resends the post data, thus creating another transaction.

My developer has tried to stop this from happening by putting timestamps on the transactions but the weird thing is when you click back or refresh the browser basically reloads the page with a fresh copy of data and resends to form.

I need to find a way to stop the back button and refresh buttons from re requesting the data. As im finding major database errors as this is purchasing some items with no values…..

Can someone please help,

Cheers.
Steve.

tomda

10:47 am on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are many ways I am sure, some more or less effective or secure.

I am not a professional but you could use session:
1/ Load the "Purchase Order Number" in a session after submission
2/ Check before submitting data if LPO No is found in the session.
3/ If yes, then it means that the LPO has already been sent (show message "Your order has already been sent blah"
4/ If not, process the order.

Note: You could do exactly the same way using databases. Add LPO No in user database when order is sent and check before processing data if LPO No is found in user database.

My 2cents!

jatar_k

5:22 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



your developer hasn't tried that hard, sorry don't mean to be offensive but it is pretty easy to fix usually.

It is usually a logic flaw, built right in.

yes browsers will all repost data, it shouldn't make the row in the db ghet rewritten.

1. this could be caused by forms posting to themselves.

processing scripts should have no output therefore you can never go back to them and have them repost.

2. multi stepped processes

If the user needs to go through multiple steps (forms), and dat needs to be carried through them, then the id/timestamp needs to be created before anything is posted at the very first step.

there are other possible issues as well but these are the most common.

tomda

5:47 am on Jan 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



your developer hasn't tried that hard, sorry don't mean to be offensive but it is pretty easy to fix usually.

:) No offence, but the word "developer" made me laugh!

there are other possible issues as well but these are the most common.

I thought session was the most common!

ezyid

5:06 am on Jan 25, 2006 (gmt 0)

10+ Year Member



Thankyou,
We have tried a few other methods including header redirect.. but its still not working..
any more ideas?

Thankyou again for your help!