Jump to content

Cookies, or sessions?


localhost

Recommended Posts

Both.

Use sessions for active user sessions, and a 'remember me' system for letting users gain a user session without activly logging in.

A 'remember me' cookie is commonly the username and encrypted password, allowing you to check for the cookie when initializing sessions and such.

I personally woulnt store a password in there. i would store a unique id alongside the users information in a DB / Flatfile, and set the cookie to that value. (and modify both values to a new unique id every time a new active session is created)
Link to comment
Share on other sites

[quote author=digitalgod link=topic=101440.msg401533#msg401533 date=1153533975]
yeah that's exactly what I do

[code]
<?php
if ($remember == "yes") {
      $_SESSION['remember']=$uname;
  setcookie("remember",$uname,time()+31449600,"/",$site_address);
      }
      else {
      $_SESSION['remember']=$uname;
      }
?>
[/code]
[/quote]

If $uname only contains their username, thats bad, as anyone can use that information to login to their session.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.