<?php

session_start();

if (isset($_GET['logout'])) {
    unset($_SESSION['username']);
    unset($_SESSION['username']);
    unset($_SESSION['user_type']);
    unset($_SESSION['user_id']);
    unset($_SESSION['admin']);
    unset($_SESSION['farm_id']);
}

if (!isset($_SESSION['username'])) {
    header("location:login.php");
} else {
    header("location:home.php");
}
