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.

Link to comment
Share on other sites

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
}
?>

Link to comment
Share on other sites

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...)

Link to comment
Share on other sites

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()).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.