checking cookie set in php

the cookie set is checked for cookie name

Here  ‘user’  is  the cookie name  and cookie value is the username 

$cookie_value = 'user_name';  
 setcookie('user', $cookie_value, time() + (60 * 10), "/"); // 86400 = 1 day 
 
        if(!isset($_COOKIE['user'])) {
 
           header('Location:index.php'); 
           exit;
 
        }else{
 
          header('Location:assets.php'); 
          exit;
 
        }

 

Leave a Reply

Your email address will not be published. Required fields are marked *