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