You are here: Re: [PHP] Writing a PHP Web application « PHP « IT news, forums, messages
Re: [PHP] Writing a PHP Web application

Posted by Philip Hallstrom on 07/01/05 02:54

> What are the options to get code to run on the server (every XX
> minutes), without any user interaction, etc.

If you are running on a unix like system (linux, freebsd, solaris, etc.)
cron can do this for you. See this: http://en.wikipedia.org/wiki/Cron

If on windows there are probably scheduling applications, but I don't know
anything about them.

> Example 1: If I have a directory that contains files, can I write a
> script that will delete all files older that 5 days?

Yes. Write the script to do what you want it to do and then have cron
execute it on the time period you define.

> Example 2: If I write an email web application, and the user wants to
> send an email to 50 people, can I write a script that will send emails
> individually XX seconds apart from each other, but have the progress
> interfaced with the web page the user is on so they can see the
> percentage progress of sent emails.

Yes. This is a bit trickier as you would need to coordinate with a
backend process that looks for emails that are ready to send them, does
the sending and also writes out some status info (either to a temp file or
to a database, or to shared memory). Then your web page would need to
repeatedly check that status to update the user on the progress.

> Also, back to the email example, is it possible that once an email is
> composed and sent, that the web application can scan the email for
> viruses, then show a message to the user if a virus was found in their
> email, if no virus found, the email is then sent to the users as above.

Yes. You could install a virus scanner such as ClamAV
(http://www.clamav.net/) and have it scan the message prior to handing it
off to the backend process that does the sending.

> How would I scan an email for viruses (or spam?)?

Same idea, but use something like SpamAssassin
(http://spamassassin.apache.org/)

> And, scan it only once so that system resources are not used to scan
> unnecessarily for every recipient?

Sure. Just do it before handing it off to the script that actually does
the mailing...

-philip

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация