View Full Version : Using time code for server time
11-20-2007, 04:34 AM
I would like to make a part in my script for a function to only be available every 24 hours. Once they click it, they can't click it again for 24 hours (from the set server time). So if they click it at 3pm and the server reset time for it is midnight. It won't be available again until 12:00am.
11-20-2007, 04:23 PM
Use a database to store their last clicked time. When they come to the page again, look at the day+month of today versus the day+month of when they last clicked and if it is different, show it again.
11-23-2007, 12:19 AM
So I can put a timestamp on the database. I believe I use timeNOW() to record or check the current time?
11-23-2007, 09:10 AM
using the db seems a but resource heavy.
//if cookie exists skip code
setcookie($name, $cookievalue, time() + 43200);
// if cookie doesn't exist then create cookie and run code
11-23-2007, 09:28 AM
That makes no sense. They could clear their cookies and click it all over again without having to wait. Besides, from posts I get the impression that masterofollies is using a database already, if not a full login system.
11-23-2007, 09:33 AM
true I forgot you could delete cookies, yea a db is the best way to go then
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.