Jump to content

[SOLVED] Help with paid membership time limit


j634

Recommended Posts

Hi everyone,

 

On my current script I have a paid membership which has no time limit. They pay once and are members for life. I want to set up a three level system:1 month, 3 months and 6 months. The payment processor will only use PayPal. I have the basics understood, but think I need a little guidance to get me started. Does anyone have a link to a nice tutorial to help me do this?

 

Thanks in advance for your help.

Add an extra column to your users table of type timestamp and upon registration:

INSERT INTO users SET registration_date = NOW(), expiration_date = DATE_ADD(NOW(), INTERVAL 1 MONTH), ..registration data

 

Then when a user logs in:

<?php
if (date('U', $row['expiration_date']) > time()) { // expired
    // expiration logic
}
?>

Well, if he use some cookie authentication, user may log in once a week, month, year.. so there will be better to check if subscription doesn't expired when user became active and then insert into users row timestamp when he was active..also check if activity is between some interval (for example check if he was active once a day, hour...)

Well, if he use some cookie authentication, user may log in once a week, month, year.. so there will be better to check if subscription doesn't expired when user became active and then insert into users row timestamp when he was active..also check if activity is between some interval (for example check if he was active once a day, hour...)

 

Not exactly. By default a session cookie expires once the user closes his browser (unless the TTL of the cookie was modified using session_set_cookie_params()).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.