bookmark_borderPersistent and Non-Persistent Cookie

Cookie used to store user data in form of text file or memory and access the values from it, Cookie are the part of HTTP header.

What is Persistent Cookie ?

Persistent Cookie which will store the data in text file with expire date and time. If you are access the website or particular page cookie will be created based on cookie name.  Next time If you are visiting the website or page it will be accessible from the cookie file which was created in the client browser.

Also Persistent Cookie is unsafe, because it will be easy viewable in the browser.

persistent_cookie.php

<?php
// creating the name:cookie_name_persistent and value:my cookie value with expire 1 hour
setcookie("cookie_name_persistent","my cookie value",time()+3600);

Above PHP file will create cookie and expire within 1 hour, you can view the cookie expire time in browser cookie part. Continue reading “Persistent and Non-Persistent Cookie”