Jump to content

cron help


steviez

Recommended Posts

Is there anything that php can do to simulate cron?

 

No. Remember that PHP is simply a preprocessor scripting language. It has nothing to do with execution or server activities. Your crontab is set up on apache (or scheduled tasks in Windows), and the server action executes the PHP script (or whatever language the script is written in).

Link to comment
Share on other sites

you could store a value in a file or database and check it every single time someone visits the site, to see if it's time to reset user accounts. problems: you probably won't get a visit at exactly 24 hours. if multiple visitors arrive simultaneously (or nearly so), you may have the accounts reset multiple times. why not use crontab?

 

Link to comment
Share on other sites

so there is no way to reset limits on a users account every 24hrs without cron?

 

Again, cron itself will not set the limits of an account, either. Cron simply executes a script in which you have the user's account limits reset. Now, if your site is fairly well trafficked, there may be a way to implicitly check for needed user updates from your visited pages, but your database load would go through the roof with the additional queries...

 

One other thought would be to have each user's information checked when they log in. Have a column in the DB that stores the last time their limits were reset. Then, when they log in, if it has been >= 24 hours, reset their limits and update the timestamp. This would be fairly easy to implement, and it would simulate the resetting you are after.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.