Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

sessions VS cookies

session

  • Please log in to reply
5 replies to this topic

#1 zeroradius

zeroradius

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1085 posts

Posted 04 March 2008 - 08:30 PM

Hey guys, when i make things that need to be stored such as login information i write it to a session, I know you can also use cookies although i have never tried. For information such as user name and password wich is better to use the session or the cookie and why? thanks in advance
  • 0
Posted Image

#2 v0id

v0id

    Retired

  • Retired Mod
  • PipPipPipPipPipPipPipPip
  • 2313 posts

Posted 04 March 2008 - 09:42 PM

Cookies are used for information that shall be saved for a long time on the client's computer, and they'll probably be active when you come to the website another time (I'm saying probably, because it depends on how long the cookie shall last)

Sessions do save information too, but only while the sessions lasts! If you quit the website, or close down the browser, the session will no longer be active.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#3 zeroradius

zeroradius

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1085 posts

Posted 04 March 2008 - 10:18 PM

Thanks. So it would probably be best to do sessions for log in information in case the person just exits the site withought loging out corect?
  • 0
Posted Image

#4 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 05 March 2008 - 12:05 AM

One thing to note is that cookies can be altered by the user while sessions cannot. Thus if you intend on storing private/secure information, its probably best to do so in sessions and not cookies.
  • 0

#5 zeroradius

zeroradius

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1085 posts

Posted 05 March 2008 - 12:07 AM

ok thanks to both of you that answers my question complytly.
  • 0
Posted Image

#6 Lop

Lop

    Speaks fluent binary

  • Just Joined
  • PipPipPipPipPipPipPip
  • 1112 posts

Posted 05 March 2008 - 12:49 PM

Also, using sessions you can't enable the "remember me" function that automatically logs you in each visit.
  • 0





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download