Jump to content

reset after refresh


sai

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.