+ 16

what's the difference between cookies and session in php?..

cookies and sessions are same kind or not..

30th May 2018, 11:24 PM
madhina
madhina - avatar
7 odpowiedzi
+ 11
Cookie is local storing space.. when you turn off the system,the cookie will be destroyed... But, session is server side storing space.. Session cannot be deleted likewise I heard.. I don't know, it is right or not...
30th May 2018, 11:39 PM
madhina
madhina - avatar
+ 11
Thanks for clear the doubt...
30th May 2018, 11:51 PM
madhina
madhina - avatar
+ 5
The difference is that: A session is created on demand but only lasts for the current browsing session time. that is to say, it gets destroyed automatically when the user closes the browser. A cookie on the other hand, you can think of it as another variation of "sessions" that can last for a pre determined period of time. an hour, a day, a year, a century....etc. Moreover, any user can access cookie information while the same cannot be done for sessions.
30th May 2018, 11:35 PM
CHMD
CHMD - avatar
+ 2
Yes, cookie can be manually deleted, as they are small txt files that are stored in the browser. however, as I said, they can be programmed to last longer than the current session if not manually deleted, even when you turn off your computer. Sessions are stored in the server side that's why you cannot have direct access to them, but they get automatically destroyed as soon as you close your browser or are willingly erased by the server with session_destroy().
30th May 2018, 11:45 PM
CHMD
CHMD - avatar
+ 1
cookies are deleted manually when we turn off he computer.but sessions are deleted automatically after 24 hr. or 1 day
14th Jun 2018, 2:48 PM
lakhan vannal
lakhan vannal - avatar
+ 1
can we destroy server sessions manually by using the browser?
21st Jun 2018, 3:38 AM
Sachintha Sampath
Sachintha Sampath - avatar
0
What cookie does is, it stores data on your machine/ device. It depends on the time assigned to the cookie code. It can last for every long time. Cookies are not destroyed even after log out but the programmer can enable it to wipe itself immediately after log out or a set period of time. Sessions, unlike cookies are destroyed the moment you leave the site or log out.
26th Apr 2019, 9:28 AM
daniel mensah
daniel mensah - avatar