"Philip Hallstrom" <php@xxxxxxxxxxxxxxx> wrote in message news:20050630165026.C84522@xxxxxxxxxxxxxxxx > > 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. Start-->Settings-->Control Panel-->Scheduled Tasks You can use this to run scripts written in whatever language you like to perform the sort of tasks you want to. > > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php