RE: Quiz Timer 07-16-2014, 07:10 PM
#8
The issue with having a JS timer would have to be cheating. But the method WILL be storing a unix time stamp somewhere. You could go with storing it in a PHP session..
This allows you to use AJAX or just use PHP and when the page loads inject the $_SESSION['last_submit_time'] into the JS.
But if you were feeling a little dangerous you can do some HTML5 Web Storage which is a local database http://www.w3schools.com/html/html5_webstorage.asp
Issue with that is that it could be edited by the user.
I would suggest going the pure PHP route (No Ajax) because what if a user doesn't have Javascript. Or use Ajax and fall back onto to PHP (This is probably the best and most professional route if you plan on making this a reusable piece of software to sell)
Code:
$date = new DateTime();
$_SESSION['last_submit_time'] = $date->getTimestamp();But if you were feeling a little dangerous you can do some HTML5 Web Storage which is a local database http://www.w3schools.com/html/html5_webstorage.asp
Issue with that is that it could be edited by the user.
I would suggest going the pure PHP route (No Ajax) because what if a user doesn't have Javascript. Or use Ajax and fall back onto to PHP (This is probably the best and most professional route if you plan on making this a reusable piece of software to sell)
![[Image: iQ3pcQu.png]](http://i.imgur.com/iQ3pcQu.png)
BTC Address: 1DCKgDaWcmc9dxBkhe9qrTQtrQpoFUzXdn
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)