-2

I am wondering if the following can be accomplished with PHP. Lets say that you have simple scripts which only insert some records into database (lets say some reporting) e.g. money incomes/withdraws.

And every 13th day in a month, you have some regular payment for electricity, mortgage etc. Is it possible, that PHP on 13th day every month at 00:00:01 AM perform some insert action.

In addition, is it possible that this is performed without even logging/using the application (without user interaction)? Is there a way how ensure that such action will be definately performed only once a month?

Thank you

Strimer_SK
  • 25
  • 1
  • 1
  • 4

2 Answers2

2

What you're looking for is a cron job. They are independent of any programming language.

Steven Mercatante
  • 24,757
  • 9
  • 65
  • 109
0

This can be accomplished using a cronjob. You can find more information about that here.

Community
  • 1
  • 1
tdlive aw'sum
  • 400
  • 1
  • 7
  • OK, but what i found on my hosting provider is to set some http://www.domain.eu/script.php url to be triggered at specific time. But what in case that somebody finds out this url and than corrupt my register by repeatedly executing it. Is there a way how to block such URL and allows only the cron to triggered it? In addition, is there a way how such CRON expression incoporate to the PHP script to be independent form hosting provider? – Strimer_SK Aug 05 '13 at 20:13
  • You could set a GET variable that contains a secret password that only you know about and is hard to guess, or restrict access by a certain IP. But these are just minor roadblocks as both of these could be spoofed/guessed. There isn't really a way to protect these pages. Additionally, cron expressions are standard and should work everywhere. – tdlive aw'sum Aug 05 '13 at 20:22
  • script outside the root, problem solved –  Aug 05 '13 at 20:27
  • Could you please more specify it? Like using some middle folder in the structure will make the URL unable to be guess? – Strimer_SK Aug 05 '13 at 20:33