<?php
require("../conn.php");
session_start();

// see if they're logged in
$sessionID = session_id();
$query = "select userID from loginusers where sessionID='$sessionID'";

$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);

// if no session found, then just send to the login page
if ($num < 1) {
	Header("Location: ../login.php");
	echo "no session found";
	exit;
}

// or else they're logged in, get the AdminUserID
while ($row = mysql_fetch_row($result)) {
	$userID = $row[0];
}


$query = "delete from loginusers where userID='$userID'";
mysql_query($query)or die(mysql_error());

Header ("location: ../login.php");
echo "session deleted for admin $userID";
?>