PHP: Difference between Session and cookie


1. Session is a server side resource . (Stored in a server side )


1. Cookie is a client side resource . ( Stored in browser(client side )).


2. Session holds the multiple values.
3. It can store an unlimited amount of data.


2. Cookie does not hold multiple variable .
3. Cookies are stored limit amount of data . The allow size 4kb[4096bytes]


4. Session depends on the server, if a user closes the browser and again try to login. If the expiry time is remaining on the server then check and log in directly .if Session time is expired then redirects to login page .

5.Session related to the cookies. A session is a collection of data stored on the server and associated with a given user (via cookie containing an id code )


4. Cookie depends on the client side (browser) if a user closes the window and after return, he can direct login because of cookies stored information in the browser.If the cookies time is expired then return to the login again.

5. The cookie contains a bit of data stored by the browser. If the user generates a request to the browser then browser sent information to the server for every request. The browser sends information to the server to redirect login without putting any id and password.


PHP session example – Session in PHP

Session mini project .- Login with session using PHP and MYSQL database


PHP Cookies example – Cookies in PHP

Cookies Mini Project – Login system using PHP and MYSQL database

Recommended Posts:-

Previous Posts:-

Shop Items:-

Payment form by PayUmoney gateway with GST invoice,email | PHP software


Paypal payment form with email, invoice generator in PHP website | Scripts


Paypal Payment form in PHP website with MYSQL database | International Payments