php - comparing random number? -


How do I compare a random number or is it possible?

In the scenario I have a function using the $ _GET method and it is visible at the URL so any user can store this link to use it later. This is a PHP game so that anyone can easily cheat on the game. So what would be the best job to stop one? I was thinking of a random number that every time the user calls the link and compares it, the user can not use the same link later to access the game.

Text "itemprop =" text ">

Do you have access to a database for the site? If so, you can log the user's IP address and random number and every time The page can be accessed.

If not, you can cache the numbers in the $ _SESSION variable and check whether it was already used:

 $ String {'code'] = array (if;! ($ _ Session ['code'])); if (in_array ($ _GET ['code'], $ _SESSION [' Code ']) {// code to To display if this code was previously used by the user} and {$ _SESSION ['code'] [] = $ _GET ['code'];}    < / Html>

Comments