문제

I have a quiz application in which there is a countdown timer of 300 seconds to answer 10 questions and after that scores are sent to server and compared with answers and stored . My problem is when i make a countdown timer client side with javascript , anyone can easily mess up with it, whether i use cookies or use any code , it can be altered by the user . Is there any way to make a safe countdown timer using php so that it cannot be changed by user explicitly. I'm really stuck up in this issue.Thanks in advance !

도움이 되었습니까?

해결책

if user can re-participate Store end time in an session or cookie variable in beginning

if(!isset($_SESSION['endtime']))
$_SESSION['endtime']=strtotime("+300");
else
if($_SESSION['endtime']>strtotime("now")){
//Game over
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top