I am currently building a member system with each user having there own login password. I posted about this a few weeks back and I have made a lot of progress ( I have been busy haven't been able to devote much time to it though). However I have three questions

1) How do I allow the user to sign out? I am using session_start(); to start the season so how do i finish it.

2) How I allow the user to set an option so they auto login with out them having to type there member details everytime. My current idea for this is to create a random value store this in a mysql database and also send this value to the user as a cookie and when they visit checking the cookie and comparing it to the value in the mysql database. Is this the right way of doing it any ideas how I would go about doing this?

3) The users have a password these are stored in the database as plain text. Is this safe they shouldn't be able to access the database.