Advertisement
Darksoul__

Untitled

Apr 29th, 2021
1,097
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     if($_SESSION['name']=="")
  4.         header("Location: index.php");
  5.     else{
  6.         $cookie_name = "userID";
  7.         $cookie_value = $_SESSION['name'];
  8.         setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 giorno
  9.     }
  10.     if(isset($_COOKIE['userID'])){
  11.         $_SESSION['name']=$_COOKIE['userID'];
  12.     }
  13. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement