sai Posted July 5, 2007 Share Posted July 5, 2007 Hi. I created a dice game in PHP, that randomly generates dice. My problem is that if the player does not like his/her dice, they can refresh or use the back buttons on the browser to generate new dice. What code can I put so that if the player clicks the refresh or back button, the browser would stop it, or redirect them to another page? Thanks Link to comment https://forums.phpfreaks.com/topic/58572-reset-after-refresh/ Share on other sites More sharing options...
akitchin Posted July 5, 2007 Share Posted July 5, 2007 you can set a SESSION variable when they get their dice, and check for that before you assign a set. if the SESSION var is there, don't show them dice (and consequently do what you want: redirect, give an error, etc.), otherwise assign a set. if you're tracking them via a database or some other means, then simply add a flag to their specific information set to say they've already been assigned their dice. Link to comment https://forums.phpfreaks.com/topic/58572-reset-after-refresh/#findComment-290539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.