views:

40

answers:

2

I'm creating an auction site where users can bid on items. I want to create a script that sends an email to the winner of an auction item once the datetime in the end_auction column has been reached.

I'm not sure how to go about doing this, since PHP only runs when the page is loaded and then stops. Also, I want it to send an email to the winner once the auction is over even when nobody is looking at any page.

So i guess I need some sort of functionality that will constantly check my server to see if the end_auction DateTime of an event has been met and then send them an email using the Mail function if it has.

What programming languages would I need? What approach could I use to make this happen?

+3  A: 

A dedicated program or script could handle this. It need not have a GUI, since its operations are:

list all users with closed auctions who have not been notified
for each user in the list
    email notification
    if no error, mark user notified

Choose your poison. PHP can do this outside a webserver, as can Perl, Python, Java, etc., etc.

wallyk
it would add this script under the crontab (linux), or a as scheduled task/service (windows).
Am
+2  A: 

You could write your logic in php and schedule your php script to run using cron.

Asaph
This worked Great! I found a great tutorial that explains how to set up a cron job here: http://www.upstartblogger.com/how-to-create-a-cron-job-in-cpanel and http://www.2serveu.net/cpanel-tutorials/standardcron.html
zeckdude