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 Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/ Share on other sites More sharing options...
interpim Posted March 25, 2007 Share Posted March 25, 2007 cron job Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-214999 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 } Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-215029 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. Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-215045 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. Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-215049 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!! Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-215078 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. Link to comment https://forums.phpfreaks.com/topic/44262-scheduled-chunks-of-code/#findComment-215105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.