Back & Refresh

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Back & Refresh

Post 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?
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post 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. ;)
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post 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!
Post Reply