LOUDMOUTH Posted August 22, 2009 Share Posted August 22, 2009 I have a site that has some links on it to do an action. These actions give the players money and exp. After you click the link to do one of these actions, you can simply just press F5 to repeat the same action over and over. I would like to make it so when players press F5 or Click on Reload they will get a message that says "Refreshing not allowed." Like this. Can anyone help me out. My site is PHP but I have heard this is not possible unless I use Java. Looking for some help! Thanks in advance! -LM Quote Link to comment https://forums.phpfreaks.com/topic/171431-preventing-page-refreshing/ Share on other sites More sharing options...
x1nick Posted August 22, 2009 Share Posted August 22, 2009 Hi From what im aware this is not possible. Best bet is to include some php code which checks to see if the user has already performed the action. Could use session ids possibly? Quote Link to comment https://forums.phpfreaks.com/topic/171431-preventing-page-refreshing/#findComment-904079 Share on other sites More sharing options...
Daniel0 Posted August 22, 2009 Share Posted August 22, 2009 I suppose you on every page could do this: $_SESSION['last_request'] = $_SERVER['REQUEST_URI']; And then on the page you don't want refreshes on: if ($_SESSION['last_request'] == $_SERVER['REQUEST_URI']) { echo 'Refreshing is not allowed.'; } You'll want to update the last_request at the end of script execution though. Quote Link to comment https://forums.phpfreaks.com/topic/171431-preventing-page-refreshing/#findComment-904080 Share on other sites More sharing options...
LOUDMOUTH Posted August 22, 2009 Author Share Posted August 22, 2009 How would I go about updating the last part of the script with the last_update part? Quote Link to comment https://forums.phpfreaks.com/topic/171431-preventing-page-refreshing/#findComment-904138 Share on other sites More sharing options...
Daniel0 Posted August 23, 2009 Share Posted August 23, 2009 Uh... just place that line somewhere along the end. Quote Link to comment https://forums.phpfreaks.com/topic/171431-preventing-page-refreshing/#findComment-904305 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.