<?php
session_start();
ob_start();
if (isset($_SESSION['us_name']) AND isset($_SESSION['us_password']) AND $_SESSION['admin']==1){
		
		require_once("db_connect.php");
		$id=htmlspecialchars($_GET["id"]);

		$sql= "DELETE FROM users WHERE id=$id";
		if ($conn->query($sql) === TRUE) {
		    $_SESSION['error']="Smazáno";
		    header("Location: all_users.php");
		} else {
		    $_SESSION['error']="Chyba";
		    header("Location: all_users.php");
		}

}else{
  header ("Location: index.php"); 
}


ob_end_flush();
?>