Jump to content

How can I control how many days a user uses my site?


mysty

Recommended Posts

I have a site that has a database for user’s information.  I would like to control how many days each user has access to the site.  That is, when a user registers, he has access to the site for 10 days.  Can I control that using MySQL or would I use PHP code or ??

Link to comment
Share on other sites

So, are you saying I should make 2 new columns - a TimeStamp to put the registration date into the database and one for Datetime as the expiry field?  I would like to have the user register and fill in a field in the registration form that tells how many days he has on the site.  How would I then check the 2 new columns?

Link to comment
Share on other sites

You don't NEED two columns. But using the two column approach allows you to extend a person's 10 day period easier. Say if you wanted to make an exception because a users' brother died 2 days after she registered.

 

But to do it with the one column approach, you would add something like this to the where clause:

AND NOW() BETWEEN registeredOn AND DATE_ADD(registeredOn, INTERVAL 10 DAY)

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.