avillanu Posted August 24, 2007 Share Posted August 24, 2007 I'd like to have a "daily views" for my CMS. Of course, this number would reset every 24 hours. Would this be possible without a crontab? Quote Link to comment Share on other sites More sharing options...
tarun Posted August 24, 2007 Share Posted August 24, 2007 I Found This Code Which Simluates A Crontab Description: If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval): <?php ignore_user_abort(); // run script in background set_time_limit(0); // run script forever $interval=60*15; // do every 15 minutes... do{ // add the script that has to be ran every 15 minutes here // ... sleep($interval); // wait 15 minutes }while(true); ?> Quote Link to comment Share on other sites More sharing options...
micmania1 Posted August 24, 2007 Share Posted August 24, 2007 $date = date("d-m-Y").' 00:00:00; // show views from only today($date) onwards I don't know how your accessing this data (MySQL, arrays etc...) so I can't really assist you any more than I have. This will take place everytime the page loads but that's all you need. Hope it helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.