Automating a process on a server, PHP, etc.

Hi,

Don't know if anyone will know the answer to this, but thought I would try.
Take for example Trademe, how the server automatically sends a user an email at the end of the auction.

Obviously it isn't a process that occurs in the page that the user is on, but it runs on the server, in the background...

How would we implement that?
Anyknow know?

geek_pirateboy91, Oct 7, 8:21 pm

Well for an Auction site program, thats Built into it (well it is on my Auction site).Most WeBid sites do anyway.

geek_swivel, Oct 7, 8:24 pm

Usually is DOES occur 'on the page' .. the same script that generates the page sent to the viewer also generates a corresponding email and drops it into the local mail spool to be sent.

geek_little_egypt, Oct 7, 8:26 pm

geek_ferita, Oct 7, 8:27 pm


that would mean the user has to be present when the auction finishes, which they don't.

geek_pirateboy91, Oct 7, 8:30 pm


thanks. I'm talking about how to do this oneself, not relying on any other program.

geek_pirateboy91, Oct 7, 8:30 pm

You can have a cron job run a php script assuming your host permits such things.

geek_d.laidlaw, Oct 7, 8:31 pm


That's sort of along the lines of what I was asking... Thanks very much.
Will look into that.

geek_pirateboy91, Oct 7, 8:36 pm

there are multiple ways to go about this. it all depends on wat you are trying to achieve and your skill set.

for example trademe could generate an email on creation of an auction and have it scheduled to be sent by the email server at the time the auction ends.

or a cron script could be setup to monitor for expiring listings then send an email.

geek_segadc, Oct 7, 8:37 pm

I have used PHP and MySQL to create a system which allows a user to register, login, create new auctions, etc
but I'm at a point now where I need the system to recognisewhen an auction has expired and take appropro action
(which would include 1 - sending an email to the winner of the auction, etc or 2 - sending an email to the lister to notify it had not sold)

the easiest way would be to put it in a page and process it that way, but that means the SYSTEM itself is not processing it

geek_pirateboy91, Oct 7, 8:42 pm

both those methods I mentioned will work for what you want, depending on how popular your auction site is constantly monitoring you msql database could end up being very resource intensive. there are probably other methods too. but I use both of the above for some of my projects.

geek_segadc, Oct 7, 8:49 pm

Script automation on the server is done by the use of Cron Jobs.. (on a linux server).

Create a script that will go through all auctions that are flagged Not Expired. For each, if the expiration date/time is less than NOW - set flag to Expired.

Then - as you loop - set up your mail process.

Hope that helps.

geek_lifesteala, Oct 7, 10:54 pm

Why don't you set it to send the email when the auction closes (ie when time left = 0 then display auction closed & send email to $seller & $buyer)...

How are you ending your auctions at the mo?

geek_jayc2007, Oct 8, 12:15 am

It might be easier to just build on something that already exists;

http://sourceforge.net/search/?type_of_search=soft&words=auctions&search=Search

geek_little_egypt, Oct 8, 8:10 am

At the moment it's basically
when closedate < now()

I've managed to get cron jobs triggering a php script which
checks auctions that were not bid on as well as auctions that closed with bids; which either notifies the lister of the auction or notifies both parties.

geek_pirateboy91, Oct 11, 3:09 pm

defeats the purpose of learning how to do something yourself, tho.

geek_pirateboy91, Oct 11, 3:11 pm