Jump to content

PHP Timer/Stopwatch


ueharataichou

Recommended Posts

Greetings,

 

I'm experiencing difficulties on coding a stopwatch for the memory game I'm coding. First I used for the time but later I found out that it's easy to hack the time by using Inspect Element so I'm opting to use a client-side script, php.

 

The question is...how? I'm just a beginner in PHP so I don't know how to create one. It goes like this, the player clicks the Start button then timer starts, when the player finishes playing the game the timer stops and is saved in a variable and passed to MySql. Please help me.  :'(

Link to comment
https://forums.phpfreaks.com/topic/189696-php-timerstopwatch/
Share on other sites

Greetings,

 

I'm experiencing difficulties on coding a stopwatch for the memory game I'm coding. First I used for the time but later I found out that it's easy to hack the time by using Inspect Element so I'm opting to use a client-side script, php.

 

The question is...how? I'm just a beginner in PHP so I don't know how to create one. It goes like this, the player clicks the Start button then timer starts, when the player finishes playing the game the timer stops and is saved in a variable and passed to MySql. Please help me.  :'(

 

Remember PHP is purely a server side language, You would require

  -  A) To store start time in a unix timestamp, in a table

  -  B) Get the difference and react as accordingly.

 

If you require help on creating a database, Look on google. It's pointless to explain it all here when it could be bias information. You can use AJAX (which can be authenticated, but is a fairly secure) client side method of communicating with PHP when it is required to update the page without refreshing, such as your stopwatch checking.

Link to comment
https://forums.phpfreaks.com/topic/189696-php-timerstopwatch/#findComment-1001131
Share on other sites

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.