Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Jin He8,123 Points
About the usage of cookies and session
Logan R22,989 Points
I personally use session for user data, like user ids and usernames because sessions are more secure. Cookies on the other hand can be easily changed so it's better to use it for things like marking yes, the user has read this page, etc.
I am sure that's super vague, so check out this article: http://php.about.com/od/learnphp/qt/session_cookie.htm
A cookie can keep information in the user's browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit.
Sessions are not reliant on the user allowing a cookie. They work instead like a token allowing access and passing information while the user has their browser open.