edawg Posted March 25, 2007 Share Posted March 25, 2007 What I want to do is have a chunk of my code for my website only be accessed once a week on a set day. its basically a poll, that I want to find the highest rating for, but not all the time, I want for it to be once a week..... Any ideas??. thanks Quote Link to comment Share on other sites More sharing options...
interpim Posted March 25, 2007 Share Posted March 25, 2007 cron job Quote Link to comment Share on other sites More sharing options...
Hypnos Posted March 25, 2007 Share Posted March 25, 2007 One way would be: if(date("l") == "Monday) { //do stuff } Quote Link to comment Share on other sites More sharing options...
marcus Posted March 25, 2007 Share Posted March 25, 2007 One way would be: if(date("l") == "Monday) { //do stuff } That's where you're wrong if(date("l") == "Monday"){ //do stuff } I just had to. Quote Link to comment Share on other sites More sharing options...
christo16 Posted March 25, 2007 Share Posted March 25, 2007 One way would be: if(date("l") == "Monday) { //do stuff } That's where you're wrong if(date("l") == "Monday"){ //do stuff } I just had to. The trouble with that is the page needs to be accessed, if you want it to be independent of that, use a cron job. You set a cronjob by using a broswer like "wget or lynx" to open your page "http:www.example.com". 30 * * * 0 * wget -q http://www.example.com/script.php this will run your script every sunday at 12:30am. Check out this site to learn more about cron http://www.unixgeeks.org/security/newbie/unix/cron-1.html. Quote Link to comment Share on other sites More sharing options...
edawg Posted March 26, 2007 Author Share Posted March 26, 2007 thanks for all your help, will work on it over the next few days!! Quote Link to comment Share on other sites More sharing options...
TEENFRONT Posted March 26, 2007 Share Posted March 26, 2007 If you have cpanel... its awesomely simple to run a cron job. 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.