Jump to content

how to wait for only 6 hrs to reply for the challenge


TheFreak

Recommended Posts

Save the start time in the database, then check the submitted response time against the start time... if it is longer than six hours, give them the wha wha whaaaaaa(Prices Right sound effects) and deny them. If not, challenge complete :)

Link to comment
Share on other sites

Save the start time in the database, then check the submitted response time against the start time... if it is longer than six hours, give them the wha wha whaaaaaa(Prices Right sound effects) and deny them. If not, challenge complete :)

 

In addition, you can combine this with mikefrederick's suggestion and auto-fail them at 6 hours by running a cron job every minute (or five, or ten) that checks for expired challenges.

 

The nice thing is that it can all be done with one query:

SELECT * FROM challenges WHERE submission_time < CURTIME() - INTERVAL 6 HOUR;

 

That returns all expired (older than 6 hours) challenges. You could even have an expired column where you can update them all in one query, too:

UPDATE challenges SET expired = 1 WHERE submission_time < CURTIME() - INTERVAL 6 HOUR;

Link to comment
Share on other sites

use a cron job

 

i don't know about it.

 

Quote from: MatthewJ on Today at 12:13:29 PM

Save the start time in the database, then check the submitted response time against the start time... if it is longer than six hours, give them the wha wha whaaaaaa(Prices Right sound effects) and deny them. If not, challenge complete Smiley

 

In addition, you can combine this with mikefrederick's suggestion and auto-fail them at 6 hours by running a cron job every minute (or five, or ten) that checks for expired challenges.

 

I was more into showing the user how much time is left,don't want to use ajax but a simple php time clock types.

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.