Forum Moderators: coopster
What i have going on, is a client who needs sort of a payment area. Someone signs up, they pay, and after that they have acess to a certain page for 30 days. After the 30 days, they need to be prompted to pay another 30 days and restricted acess to this area. How would this be possible? The payment i have worked out, is done with paypal. But other than that the rest im confused about.
Someone told me once, that i could use a function in SQL that would count down each day, and just make some sort of comparison with the php. I feel like maybe im losing my self here heh. Anyone understand, and know what i could possibly do, or maybe even a premade script i could toy with? Thanks alot in advance as usual!
What you want to do is basically this
- when someone pays, record the timestamp in the mysql DB.
- when he logs in, find out the current time and compare it to the timestamp in the DB
- if the time difference is more than 30 days, send to a resubscribe page.
Better, though, would be to set the expiration date in the DB. Why?
- you only calculate the time difference when someone adds time which is a less common event than just logging in (tiny reduction in server load).
- more importantly, you can more easily handle situations where someone prepays and can more easily offer subscription options like 1 month, 3 month, 1 year.
From what you say about your ability, I'm not sure this will help, but start here:
php date and time functions [us2.php.net]
mysql date and time functions [dev.mysql.com]