That looks great. I'm unfortunately in the middle of changing my designated session/cookie variables, but I think I'm set on the way I'm doing it, so I'm about to try implement this improvement you suggested...
can I use a filter on a $row[]; ?
ie
PHP Code:
$userid = filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT);
$username = filter_var($row['username'], FILTER_SANITIZE_STRING);
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
$_SESSION['logged_in'] = TRUE;
I ask because the new cookie I am using, a single cookie, is a hashed combination of variables that I won't be using in sessions anymore - it is only to check if the user is allowed to log in and have the sessions set. Hope that makes sense! heh
edit: wait, I could just do this
PHP Code:
$_SESSION['userid'] = filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT);
$_SESSION['username'] = filter_var($row['username'], FILTER_SANITIZE_STRING);
$_SESSION['logged_in'] = TRUE;
Right? (Assuming rows are ok to filter!)
Bookmarks