Kamis, 05 Maret 2015

The Difference between Cookies and Session


Cookies we can change and alter it to have a longer lifespan, it means that cookies can save data for month or years.Cookies is having a data kept in side a client , and also work when we have a cluster in of a web servers, in which sessions were kept in the server , and also mean that one of your server deal with the first request , the other web clusters wont have any information stored inside.
Sessions are kept inside the server, it means that as a user or client we are not granted the permission to access it because it is in a server the reason is for safety in a case where we don't want hacking to happen to use so it is kept in the server for save keeping. Sessions size are completely up yo us because they are stored in a server, which a lot of web browsers have a limit on how big cookies can be while sessions we don't have to worries about the data sizes
Summary
-sessions and cookies are good ways to store data , while sessions are very secure but cookies definitely has a very long lifespan.
-rewriting sessions are possible using PHP so that we can stored the data whenever we want.
-to keep a complex set of data with types such as array and objects or session, we can serialize and sort the into string type first

Tidak ada komentar:

Posting Komentar