92 lines
2.7 KiB
PHP
92 lines
2.7 KiB
PHP
<?php
|
|
if ("" != $_POST['Geb_Datum'])
|
|
{
|
|
$nt = explode(".", $_POST['Geb_Datum']);
|
|
$Geb_Datum = $nt['2'] . "-" . $nt['1'] . "-" . $nt['0'];
|
|
if (3 != sizeof($nt))
|
|
{
|
|
echo "<h1>Bitte überprüfen Sie das Format des Geburtsdatums bei der Eingabe!</h1>\n";
|
|
echo "<h2>Das korrekte Datumsformat ist z.B.: \"25.07.2009\"!</h2>\n";
|
|
}
|
|
else
|
|
{
|
|
if (4 != strlen($nt['2']))
|
|
{
|
|
echo "<h1>Bitte überprüfen Sie das Datumsformat bei der Eingabe!</h1>\n";
|
|
echo "<h2>Die Eingabe der Jahreszahl muss 4-stellig erfolgen!</h2>\n";
|
|
}
|
|
else
|
|
{
|
|
if (checkdate($nt['1'], $nt['0'], $nt['2']))
|
|
{
|
|
$temp = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$Geb_Datum = "0000-00-00";
|
|
}
|
|
|
|
if (isset($_POST['new']))
|
|
{
|
|
$sql = 'INSERT INTO ' . PREFIX . '_Kontakte (ID, Datum) VALUES (NULL, CURDATE())';
|
|
$stmt = $db->prepare($sql);
|
|
if (!$stmt)
|
|
{
|
|
die ('Datensatz konnte nicht angelegt werden: ' . $db->error);
|
|
}
|
|
if (!$stmt->execute())
|
|
{
|
|
die ('Datensatz konnte nicht angelegt werden: ' . $stmt->error);
|
|
}
|
|
$sql = 'SELECT last_insert_id() AS last';
|
|
$result = $db->query($sql);
|
|
$nt = $result->fetch_assoc();
|
|
$ID = $nt['last'];
|
|
}
|
|
elseif (isset($_POST['edit']))
|
|
{
|
|
$ID = $_POST['ID'];
|
|
}
|
|
$sql = 'UPDATE ' . PREFIX . '_Kontakte SET
|
|
Firma = "' . $_POST['Firma'] . '",
|
|
Anrede = "' . $_POST['Anrede'] . '",
|
|
Vorname = "' . $_POST['Vorname'] . '",
|
|
Nachname = "' . $_POST['Nachname'] . '",
|
|
Strasse = "' . $_POST['Strasse'] . '",
|
|
Nummer = "' . $_POST['Nummer'] . '",
|
|
PLZ = "' . $_POST['PLZ'] . '",
|
|
Ort = "' . $_POST['Ort'] . '",
|
|
Land = "' . $_POST['Land'] . '",
|
|
Geb_Datum = "' . $Geb_Datum . '",
|
|
Telefon = "' . $_POST['Telefon'] . '",
|
|
Fax = "' . $_POST['Fax'] . '",
|
|
Mobil = "' . $_POST['Mobil'] . '",
|
|
Email = "' . $_POST['Email'] . '",
|
|
Homepage = "' . $_POST['Homepage'] . '",
|
|
Gericht = "' . $_POST['Gericht'] . '",
|
|
SteuerNr = "' . $_POST['SteuerNr'] . '",
|
|
Kto_Inhaber = "' . $_POST['Kto_Inhaber'] . '",
|
|
Kto_Nummer = "' . $_POST['Kto_Nummer'] . '",
|
|
BLZ = "' . $_POST['BLZ'] . '",
|
|
Bank = "' . $_POST['Bank'] . '",
|
|
DSchutz = "' . $_POST['DSchutz'] . '"
|
|
WHERE ID = "' . $ID . '";';
|
|
$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 "<h2>Kunde <i>" . $_POST['Firma'] . ", " . $_POST['Vorname'] . " " . $_POST['Nachname'] . "</i> wurde gespeichert!</h2>\n";
|
|
|
|
echo "<form action=\"index.php?section=kontakt\" method=\"post\">\n";
|
|
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $ID . "\" />\n";
|
|
echo " <input type=\"submit\" class=\"button_view\" name=\"formaction\" value=\"show\" title=\"Kunde anzeigen\" />\n";
|
|
echo "</form>\n";
|
|
echo "<br class=\"fix\"/>\n"; |