<?php
if (!isset($_POST['ok']))
{
	$sql = "SELECT * FROM Admin WHERE ID = \"" . $_POST['ID'] . "\";";
	$result = $db->query($sql);
	$nt = $result->fetch_assoc();
	echo "<fieldset>\n";
	echo "	<legend>Benutzer löschen</legend>\n";
	echo "	<h2>Soll folgender Benutzer wirklich gelöscht werden?</h2>\n";
	echo "	<label>Vorname</label>\n";
	echo "	<label>" . $nt['Vorname'] . "</label>\n";
	echo "	<br class=\"fix\" />\n";
	echo "	<label>Nachname</label>\n";
	echo "	<label>" . $nt['Nachname'] . "</label>\n";
	echo "	<br class=\"fix\" />&nbsp;<br />\n";
	echo "	<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\">\n";
	echo "		<input type=\"hidden\" name=\"ID\" value=\"" . $_POST['ID'] . "\" />\n";
	echo "		<input type=\"hidden\" name=\"ok\" value=\"1\" />\n";
	echo "		<input type=\"submit\" class=\"button_del\" name=\"formaction\" value=\"del\" title=\"Benutzer jetzt l&ouml;schen\" />\n";
	echo "		<input type=\"submit\" class=\"button_stop\" name=\"formaction\" value=\"stop\" title=\"Abbrechen\" />\n";
	echo "	</form>\n";
	echo "</fieldset>\n";
}
else
{
	$sql = "DELETE FROM
				Admin
			WHERE
				ID = \"" . $_POST['ID'] . "\";";
	$result = $db->query($sql);
	if ($result)
	{
		unset($_POST);
		include __DIR__ . "/user.php";
	}
	else
	{
		echo "Fehler beim löschen";
	}
}