<?php
$doz_uid1=$_COOKIE["doz_uid1"];

include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php

if ($doz_uid1 == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen


if (isset($_GET['action']))
   $action = $_GET['action'];
else
   $action = "";

switch($action){
default:

$db = dbconnect();
$result = $db->query("SELECT doz_name, doz_vorname, doz_strasse, doz_plz, doz_ort, doz_titel, doz_mail FROM doz where doz_uid=\"$doz_uid1\"");
$row = $result->fetch_array();
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Daten vervollst&auml;ndigen</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">Daten vervollst&auml;ndigen</font><br>
                    <span class=\"sh\">Halten Sie bitte Ihre Daten aktuell</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></font></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>
					<form action="; echo $_SERVER['PHP_SELF'] . "?action=persdat"; echo" method=\"POST\" name=\"pers_daten\">
					  <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\" height=\"280\">
						<tr>
						  <td>

							<b>Titel:</b>
							</td>
						  <td align=\"left\">
							<input type=\"text\" name=\"Titel\" size=\"60\" value=\"$row[doz_titel]\">
						  </td>
						</tr>
						 <tr>
						  <td>
							<b>Vorname:<br>
						  </td>
						  <td align=\"left\">
							<input type=\"text\" name=\"Vorname\" size=\"60\" value=\"$row[doz_vorname]\">
						  </td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  <b>Nachname:</b>
						  </td>
						  <td width=\"76%\" align=\"left\">
						  <input type=\"text\" name=\"Nachname\" size=\"60\" value=\"$row[doz_name]\"></td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  <b>Stra&szlig;e:</b>
						  </td>
						  <td width=\"76%\" align=\"left\">
						  <input type=\"text\" name=\"strasse\" size=\"60\" value=\"$row[doz_strasse]\"></td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  <b>PLZ / Ort:</b>
						  </td>
						  <td width=\"76%\" align=\"left\">
						  <input type=\"text\" name=\"plz\" size=\"5\" value=\"$row[doz_plz]\">&nbsp;
						  <input type=\"text\" name=\"ort\" size=\"49\" value=\"$row[doz_ort]\"></td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  <b>E-Mail:</b>
						  </td>
						  <td width=\"76%\" align=\"left\">
						  $row[doz_mail]</td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  &nbsp;
						  </td>
						  <td width=\"76%\" align=\"left\">
						  &nbsp;
						  </td>
						</tr>
						<tr>
						  <td colspan=\"2\">
						  Alle Felder m&uuml;ssen ausgef&uuml;llt werden
						  </td>
						</tr>
						<tr>
						  <td width=\"24%\">
						  &nbsp;
						  </td>
						  <td width=\"76%\" align=\"left\">
						  &nbsp;
						  </td>
						</tr>
					  </table>
					  <input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\"></body>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";

break;
case "persdat":


if ($_POST[Titel] == "" or $_POST[Vorname] == "" or $_POST[Nachname] == "" or $_POST[strasse] == "" or $_POST[plz] == "" or $_POST[ort] == ""){
echo"
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Eingabefehler</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Eingabefehler</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Es m&uuml;ssen alle Felder ausgef&uuml;llt werden!</b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";

exit;
}

$db = dbconnect();
$sql = $db->query ("UPDATE doz SET
                       doz_vorname=\"". $_POST['Vorname']."\"
                     , doz_name=\"". $_POST['Nachname']."\"
                     , doz_strasse=\"". $_POST['strasse']."\"
                     , doz_plz=\"". $_POST['plz']."\"
                     , doz_ort=\"". $_POST['ort']."\"
                     , doz_titel=\"". $_POST['Titel' ]."\"
                     WHERE doz_uid=\"$doz_uid1\"
                   ");

echo "
<meta http-equiv=\"refresh\" content=\"2; URL=hauptframe_jahr.php\">
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>&Auml;nderungen gespeichert</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">&Auml;nderungen gespeichert</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Die &Auml;nderungen wurden gespeichert!</b>
					<br>
					<br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
} // Ende Action
?>