When someone logs in and checks the "keep me logged in" checkbox, you should make a note of it in your db. I'm thinking the session table (if you have one) would be a good place to put this. The user table is another possibility.
By "make note of it in your db" I mean that you should store enough information in your database to determine whether someone deserves to be logged in without providing a password.
The easiest "remember me" concept to me is that you store a session id in a cookie with an expiration date six months off or something. The session ID should be some random sequence. [man]uniqid[/man] with the 2nd param set to TRUE might be useful for providing a session id. Maybe something like this:
// assuming the user has provided a valid username and password
// we can check to see if they want to be remembered
if ($_POST['remember_me']) {
$remember_me_id = uniqid('string_prefix_', TRUE);
// code here would store $remember_me_id somewhere in your db
setcookie('your_cookie_name', $remember_me_id, strtotime('+30 days'));
}
When someone comes to your site that has no current session, your site would check for that cookie. If the cookie is found, your code would search in the db for the remember_me_id value and, if found, would establish a session without prompting the user for password.
The basic idea is that this session id is another password which gets stored in a cookie. From a security standpoint, this is obviously risky because an intruder may gain temporary access to the computer where the cookie is stored. Obviously the cookie value should be impossible to guess that's why it's good to have long values.
To mitigate what is obviously a risky security situation, you should give sessions created with this cookie limited capabilities. Don't let users change their password without entering the real password. Don't show them any credit card numbers or let them make orders, etc.
There's also the issue of keeping your session table clean in your database. You should always update that last_request time for these stored sessions with each page request and occasionally, you should delete "remember me" session records where the last_request time is more than 30 days or six months or whatever.
There are other techniques you can use to enhance the security of this approach. You might check a variety of information about the user: their ip address or a portion of their ip address? their user agent string?
And personally, I firmly believe in using HTTPS whenever possible for sensitive information. Logins/logouts, whatever. It's not that hard.