<?php
session_start();

include 'db.php';

if (isset($_COOKIE['remember_token'])) {
    $token = $_COOKIE['remember_token'];
    setcookie('remember_token', '', time() - 3600, "/");
    
    // Hapus token dari database
    $conn = new mysqli($servername, $username, $password, $database);
    $stmt = $conn->prepare("UPDATE users SET remember_token = NULL WHERE remember_token = ?");
    $stmt->bind_param("s", $token);
    $stmt->execute();
    $stmt->close();
    $conn->close();
}

session_destroy();
header("Location: login.php");
exit;
?>










?>
