Re: question on time-based function

From: Date: Fri, 19 Jan 2001 08:56:26 +0000
Subject: Re: question on time-based function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35599@lists.php.net to get a copy of this message
Hello Rudy, (RM == "Rudy McDaniel") rudy@pegasus.cc.ucf.edu writes: RM> Anyone have any ideas on how to make a function reset every RM> 24-hours? For example, I have a function that grabs a random quote RM> from a file and selects a new one every time the page is reloaded. RM> What I want, however, is for the quote to remain the same for a RM> day and then reset at some specified time (say midnight) and grab RM> a new random quote for the next day. It seems like their should be RM> any easy way to do this using mktime( ) or a similar function but RM> I'm not fully grasping it. Any ideas on how to do this would be RM> much appreciated. Why not just make cron (once a day) read the quotes file, pick a random line, write the quote to a file called quoteoftheday.php, then just include() that file into your page? Unless you're running this one a windows machine.. in that case you might be able to do the same thing with some scheduler instead of cron, I'm not sure. -Brian -- Opportunity makes a thief. -Francis Bacon, 1598

« previous php.general (#35599) next »