yoda69 Posted April 28, 2010 Share Posted April 28, 2010 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 More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 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. Link to comment https://forums.phpfreaks.com/topic/200037-checking-if-a-user-refreshed-a-page/#findComment-1049913 Share on other sites More sharing options...
JAY6390 Posted April 28, 2010 Share Posted April 28, 2010 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) Link to comment https://forums.phpfreaks.com/topic/200037-checking-if-a-user-refreshed-a-page/#findComment-1049918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.