943,949 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1544
  • PHP RSS
Sep 15th, 2009
0

Problems with cron file

Expand Post »
Hi,
I have a corn.php file that runs automatically every day and one of the functions is to send an e-mail to certain users.
The problem is that the e-mails are being sent twice. I can't find anything wrong with the cron file, but checking the access_log.processed file of the server I found two entries with the cron file runnig at practically the same time:
1)..."HEAD /x/cron.php..."
2)..."GET /x/cron.php..."

I don't know much about apache but I think the problem might be that the HEAD method is also sending e-mails when it runs the file, so my questin is: ¿Can the HEAD method run the php file to send emails?

Thank you
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
julio gomez is offline Offline
13 posts
since Jun 2009
Sep 15th, 2009
0

Re: Problems with cron file

Where do you get the e-mails from? Mysql?

If yes, then i would suggest:
add a "lastsent" field, and each time you send a e-mail, update that field with a time().

So before you sent emails build a if($lastsent > something) {
do_send();
} else {
walk_away();
}

I don't know if I got you right, but i hope you got me!
Reputation Points: 7
Solved Threads: 14
Junior Poster
smartness is offline Offline
103 posts
since Aug 2007
Sep 15th, 2009
0

Re: Problems with cron file

Thanks for the suggestion, it looks like the problem is solved.
But instead of using if() to select the ones I wanted to send, I used WHERE TIME() > X in the query.

I was trying to understand if the HEAD method was sending the emails and didn't tried to solved it in the cron.php file.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
julio gomez is offline Offline
13 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: I need a little tweek to a page nav code
Next Thread in PHP Forum Timeline: i want the best php class to work with mysql





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC