In relation to How to create a secure login system using cookies and sessions?
I’m building a simple forum, spending my time securing $_SESSION => hashing as mindful person about security but simple one because my future website will be not something giant, I will enable SSL.
Will I need cookie(s) for example about Google Search Console/day’s visitors/SEO or nothing special about that and general security ?
Thank you for your help
2
Answers
The Sessions and Cookies both serve the purpose of storing data.The sessions are made at the server and gets destroyed once the connection with the server is lost or the application is closed, while the cookies are made at the client and stays for a defined time, either the application is opened or closed.And you can delete them anytime you wish.
So in relation to the security, the sessions are more appropriate than the cookies.
The latter part of your question is a kind of vague to me, yet I think this answer will be of some help to you. 😀
You can find a Cookies vs. sessions comparison here.
There are three main ways, we can get data from our users.
and there is one more method to get data which is –
sessions are related to cookies.
A session is a file that stored on the
web-server file system
not on the browser side.So, when we want save some information, the process is instead of sending a cookie to the user, we send them as a reference to that session file.
So on every request they make to the web server after that they send the reference and were able to lookup that session file and pull all the data out of it.
So the most important difference with sessions that they stored in server-side not client-side.
All we send to the client is a reference to help us find that file.
Using sessions has some benefits and drawbacks –
PROS –
cookie is limited to 4000 characters maximum.
for session, it is limited to only by the
file storage size
that you have on a web server i.e; how big is the hard-disk, that’s the limit.CONS –
You won’t see much difference on camparing to cookies, but it is.
Cookie can live 6 months or more.