Page 1 of 1

Back & Refresh

Posted: Mon Nov 01, 2004 6:21 am
by Shendemiar
Is there any way to know it the page was accessed by back, forward or refresh button/action?

Any designing hints to a sql manager to prevent some updates happening if a page is accessed by mentioned methoitds?

Posted: Mon Nov 01, 2004 6:42 am
by kettle_drum
Not really as once a request to the server has finished then it doesnt remember it, and when you hit back/refresh its simply a new request for a page - nothing special is sent to say that its been called by pressing the back button.

At a stab i guess you could have a look at doing something like:

-Log what pages users view and when, and then check the http_referer to see what page they come from.
-Set a cookie/session to log page details and then check.

It would give you a little idea - but its easily fooled, and so seems rather pointless.

What are you trying to do/solve? Maybe we can think of another way around it.

Posted: Mon Nov 01, 2004 6:55 am
by Shendemiar
It's nothing serious, i can live w/o it, but if there would been an easy way i would implimented it..

I have a page where database data is edited by user. Every table uses same script for updates, and it's included on the mainpage. So clicking "submit quey" send you right back to the page you're in with the query parameters. If user edits same data twice, and then preses back twice, the database ends up with the first modification he made.

I can pass a counter that changes each time the page loads and check it by that. ;)

Posted: Mon Nov 01, 2004 7:40 am
by Shendemiar
When submitting the query, a ID is checked from the database, and that+1 is passed amongst other parameters, and the query.

Main page add allways +1 to the counter when loaded.

If current ID and the ID passed with the query matches, it's submitted, otherwise not. Very simple! Thank you/me!