View Full Version : help with auto expiring login for protected content

03-24-2007, 08:26 PM
I want to create a login page using php that uses mysql as the database.
I have some prebuilt html pages that I want the registered users to only have access to.
I would also like the logins to expire 7 days from the first time they are logged in and a way to delete the expired logins from the database and a simple way to add new ones from a text file.

I saw the example in this thread http://www.codingforums.com/showthread.php?t=1863
That uses cookies once they have been authorized for a login with php and mysql

All suggestions are welcome. I am relatively new to php and mysql but I learn fast

I am not looking for someone to build this for me (well if you want to, thank you very much); just maybe some links or some code examples or ideas on how to go about this.

03-25-2007, 04:14 AM
Research sessions and cookies. IF you want a login to "auto login" people for a max of 7 days then you need to set a cookie that expires in 7 days. But I think your trying to do temporary logins? Like if I was to buy a login to look at porn :) for 7 days, it would only be active from this point to this point kinda thing? Well then you can just create a user/pw that expires this day. Then when they login you can just bump the current time to the expired time. IF its expired, deny access and delete there account OR just set the account to inactive. If it hasn't expired, then allow access... Lots of ways you can go, just depends on what exactly your trying to achieve.