Encrypt or scramble contents of cookie

Discussion in 'PHP' started by bluesky422, Mar 25, 2008.

  1. #1
    Hello, the site I am developing relies on information in a cookie and is now easily readable by the user. Is there a way to encrypt or scramble the contents of the cookie?

    There is no login info in the cookie simply session related info.

    Thanks!
     
    bluesky422, Mar 25, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If the information isn't sensitive then why scramble it?
     
    matthewrobertbell, Mar 26, 2008 IP
  3. bluesky422

    bluesky422 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It is likely that some password info will be stored in the cookie in the near future so I am preparing for it.
     
    bluesky422, Mar 26, 2008 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is what you should use PHP sessions for. You don't even have to worry about managing your cookies, then...
     
    TwistMyArm, Mar 26, 2008 IP
  5. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That's bad design ;) There are better ways of doing it, such as generating a hash based on user data fro each session.
     
    matthewrobertbell, Mar 26, 2008 IP