How to restore a value after a certain amount of time?

Hello everyone,

I’m new here so I’m very sorry if I’ve posted this in the wrong section.

Okay, first things first. I am currently working on our new game launcher.
Let me quickly explain how it works; To prevent any cheating clients to connect to our gameserver, we have come up with an idea to set a bool to true whenever the player hits play on the launcher. Sadly we cannot directly access our database from the launcher so we make it run a php file. In this case: init_launcher.php?user=username
This will then run the game, and check if this is bool is true. If this bool is false, it means that the player has not connected using our client.

Now I have come up with this simple code:

$username = "NONE";

if(isset($_GET[‘user’])) {
$username = $_GET[‘user’];
$username = $db->escapeString($username);

$sql = "UPDATE USERS SET LAUNCHER = 'true' WHERE USERNAME = '".$username."'"; 
$stmt = $db->query($sql);                       

}

However, the issue i’m facing is that I need a way to restore the bool to false after a certain amount of time. I wonder how I could realise this.

Any help would be appreciated.
Thanks in advance!

Kind regards, Jasper from UWRP.

You could just store a timestamp and check if launcher is newer than X time ago

What stops me from sending that request to init_launcher.php?user=username manually though?

Sponsor our Newsletter | Privacy Policy | Terms of Service