Page 1 of 1

if - date help

Posted: Sat Nov 04, 2006 9:03 pm
by me!
First off Hi all!

I am trying to determine a date via a date from PayPal IPN.

I am updating a clubs site that shows a member list, in that member list each member will have a date that there membership expires. For simplicity reasons ALL members memberships expire 1/1/xx But... The year will depend on when they register, if they register in the first 2/3 of the year there membership will expire that year. But if they register in the last 1/3 of the year they will gut the rest of the year and all of next year.

For instance any membership received 1/106 through 9/30/06 will expire on 1/1/07
But any membership received 10/1/06 through 12/31/06 will expire on 1/1/08

My head is spinning on this one... 8O

Posted: Sat Nov 04, 2006 10:16 pm
by timvw

Code: Select all

if ($month > 0 && $month < 5) {
 // this covers part1
} else if ($month >= 5 && $month < 9) {
 // this covers part2
} else { // $month > 9 && $month < 13
 // this covers part3
}

Posted: Sun Nov 05, 2006 10:04 am
by me!
Thank you for the post! I had totaly forgot about < than and > than, du....

This is what I ended up with:

Code: Select all

<?PHP

// this is when we check to see when the membership is up
$today = date("F j, Y");    							// We need a date! format as, March 10, 2001
$month = date("n");										// this tells us what month it is
$end_thisYear = date('Y',strtotime('+1 year'));			// add one year to the date since technaly they expire on the first day of "next" year
$next_year = date('Y',strtotime('+2 year'));			// add two years to the date since technaly they expire on the first day of "next" year

if ($month < 10)										//if they join before October they get the rest of this year only
  $mem_expire = $end_thisYear; 
else 
  $mem_expire = $next_year;								//if they join on or after October they get the rest of this year and all of next
 
// start message to user
echo ("<p>Your payment, and your membership renewal is compleate.</p>");
echo ("<p>Todays Date: $today <br /></p>");
echo ("<p>Membership expires on <span class=\"style1\">January 1st $mem_expire</span></p>"); 
echo ("<p>&nbsp;</p>");
echo ("<h2>Thank You</h2>");
?>