...

View Full Version : Using time code for server time



masterofollies
11-20-2007, 03: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.

aedrin
11-20-2007, 03: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.

masterofollies
11-22-2007, 11:19 PM
So I can put a timestamp on the database. I believe I use timeNOW() to record or check the current time?

psykx
11-23-2007, 08:10 AM
using the db seems a but resource heavy.



if(isset($_GET["click"]) ){
if(isset($_COOKIE['foo']))
{
//if cookie exists skip code
}else{
setcookie($name, $cookievalue, time() + 43200);
// if cookie doesn't exist then create cookie and run code
code();
}
}

Inigoesdr
11-23-2007, 08: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.

psykx
11-23-2007, 08:33 AM
true I forgot you could delete cookies, yea a db is the best way to go then



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum