Can someone explain what are sessions and how they work? or What are sessions and why are they import

14 Replies, 962 Views

Sessions are like a temporary memory for websites. When you log in, the server creates a session ID (usually stored in a cookie) to remember you.

It’s not *just* a cookie tho—cookies are just one way to store the session ID. The actual session data lives on the server, so it’s more secure than stuffing everything into a cookie.

For example, when you add stuff to a cart, the site uses your session to keep track. No session? Your cart would empty every time you click a new page.

Check out MDN’s guide on sessions—super helpful for beginners!

Messages In This Thread



Users browsing this thread: 1 Guest(s)