Session du magasin PHP à Cookie

@session_start();

function logged_in() {
    if(!isset($_SESSION['user_id']) && isset($_COOKIE['user_id'])) {
        $_SESSION['user_id'] = $_COOKIE['user_id'];
    }
    return isset($_SESSION['user_id']);
}

function logout() {
    unset($_SESSION['user_id']);
    setcookie("user_id", "", time() - 3600);
    header("Location: http://".$_SERVER['HTTP_HOST']);
    exit;
}
DreamCoder