Page 1 of 1

php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 6:21 am
by jim_php
hello
i have one question
i want for example to run a php script without called from a user
like
delete a user after 30 days automaticaly from database
or send an mail automaticaly in users for birthday etc ....
any good idea ?

Re: php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 6:57 am
by Chris Corbyn
cron :)

Re: php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 10:21 am
by mVeliki
... or ...

if you sure that you will have atlast one visitor per day,
store somewhere last timestamp of this "maintance" task (in DB or file), and check from your index page is enough time is passed to call again this task or skip it if not.

Your visitor will wait a litle more before get your page, but other visitors will get it instantly.

But, if takes too much time (more then 5 seconds) visitor may cancel his reqest and leave your task unfinished, you MUST use cron in this case.

Re: php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 11:18 am
by jim_php
cron...
i dont know what is that :d
anyone to explain ? or help to create something example ?

Re: php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 11:23 am
by John Cartwright

Re: php working in background without accesing from a user?

Posted: Sat Mar 22, 2008 11:25 am
by jim_php
i check my cpanel and has one cpanel called cron jobs
from there i can set a comand like ?index.php?action=send_mail ?