Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

[php] TImed challenges?


ghost's Avatar
0 0

I want to create new Timed CHallenge and maybe send it (i hear, that Users can send their own task to the service). But I've got a (big) problem. In all task I can see "you have x second…". How can I write script, with I can check time with it? For example, someone will run script at 17:50:25. He has only 2 sec. to type good answer in the form. If he send the solution at 17:50:28, script will "say": quick? Thanks for reply in advance ;)


ghost's Avatar
0 0

I would guess they just use microtime() right after the opening tag, then again once you submit, and if the difference between second-first is <= the time limit, you pass the mission. You may have to cast it to a float, some of the examples I see do.


ghost's Avatar
0 0

but how can i check time before add solution, and time after send right answer? use session?