Jump to content

Recommended Posts

Posted

I'm trying to make logging in a bit easier for users.

I've tried dropping a cookies with the user's id and hashed password if the user is logged in, and if they're not logged in, pick up the two cookies and use them to log the last user in.

<?php
session_start();
if($user->isLoggedin()) {
$me = $user;
$pass = $user->pass;
setcookie("id",$me,time() + 500);
setcookie("pass",$pass,time() +500);
echo "it is $me and $pass";
}else{
if($session->login($_COOKIE["id"],$_COOKIE["pass"])){ echo "you in";}
echo $_COOKIE["id"];
}
?>

It doesn't seem to be working though. Where have I gone wrong?

Posted

Just a quick guess, but if you are storing the user->pass in a cookie, that would be the hashed version, so you couldn't use that to login again!

Posted

In fact, I compromised on this. I've used the persistent login, but also dropped a cookie with the user ID. If the user is not logged in, the cookie user ID will be used instead for simple site functions, but obviously in inviting the user to log back in for full function.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...