The term "cookie" was derived from the term "magic cookie”, which is a packet of data a program receives and sends back unchanged. A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.
Cookie is created with the setcookie() function. We can also modify the cookie with the same function setcookie() with different parameters.Setcookie(name,value,expiry date) are the important parameters in cookie.We can delete a cookie by using the setcookie() function with an expiration date in the past.To check whether the user is logged in or not ,authentication cookies are the most common method used by web servers.
Some types of cookies are session cookie, persistent cookie, secure cookie, HttpOnly cookie, super cookie, Zombie cookie.A session cookie, also known as an in-memory cookie or transient cookie, exists only in temporary memory while the user navigates the website. Web browsers normally delete session cookies when the user closes the browser.
Instead of expiring when the web browser is closed as session cookies do, persistent cookies expire at a specific date or after a specific length of time.
A secure cookie can only be transmitted over an encrypted connection (i.e.Https).A "supercookie" is a cookie with an origin of a Top-Level Domain (such as .com).
Zombie cookies are cookies that are automatically recreated after being deleted. This is accomplished with the help of a client-side script.