<?php
    require_once "config/connection.php";
    
    $admin_user_id = $_SESSION["admin_user_id"];

    $sql = "DELETE FROM admin_log 
        	WHERE session_id='".$PHPSESSID."' AND ip_address='".USER_IP."' AND admin_user_id=".$admin_user_id; 
    
    if (!mysql_query($sql))
    {
        queryerror($sql);
        exit;
    }
    
    setcookie("username", $admin_user_id, time()+(ADMIN_TIMEOUT*24)*-1); 
    session_destroy();
    redirect("index.php");
