scenario:
there are 4 items:
30day pass
60day pass
180day pass
365day pass
there is a monthly (30 day) credit cap. so if you use the credit up before the end of the month you need to purchase another 30day pass, or wait till the next renewal period.
A person purchases a 30day pass today, purchase date is recorded to DB. Expiry date is also recorded.
if ($todaysdate >= $expirydate) //DONE.
but whAt about for 60day and 180day passes ?
we have purchasedate & expiry date. every 30days, the credit needs to be reset for the next month.
I am really lost how to best approach this problem.
You could run a task (or cron job) daily to check and see if the current date is later than the recorded expiration date, and if it is reset the users credit to 0, and send them an email letting them know their credit has expired.
As the users buys credit, you merely add 30, 60 or 90 days to their expiration date.
For more information, see php + cronjob tags.