Re: Date/Time Logic
| From: | Philip Hallstrom | Date: | Wed, 19 Feb 2003 17:51:18 +0000 |
| Subject: | Re: Date/Time Logic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136223@lists.php.net to get a copy of this message | ||
Store the timestamp of their first login to a database. Also store the
number of days (3, 90, 365) that there account is valid. Setup a script
to nightly go through the database and for any records where:
first_login_timstamp + number_of_days < right_now
is true invalidate their login and send notifications.
Pretty easy to do with the date/time functions in any database. Of if you
can't use a database like that, store it all as numbers (timestamps -
number of seconds since 1970...) and just do the math with 86400 seconds
equalling one day.
good luck!
On Wed, 19 Feb 2003, Pushpinder Singh Garcha wrote:
> Hello Everyone,
>
> My php/mysql application needs to keep track of the first time that a
> User logs on to the site. Afterwards the User should be allowed either
> 3 days / 3 months/1 year of access to the site. Once the stipulated
> time period is over the system should invalidate the login of the user.
> The Admin/ User should get email notification about this. The
> notification part is easy the hard part to figure out is how to be able
> to keep and tab on the Time Period stipulated for a user.
>
> Thanks in advance
> Pushpinder Singh Garcha
> _________________________________
> Web Architect
>