Hi i am just wandering if anyone knows how to put a trail login to a php mysql driven website.

for example when you find a website usually providing a service, it requires payment to sign up to use. How would you allow users to sign up for say 30days. i am unsure how this would be done and then after 30 days later access is automaticaly decliened.

thanks

Member Avatar
diafol

Your mysql users table could have a membertype field (values = 0, 1 - which refer to trial, member) and a join_date field.

If the join_date is over 30 days ago and the membertype is 0, decline entry on login. If the member pays membership, change the membertype value to 1.

Presuming that you have already sorted out the login system itself, then it should be simple to add a check for the trial period. Each user record could have a trial period flag with a second field for the date that the trial period ends. You could go with just the date if you interpret no end date as being registered. On every login, this field is checked and if it is a past date, then the login fails.

Member Avatar
diafol

Presuming that you have already sorted out the login system itself, then it should be simple to add a check for the trial period. Each user record could have a trial period flag with a second field for the date that the trial period ends. You could go with just the date if you interpret no end date as being registered. On every login, this field is checked and if it is a past date, then the login fails.

That's a really succinct solution - like an expiry_date field. Nice one. :icon_biggrin:

I included the join_date as it tends to be an useful source of info (as in this forum), but if you don't need it, Chris' solution would be better.