 | |  | | | Classifieds Installation & Upgrades If you're having install or upgrade problems, post here. |
December 19th, 2009, 04:27 PM
|
#1 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
| Sendnotice.php emails 10 days before ads expire
Hi,
I have a problem with sendnotice.
It runs for ads expiring within 10 days, not 3 as written in code.
I tried to understand without success :
I printed out $today $expire enddate $mday ...
everything is ok but all ads that are expiring within 10 days are considered.
(not exclusively 10, but from 1 to 10)
Any idea ?
my sendnotice.php according to my Classifieds version : Code: Content visible to verified customers only.
|
| |
December 19th, 2009, 07:17 PM
|
#2 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
Well if you printed the variables what was the result for $expire?
The code itself is pretty explicit. $expire should be 3 days.
|
| |
December 19th, 2009, 07:44 PM
|
#3 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
Here are some informations (abstract) executing the script just now :
(print out)
--> datas
today= 1261273010 mday= 23 expire= 1262137010
translation :
today: Sunday, December 20th 2009, 01:36:50 (GMT)
expire: Wednesday, December 30th 2009, 01:36:50 (GMT)
Email to: xxx@hotmail.com [xxx] about ad 6564:
[xxx, your ad Canon ixus 800is on xx.com will expire in 6 days.
If you want to renew it 60 more days, click on the link below: http://...../renew.php?product=6564&unlock=1261753868]
(unlock : Friday, December 25th 2009, 15:11:08 (GMT) )
Email to: xxx@gmail.com [xx] about ad 6828:
[xxx, your ad EHS-ST9 on xx.com will expire in 10 days.
If you want to renew it 30 more days, click on the link below: http://...../renew.php?product=6828&unlock=1262099825]
(unlock : Tuesday, December 29th 2009, 15:17:05 (GMT) )
|
| |
December 19th, 2009, 08:18 PM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
dont know what to tell you unless some php bug on your server this is pretty explicit to me here Code: Content visible to verified customers only.
|
| |
December 19th, 2009, 11:51 PM
|
#5 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
I run PHP Version 4.4.9
I can also run PHP 5 for this script because I run both on my server.
Do you think I risk anything in running only this sendnotice in php5 ?
|
| |
December 20th, 2009, 05:13 AM
|
#6 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
No I am merely saying I dont know why yours would be 10 days. I mean look at the lines I posted
$mday is a day so we do that plus 3 to get the time 3 days from right now
|
| |
December 20th, 2009, 11:39 AM
|
#7 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
What I don't understand is that the values are correct, $mday + 3 is right, $today, $expire too.
Everything is good except the select collect ads expiring from 0 to 10 days (I never saw more).
Yesterday I checked quickly one of those products in the database and I cannot see what is the problem.
|
| |
December 20th, 2009, 05:09 PM
|
#8 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
$mday + 3 is right hense why I dont know why your server would be doing 10 days and not 3
|
| |
December 20th, 2009, 09:23 PM
|
#9 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
I try to see what is the problem without success.
So I ran the script and printed out every command at each step to see what PHP is doing :
running sendnotice.php
$today=1261365284
Query to close expired ads : UPDATE pa_products SET approved=2,status='1261365284' WHERE enddate < 1261365284 AND isauction=0
test : if ( $timediff > 86399 )
$timediff=1261365284
1261365284 >86399 so run the query : UPDATE pa_stats SET lastupdate='1261365284' WHERE id=1
Select ads that expire in 3 days: SELECT id,user,userid,title,enddate,duration FROM pa_products WHERE enddate < 1262229284 AND status=0 AND isauction=0
Then it deals with ads that expire within 0 to 10 days.
Do you see something wrong ?
regards
|
| |
December 21st, 2009, 05:35 AM
|
#10 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
How about maybe trying to make this line Code: Content visible to verified customers only.
Obviously that line simply means in php to give me the unix timestamp 3 days from right now lets use another way in php and see what you get Code: Content visible to verified customers only.
|
| |
December 21st, 2009, 09:38 PM
|
#11 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
I replaced as suggested the $expire calculation, and it's better.
It shows me only one expiring ad in 1 day.
If I run sendnotice with the previous method (mktime with day+3) I noticed ads expiring in 3 days, that don't show with time() + 86399;
It might be due to timezone between server and users ?
|
| |
December 22nd, 2009, 12:45 AM
|
#12 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
There has to be some kind of bug in your PHP version.
mktime with $mday + 3 and the other calculation I posted are the SAME THING. Just different ways of doing it.
The expire calculation is simply the time right now plus 3 days. 86399 seconds is 3 days.
I am just trying to figure out why your server is doing 10 days not 3 when the code math whatever you want to call it is all 3 days. |
| |
December 22nd, 2009, 02:33 AM
|
#13 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
... in few words... you're right and I d'ont know |
| |
December 22nd, 2009, 07:22 AM
|
#14 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
Try this one Code: Content visible to verified customers only.
|
| |
December 22nd, 2009, 11:54 AM
|
#15 (permalink)
| | Member Verified Customer
Join Date: Jul 2004
Posts: 49
|
First glance.... it seems to be ok 
I check next days and I tell you.
Thank you very much Chuck.
|
| |
December 22nd, 2009, 11:55 AM
|
#16 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,698
|
Not a problem glad to help.
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 12:58 AM. | |