Jump to content

Possible to detect refresh?


ryeman98

Recommended Posts

The game is rock, paper, scissors.

 

I use sessions for the guesses. The computer's guess is random and is a session instead of a hidden input (because if you view the source code, you can see the computer's choice) It starts out at rps.php?action=play and then after the guess, it goes to rps.php?action=round which is where if the user presses refresh, the computers choice will change, causing the user to cheat...

Ok, makes sense.  Does it really matter if the user refreshes, since the user never knows what the computer has guessed?  If you don't want the guess to change, you could do something like this:

 

if (user made a guess) {

  Check guess

  Update score

  Generate new guess

} else {

  Do nothing.  Keep the old guess.

}

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.