raimis100 Posted August 24, 2008 Share Posted August 24, 2008 Hi! I can't use cronjobs on my server so I decided that my update script could be run by my sites visitors. Now I am trying to figure out how. Idea was to get system time every time the visitor opens the page and If more than 24 hours are passed then run script. The update script would save time when it has run on text file. I am php newbie so I need some help here. I am also looking at the php time functions now to figure out how to do it. Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/ Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 The problem with that is that you will be relying on people coming on your site frequently. Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624294 Share on other sites More sharing options...
raimis100 Posted August 24, 2008 Author Share Posted August 24, 2008 Yea , but I have no other ideas :/ Actually I have regular visitors so that's ok Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624298 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 do you want to run it the same time , every day? Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624299 Share on other sites More sharing options...
raimis100 Posted August 24, 2008 Author Share Posted August 24, 2008 Does not matter If it has run on 8am or 8pm. Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624301 Share on other sites More sharing options...
raimis100 Posted August 24, 2008 Author Share Posted August 24, 2008 I took a look at php tuts Here is what I can think of : If (date("z") > file_get_contents ('updatetime.txt')) { Update; $fp = fopen('updatetime.txt', 'w'); fwrite($fp, date("z")); fclose($fp); } Do you have a better idea ? Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624303 Share on other sites More sharing options...
redarrow Posted August 24, 2008 Share Posted August 24, 2008 it a wast off time you got to run a cron job............... relying on user being on the web site to update a database or flat file is stupid and not the correct way to do computer programming................................. Quote Link to comment https://forums.phpfreaks.com/topic/121098-run-update-script-every-24-hours/#findComment-624472 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.