<?php
if ( $_SESSION['IsAdmin'] )
{
	echo "<h1>Firmendaten</h1>\n";
	if (isset($_POST['Speichern']))
		{
			$sql = 'UPDATE Firma SET
				Firma		= "'.$_POST['Firma'].'",
				Vertreter1	= "'.$_POST['Vertreter1'].'",
				Vertreter2	= "'.$_POST['Vertreter2'].'",
				Vertreter3	= "'.$_POST['Vertreter3'].'",
				Strasse		= "'.$_POST['Strasse'].'",
				HausNr		= "'.$_POST['HausNr'].'",
				PLZ			= "'.$_POST['PLZ'].'",
				Ort			= "'.$_POST['Ort'].'",
				Land		= "'.$_POST['Land'].'",
				Telefon		= "'.$_POST['Telefon'].'",
				Telefax		= "'.$_POST['Telefax'].'",
				EMail		= "'.$_POST['EMail'].'"
			WHERE ID = "2";';
			$stmt = $db->prepare($sql);
			if (!$stmt) {
				die ('Datensatz konnte nicht gespeichert werden: '.$db->error);
			}
			if (!$stmt->execute()) {
				die ('Datensatz konnte nicht gespeichert werden: '.$stmt->error);
			}
			echo "<p class=\"hinweis\">Firmendaten wurden gespeichert!</p>\n";
		}
	$sql1		= "SELECT * FROM Firma WHERE ID = '2';";
	$result1	= $db->query($sql1);
	$nt1		= $result1->fetch_assoc();
	echo "<p>Diese Daten werden für <span class=\"hinweis\">Kontakt, Impressum und Haftungsausschluss</span> auf Ihrer Homepage benötigt!</p>\n";
	echo "<form action=\"index.php?".$_SERVER['QUERY_STRING']."\" method=\"post\" />\n";
	echo "	<label>Firma</label>\n";
	echo "	<input type=\"text\" name=\"Firma\" value=\"".$nt1['Firma']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Gesetzl. Vertreter 1</label>\n";
	echo "	<input type=\"text\" name=\"Vertreter1\" value=\"".$nt1['Vertreter1']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Gesetzl. Vertreter 2</label>\n";
	echo "	<input type=\"text\" name=\"Vertreter2\" value=\"".$nt1['Vertreter2']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Gesetzl. Vertreter 3</label>\n";
	echo "	<input type=\"text\" name=\"Vertreter3\" value=\"".$nt1['Vertreter3']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Straße / Hausnummer</label>\n";
	echo "	<input type=\"text\" name=\"Strasse\" value=\"".$nt1['Strasse']."\" /> / \n";
	echo "	<input class=\"kurz\" type=\"text\" name=\"HausNr\" value=\"".$nt1['HausNr']."\" />\n";
	echo "	<br />\n";
	echo "	<label>PLZ / Ort</label>\n";
	echo "	<input class=\"kurz\" type=\"text\" name=\"PLZ\" value=\"".$nt1['PLZ']."\" /> / \n";
	echo "	<input type=\"text\" name=\"Ort\" value=\"".$nt1['Ort']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Land</label>\n";
	echo "	<input type=\"text\" name=\"Land\" value=\"".$nt1['Land']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Telefon</label>\n";
	echo "	<input type=\"text\" name=\"Telefon\" value=\"".$nt1['Telefon']."\" />\n";
	echo "	<br />\n";
	echo "	<label>Telefax</label>\n";
	echo "	<input type=\"text\" name=\"Telefax\" value=\"".$nt1['Telefax']."\" />\n";
	echo "	<br />\n";
	echo "	<label>EMail</label>\n";
	echo "	<input type=\"text\" name=\"EMail\" value=\"".$nt1['EMail']."\" />\n";
	echo "	<br />\n";
	echo "	&nbsp;<br />\n";
	echo "	<input type=\"submit\" name=\"Speichern\" value=\"Speichern\" />\n";
	echo "	<input type=\"reset\" value=\"Rücksetzen\" />\n";
	echo "</form>\n";


}
?>