Cookies vs. sessions

I started using PHP a couple of months ago. For the sake of creating a login system for my website, I read about cookies and sessions and their differences (cookies are stored in the user’s browser and sessions on the server). At that time, I preferred cookies (and who does not like cookies?!) and just said: “who cares? I don’t have any good deal with storing it in my server”, so, I went ahead and used cookies for my bachelor graduation project. However, after doin’ the big part of my app, I heard that for the particular case of storing user’s ID, sessions are more appropriate. So I started thinking about what would I say if the jury asks me why have you used cookies instead of sessions? I have just that reason (that I do not need to store internally information about the user). Is that enough as a reason? or it’s more than that?

Could you please tell me about advantages/disadvantages of using cookies for keeping User’s ID?

Thanks for you all in StackOverflow!

15 Answers
15

Leave a Comment