<?php
$user_admin=$_COOKIE["user_admin"];
$jahrgang=$_COOKIE["jahrgang"];

if ($jahrgang == ""){ require("jahrgang.php"); exit;} //Wenn man kein Jahrgang ausgew&auml;hlt hat wird die Jahrgangsauswahlseite geladen
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php

// Rechte&uuml;berpr&uuml;fung
$db = dbconnect();
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
$result = $db->query("SELECT 1 FROM stan_admin_rechte, stan_admin_rechte_zuord , stan_admin where stan_admin_rechte.stan_admin_rolle = stan_admin_rechte_zuord.stan_admin_rolle AND stan_admin_rechte_zuord.said = stan_admin.said AND stan_admin.user = '$user_admin' AND stan_admin_rechte_zuord.stan_admin_rolle = 'a_sperrfr'");
$row = $result->fetch_array();
if ($row[0] != 1){ include("kurs/rechte.php"); exit;}
// Rechte&uuml;berpr&uuml;fung ende


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

switch($action){
default:


$db = dbconnect();

$frist_beg_v = $db->query("SELECT DATE_Format(beginn, '%d') tag_anmbeg_v,
                                 DATE_Format(beginn, '%m') mon_anmbeg_v,
                                 DATE_Format(beginn, '%Y') jahr_anmbeg_v,
                                 DATE_Format(ende, '%d') tag_ende_v,
                                 DATE_Format(ende, '%m') mon_ende_v,
                                 DATE_Format(ende, '%Y') jahr_ende_v
                            FROM stan_sperrzeit
                           WHERE kennung = 'V'
                             AND jahrgang='$jahrgang'");
$anmelde_v = $frist_beg_v->fetch_array();

$frist_beg_w = $db->query("SELECT DATE_Format(beginn, '%d') tag_anmbeg_w,
                                 DATE_Format(beginn, '%m') mon_anmbeg_w,
                                 DATE_Format(beginn, '%Y') jahr_anmbeg_w,
                                 DATE_Format(ende, '%d') tag_ende_w,
                                 DATE_Format(ende, '%m') mon_ende_w,
                                 DATE_Format(ende, '%Y') jahr_ende_w
                            FROM stan_sperrzeit
                           WHERE kennung = 'W'
                             AND jahrgang='$jahrgang'");
$anmelde_w = $frist_beg_w->fetch_array();

$frist_beg_a = $db->query("SELECT DATE_Format(beginn, '%d') tag_anmbeg_a,
                                 DATE_Format(beginn, '%m') mon_anmbeg_a,
                                 DATE_Format(beginn, '%Y') jahr_anmbeg_a,
                                 DATE_Format(ende, '%d') tag_ende_a,
                                 DATE_Format(ende, '%m') mon_ende_a,
                                 DATE_Format(ende, '%Y') jahr_ende_a
                            FROM stan_sperrzeit
                           WHERE kennung = 'A'
                             AND jahrgang='$jahrgang'");
$anmelde_a = $frist_beg_a->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>Sperrfristen</title>
</head>

<body onload=\"if(document.anmschluss)document.anmschluss.beg_tag_v.focus();return false;\">

<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=\"80%\" 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\">Sperrfristen</font><br>
                    <font class=\"sh\">Jahrgang: $jahrgang<br>In dieser Zeit können keine Praxisstellen belegt werden</font><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>
                    <table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" id=\"table2\" name=\"anmschluss\">
                        <tr>
                            <td><br>
                            <table align=\"center\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">
                                <tr>
                                    <td width=\"1%\" background=\"../images/box_e1a.gif\">&nbsp;</td>
                                    <td align=\"left\" width=\"98%\" background=\"../images/box_top1.gif\" valign=\"top\">
                                    <p align=\"center\">&nbsp;</p>
                                    </td>
                                    <td align=\"right\" width=\"1%\" background=\"../images/box_e2a.gif\">&nbsp;</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=schluss"; echo" method=\"POST\" name=\"anmschluss\">
                                    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-left-width:0; border-right-width:0; border-bottom-width:0\" bordercolor=\"#111111\" width=\"100%\">
                                        <tr>
                                            <td width=\"30%\">
                                            <p style=\"margin:10 4; \">PU V-Zweig:
                                            </td>
                                            <td width=\"70%\" align=\"left\" >
                                            <p style=\"margin:10 4; \">
                                              <input type=\"text\" name=\"beg_tag_v\" size=\"1\" value=\"$anmelde_v[tag_anmbeg_v]\">.<input type=\"text\" name=\"beg_mon_v\" size=\"1\" value=\"$anmelde_v[mon_anmbeg_v]\">.<input type=\"text\" name=\"beg_jahr_v\" size=\"3\" value=\"$anmelde_v[jahr_anmbeg_v]\"> bis <input type=\"text\" name=\"end_tag_v\" size=\"1\" value=\"$anmelde_v[tag_ende_v]\">.<input type=\"text\" name=\"end_mon_v\" size=\"1\" value=\"$anmelde_v[mon_ende_v]\">.<input type=\"text\" name=\"end_jahr_v\" size=\"3\"  value=\"$anmelde_v[jahr_ende_v]\">
                                            </p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width=\"30%\" >
                                            <p style=\"margin:10 4; \">PU W-Zweig:
                                            </td>
                                            <td width=\"70%\" align=\"left\">
                                            <p style=\"margin:10 4; \">
                                              <input type=\"text\" name=\"beg_tag_w\" size=\"1\" value=\"$anmelde_w[tag_anmbeg_w]\">.<input type=\"text\" name=\"beg_mon_w\" size=\"1\" value=\"$anmelde_w[mon_anmbeg_w]\">.<input type=\"text\" name=\"beg_jahr_w\" size=\"3\" value=\"$anmelde_w[jahr_anmbeg_w]\"> bis <input type=\"text\" name=\"end_tag_w\" size=\"1\" value=\"$anmelde_w[tag_ende_w]\">.<input type=\"text\" name=\"end_mon_w\" size=\"1\" value=\"$anmelde_w[mon_ende_w]\">.<input type=\"text\" name=\"end_jahr_w\" size=\"3\"  value=\"$anmelde_w[jahr_ende_w]\">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width=\"30%\" >
                                            <p style=\"margin:10 4; \">Ausland:
                                            </td>
                                            <td width=\"70%\" align=\"left\">
                                            <p style=\"margin:10 4; \">
                                              <input type=\"text\" name=\"beg_tag_a\" size=\"1\" value=\"$anmelde_a[tag_anmbeg_a]\">.<input type=\"text\" name=\"beg_mon_a\" size=\"1\" value=\"$anmelde_a[mon_anmbeg_a]\">.<input type=\"text\" name=\"beg_jahr_a\" size=\"3\" value=\"$anmelde_a[jahr_anmbeg_a]\"> bis <input type=\"text\" name=\"end_tag_a\" size=\"1\" value=\"$anmelde_a[tag_ende_a]\">.<input type=\"text\" name=\"end_mon_a\" size=\"1\" value=\"$anmelde_a[mon_ende_a]\">.<input type=\"text\" name=\"end_jahr_a\" size=\"3\"  value=\"$anmelde_a[jahr_ende_a]\">
                                            </td>
                                        </tr>
                                       </table>
                                    </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\">&nbsp;</td>
                                    <td 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\">&nbsp;</td>
                                </tr>
                            </table>
                            <br>
                            </td>
                        </tr>
                    </table>
                    </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>
            </p>
               <input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\"></form>
        </div>
        </td>
    </tr>
</table>

</body>

</html>";

break;
case "schluss":


if (checkdate($_POST[beg_mon_v], $_POST[beg_tag_v], $_POST[beg_jahr_v]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Beginn der Sperrfrist des PU V-Zweigs ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung

if (checkdate($_POST[end_mon_v], $_POST[end_tag_v], $_POST[end_jahr_v]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Ende der Sperrfrist des PU V-Zweigs ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung




if (checkdate($_POST[beg_mon_w], $_POST[beg_tag_w], $_POST[beg_jahr_w]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Beginn der Sperrfrist des PU W-Zweigs ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung

if (checkdate($_POST[end_mon_w], $_POST[end_tag_w], $_POST[end_jahr_w]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Ende der Sperrfrist des PU W-Zweigs ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung



if (checkdate($_POST[beg_mon_a], $_POST[beg_tag_a], $_POST[beg_jahr_a]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Beginn der Sperrfrist der Auslandsstelle ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung

if (checkdate($_POST[end_mon_a], $_POST[end_tag_a], $_POST[end_jahr_a]) == 0) { // checkdate liefert 0 & 1 zur&uuml;ck: 0 wenn Datum falsch, 1 wenn Datum richtig
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>Falsches Datum</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\">Falsches Datum</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 Datumseingabe beim Ende der Sperrfrist der Auslandsstelle ist falsch!</p></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;
} // Ende Datums&uuml;berpr&uuml;fung








$beg_dat_v = "$_POST[beg_jahr_v]-$_POST[beg_mon_v]-$_POST[beg_tag_v]";
$end_dat_v = "$_POST[end_jahr_v]-$_POST[end_mon_v]-$_POST[end_tag_v]";

$beg_dat_w = "$_POST[beg_jahr_w]-$_POST[beg_mon_w]-$_POST[beg_tag_w]";
$end_dat_w = "$_POST[end_jahr_w]-$_POST[end_mon_w]-$_POST[end_tag_w]";

$beg_dat_a = "$_POST[beg_jahr_a]-$_POST[beg_mon_a]-$_POST[beg_tag_a]";
$end_dat_a = "$_POST[end_jahr_a]-$_POST[end_mon_a]-$_POST[end_tag_a]";

$db = dbconnect();

$sql = $db->query ("DELETE FROM stan_sperrzeit WHERE jahrgang='$jahrgang'");
$sql = $db->query("INSERT INTO stan_sperrzeit (jahrgang, beginn, ende, kennung) VALUES ('$jahrgang', '$beg_dat_v', '$end_dat_v', 'V')");
$sql = $db->query("INSERT INTO stan_sperrzeit (jahrgang, beginn, ende, kennung) VALUES ('$jahrgang', '$beg_dat_w', '$end_dat_w', 'W')");
$sql = $db->query("INSERT INTO stan_sperrzeit (jahrgang, beginn, ende, kennung) VALUES ('$jahrgang', '$beg_dat_a', '$end_dat_a', 'A')");

echo "
<meta http-equiv=\"refresh\" content=\"1; URL=sperrzeiten.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>Datums&auml;nderung</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\">Datums&auml;nderung</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>Das Datum wurde aktualisiert!</b>
                    </p>
                    </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
?>