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

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?

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)

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.