corillo181 Posted June 22, 2007 Share Posted June 22, 2007 is there a way to make a function that would do sometime in a given period of time without anyone having to activated? Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/ Share on other sites More sharing options...
trq Posted June 22, 2007 Share Posted June 22, 2007 Not in php. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279762 Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 not technically don't shot em down before we understand the case. PHP has some time functions, first you can set a wait peroid for scripts to stall. Secondly on a unix based system your server can execute cron jobs of php scripts at a given time, day, month,year,etc etc Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279792 Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 however odds are you are looking for a post page load execution at a given time, which is out of the realm of php because it loses control once load is complete, unless you use ajax, but for timmer functions javascript or a flash applet is probably best. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279796 Share on other sites More sharing options...
corillo181 Posted June 22, 2007 Author Share Posted June 22, 2007 cuz i had in mind is one of those script that chicks to see how long some one haven't logged in, or if they ever activated the account. but i didn't want to have to go and refresh the code every other month or so. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279797 Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 you talking about DB maintenance like clearing out old users and saying if people haven't activated accounts? give me more details cause your idea will work, your logic is flawed. Instead of setting it to run at time X you run the code at intervals Y (Y can be daily hourly, weekly) and search for results in the criteria Z. UNIX servers can do this with cron jobs, most good UNIX hosting companies allow you to run cron jobs of php docs. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279799 Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 use a mysql query like select * from $table WHERE lastlogin > $lastmonth and set $lastmonth= mktime(0,0,0,date("m")-1,date("d"),date("Y")); then from the matching criteria do what you want like send a warning email or deactivate accounts Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279801 Share on other sites More sharing options...
corillo181 Posted June 22, 2007 Author Share Posted June 22, 2007 cooldude i can do that. but i'm not a advance coder, so i was just curious to know if it would be possible to set a code that would work on it's on, with out loading the page... like making a folder with files that you will never check, but the functions inside of them run at given periods of time. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279810 Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 if you are using a hosting company I'd check with them on how to run cron jobs and make a php doc that executes what you want in it. If you ever do any ecommerce paypal uses a similar idea with their IPN where they ping your server's payment processor page when payment is cleared and then you can run your scripts once paypal notifies you of it. Its simple to do and your hosting company can explain the set up through their web GUI system. But don't worry about making your php doc different just make a normal doc as if you where going to refresh this page at the given time interval. You might want to add a logging feature to the doc that sends you an email, or logs in a sql table what it does on each execution and when it executes Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279815 Share on other sites More sharing options...
corillo181 Posted June 22, 2007 Author Share Posted June 22, 2007 alright thanx. Quote Link to comment https://forums.phpfreaks.com/topic/56650-solved-timer-setup/#findComment-279820 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.