Jump to content

Checking if a user refreshed a page


yoda69

Recommended Posts

Hey,

 

Is there a method to check if a user refreshed a page?

I'm designing an online psychological experiment and I want to see if the user refreshed a page (to see if he was trying to see an image that he was supposed to see only once).

 

Consider.

I am already using sessions to pass data between pages and this is the 4'th page already.

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/200037-checking-if-a-user-refreshed-a-page/
Share on other sites

Use a SESSION to determine if the user reloaded the page.

 

By default, have the SESSION variable be null. Then upon load, check if the variable is null. If it is, set it to a time. If not, then the user reloaded the page. Of course, make sure you change the variable back to null upon success.

have a counter in a session, that has the current page number. If the user is trying to access page 4 and the counter is already page 4 then the user has refreshed the page. You can similarly do this to check that they aren't going back in the process as well (you will need to disable the page caching as well)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.