<?php
if ($_COOKIE["uid1"] == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
$uid1=$_COOKIE["uid1"];
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
require("check_zweig.php");                 // Prüft, ob Innenverwaltung angemeldet ist: setzt datenbankanbindung.php voraus
$db = dbconnect();
include("kurs/sta/stan_useronline_write.php");     // F&uuml;r Statistik, wieviele User online sind

// &Uuml;Berpr&uuml;fung, ob die Anmeldefrist &uuml;berschritten ist
$heute  = mktime(0, 0, 0, date("m"), date("d"), date("Y"));  // heutiges Datum
$heute_format = date("Y-m-d", $heute);  // ISO-8601 Format wie in der Datenbank: Formatierung f&uuml;r Vergleiche erforderlich

$res = $db->query("SELECT Jahrgang FROM stud WHERE uid=\"$uid1\"");
$stud_jahr = $res->fetch_array();

$anm_schluss = $db->query("SELECT DATE_Format(anmeldeschluss, '%d.%m.%Y um %H:%i:%s Uhr')AS endeform, DATE_Format(anmeldeschluss, '%Y-%m-%d')AS enddatum 
                              FROM stan_frist
                             WHERE jahrgang=\"$stud_jahr[Jahrgang]\"");
$row_schluss = $anm_schluss->fetch_array(); // Herausfinden des Beginn- Schlussdatums

$a = strtotime ($heute_format); //Umrechnung des Fristgrenztages in eine Zahl
$b = strtotime ($row_schluss[enddatum]); // Umrechnung des Enddatums in eine Zahl


if ($a <= $b){
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>Prüfung nicht möglich</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\">Prüfung nicht möglich</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\">Prüfungen der &Auml;nderungsantr&auml;ge können erst<br><b>nach Anmeldeschluss</b><br>gemacht werden!<br>
                                       <br>Sie können bis zum $row_schluss[endeform]<br>Anträge <a href=\"antrag.php\">abgeben</a> bzw <a href=\"bearbeiten.php\">bearbeiten</a></b>
                    </p>
                    <p align=\"center\"><a href=\"hauptframe.php\">
                    <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 &Uuml;berpr&uuml;fung der Zeit&uuml;berschreitung

#################

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

switch($action){
default:

$result = $db->query("SELECT nachname, vorname, postrasse, poplz, poort, stgtext, AG, Jahrgang, mail, mail2, mtknr, stg FROM stud where uid=\"$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 prüfen Änderungsantrag</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" 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 prüfen Änderungsantrag</font><br>
                    <span class=\"sh\">Im unteren Teil können Änderungsanträge nach Prüfung abgeschickt werden!</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>
                        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\" height=\"142\">
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                <b>Persönliche Daten:</b>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">";
                                $db = dbconnect();
				$res = $db->query("SELECT nachname, vorname, poplz, poOrt, poStrasse, mail
                                                      FROM stud
                                                     WHERE uid='$uid1'");
				$stud = $res->fetch_array();
				
				if($stud[nachname] == '' or $stud[vorname] == '' or $stud[poplz] == '' or $stud[poOrt] == '' or $stud[poStrasse] == '' or $stud[mail] == ''){
				  echo "<img border=\"0\" src=\"../images/cross.jpg\">";
				}else{
				  echo "<img border=\"0\" src=\"../images/ok.gif\">";
				  
				}
				
                                echo"
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                <b>weitere Daten:</b>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">";
                                $db = dbconnect();
				$res = $db->query("SELECT stellenbezeichnung, stellenart, dzu
				                      FROM stan_stelle_einfjahr
				                     WHERE uid='$uid1'");
				$weiteredaten = $res->fetch_array();
				
				if($weiteredaten[stellenbezeichnung] == '' or $weiteredaten[stellenart] == '' or $weiteredaten[dzu] == ''){
				  echo "<img border=\"0\" src=\"../images/cross.jpg\">";
				}else{
				  echo "<img border=\"0\" src=\"../images/ok.gif\">";
				}
				
                                echo"
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                <b>Anträge:</b>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">";
                                
                                $result3 = $db->query("SELECT DATE_FORMAT(antrag_von, '%d.%m.%Y') antrag_von, DATE_FORMAT(antrag_bis, '%d.%m.%Y') antrag_bis FROM stan_frist WHERE jahrgang ='$row[Jahrgang]'");
                                $row3 = $result3->fetch_array();
				  
				$result_tmp1 = $db->query("DELETE FROM stan_tmp_check_data WHERE uid='$uid1'");
				
				
				$result_tmp1 = $db->query("INSERT INTO stan_tmp_check_data
			                                         SELECT t1.saaid
								      , t1.uid
								      , t1. beginn		
								      , t1.ende
								      , t1.ort
								   FROM stan_antrag t1
								  WHERE t1.status = (
								                     SELECT MAX(t2.status)
								                       FROM stan_antrag t2
								                      WHERE t1.aendid = t2.aendid
								                    )
                                                                    AND t1.uid = '$uid1'
                                                                    AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                                          ");
                                
                                $result = $db->query("SELECT max(saaid) max_id FROM stan_tmp_check_data WHERE uid='$uid1'");
				$row4 = $result->fetch_array();
				$saaid_neu = $row4[max_id] + 1; // Damit alle Einträge eine ID haben
				$result_tmp1 = $db->query("INSERT INTO stan_tmp_check_data SELECT $saaid_neu, '$uid1', beginn, ende, 'Praxisbegleitender Unterricht' FROM stan_sperrzeit WHERE jahrgang ='$row[Jahrgang]' AND kennung = '$row[stg]'");
				
				$result = $db->query("SELECT max(saaid) max_id FROM stan_tmp_check_data WHERE uid='$uid1'");
				$row4 = $result->fetch_array();
				$saaid_neu = $row4[max_id] + 1; // Damit alle Einträge eine ID haben
				$result_tmp1 = $db->query("INSERT INTO stan_tmp_check_data SELECT $saaid_neu, '$uid1', DATE_SUB(antrag_von, INTERVAL 1 DAY), DATE_SUB(antrag_von, INTERVAL 1 DAY), 'Antragszeitraum Beginn' FROM stan_frist WHERE jahrgang ='$row[Jahrgang]'");
				
				$result = $db->query("SELECT max(saaid) max_id FROM stan_tmp_check_data WHERE uid='$uid1'");
				$row4 = $result->fetch_array();
				$saaid_neu = $row4[max_id] + 1; // Damit alle Einträge eine ID haben
				$result_tmp1 = $db->query("INSERT INTO stan_tmp_check_data SELECT $saaid_neu, '$uid1', DATE_ADD(antrag_bis, INTERVAL 1 DAY), DATE_ADD(antrag_bis, INTERVAL 1 DAY), 'Antragszeitraum Ende' FROM stan_frist WHERE jahrgang ='$row[Jahrgang]'");
                                
                                $query = "SELECT ma.uid, DATE_FORMAT(beginn, '%d.%m.%Y') beginn, DATE_FORMAT(ende, '%d.%m.%Y') ende, bezeichnung, COALESCE( luecke, 'OK' ) AS Luecke
                                            FROM stan_tmp_check_data ma
                                            LEFT JOIN ( SELECT saaid, 'Lücke folgt' AS luecke 
                                                          FROM stan_tmp_check_data a
                                                         WHERE a.ende != (SELECT MAX( ende ) FROM stan_tmp_check_data x WHERE x.uid = a.uid)
                                                           AND NOT EXISTS ( SELECT saaid FROM stan_tmp_check_data b
                                                                             WHERE a.uid = b.uid
                                                                               AND b.beginn = DATE_ADD( a.ende, INTERVAL 1 DAY )
                                                                          )
                                                            OR ( a.beginn IN (select beginn FROM stan_tmp_check_data d WHERE d.saaid != a.saaid)
                                                                 AND a.ende  IN (select ende FROM stan_tmp_check_data e WHERE e.saaid != a.saaid AND e.uid = '$uid1')
                                                               )
                                                      ) L
                                              ON L.saaid = ma.saaid
                                           WHERE ma.uid = '$uid1'
                                           ORDER BY ma.uid, ma.beginn";

				$result = $db->query($query)
				          or die ("Cannot execute query");
				echo "<table width='100%'>";
                                while ($row2 = $result->fetch_array()){
                                echo"
                                <tr>
                                  <td width='35%'>
                                    $row2[bezeichnung]
                                  </td>
                                  <td width='35%'>";
                                    if($row2[bezeichnung] == 'Antragszeitraum Beginn'){
                                      echo"$row3[antrag_von]";
                                    }elseif($row2[bezeichnung] == 'Antragszeitraum Ende'){
				      echo"$row3[antrag_bis]";
                                    }else{
                                      echo"$row2[beginn] - $row2[ende]";
                                    }
                                    
                                    
                                    echo"
                                  </td>
                                  <td width='30%' align='center'>";
                                    if($row2[Luecke] != 'OK'){
                                      echo "<img border=\"0\" src=\"../images/leerer_zeitraum.gif\">";
                                    }else{
                                      echo "<img border=\"0\" src=\"../images/gueltig.png\">";
                                    }
                                    
                                   
                                    echo"
                                  </td>
                                </tr>
                                ";
                                }
                                $result_tmp1 = $db->query("DELETE FROM stan_tmp_check_data WHERE uid='$uid1'");
                                echo"
                                
                                </table>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 <b>Sperrfrist Auslandspraktikum eingehalten:</b><br>
                                 <font size='1'>(ggf. Ausnahmegenehmigung einholen)</font>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">";
                                #########################
                                ## Sperrfrist Auslandspraktium
                                #########################
                             
                                $db = dbconnect();
                                
                                $result = $db->query("SELECT jahrgang FROM stud where uid=\"$uid1\"");
                                $row = $result->fetch_array();
                                 
                                $result2 = $db->query("SELECT artid FROM stan_stellenart WHERE merkmal = 'A'");
                                $row2 = $result2->fetch_array();
                                
                                $result3 = $db->query("SELECT count(*) anz_ausland 
                                                          FROM stan_antrag  t1
                                                         WHERE t1.status = (
								            SELECT MAX(t2.status)
								              FROM stan_antrag t2
								             WHERE t1.aendid = t2.aendid
								            )
                                                           AND t1.uid = '$uid1' 
                                                           AND t1.art='$row2[artid]'");
                                $row3 = $result3->fetch_array();
                                
                                
                                if($row3[anz_ausland] > 0){

                                
                                $sperr_ausl = $db->query("SELECT DATE_Format(beginn, '%d') beginn_tag
                                                                , DATE_Format(beginn, '%m') beginn_mon
                                                                , DATE_Format(beginn, '%Y') beginn_jahr
                                                                , DATE_Format(ende, '%d') ende_tag
                                                                , DATE_Format(ende, '%m') ende_mon
                                                                , DATE_Format(ende, '%Y') ende_jahr
                                                           FROM stan_sperrzeit
                                                          WHERE kennung = 'A'
                                                            AND jahrgang='$row[jahrgang]'");
                                $row_sperrausl = $sperr_ausl->fetch_array(); // Sperrzeiten Ausland
                                
                                $query = "SELECT DATE_Format(t1.beginn, '%d') beg_stud_tag
                                               , DATE_Format(t1.beginn, '%m') beg_stud_mon
                                               , DATE_Format(t1.beginn, '%Y') beg_stud_jahr
                                               , DATE_Format(t1.ende, '%d') ende_stud_tag
                                               , DATE_Format(t1.ende, '%m') ende_stud_mon
                                               , DATE_Format(t1.ende, '%Y') ende_stud_jahr
                                               , t1.ort
                                            FROM stan_antrag t1
                                           WHERE t1.status = (
						              SELECT MAX(t2.status)
						                FROM stan_antrag t2
						               WHERE t1.aendid = t2.aendid
						             )
                                             AND t1.art = '$row2[artid]'
                                             AND t1.uid='$uid1'
                                             AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                         "; // Zeit des Stud im Ausland
                                         
                                $result = $db->query ($query)
                                   or die ("Cannot execute query");
                                  
                                  echo "<table>";
                                  
                                  while ($row4 = $result->fetch_array()){

                                    $begin_stud = strtotime(date("d.m.Y", mktime(0, 0, 0, $row4[beg_stud_mon], $row4[beg_stud_tag], $row4[beg_stud_jahr])));
                                    $ende_stud = strtotime(date("d.m.Y", mktime(0, 0, 0, $row4[ende_stud_mon], $row4[ende_stud_tag], $row4[ende_stud_jahr])));
                                    $begin_ausl = strtotime(date("d.m.Y", mktime(0, 0, 0, $row_sperrausl[beginn_mon], $row_sperrausl[beginn_tag], $row_sperrausl[beginn_jahr])));
                                    $ende_ausl = strtotime(date("d.m.Y", mktime(0, 0, 0, $row_sperrausl[ende_mon], $row_sperrausl[ende_tag], $row_sperrausl[ende_jahr])));

                                    if(($begin_stud >= $begin_ausl AND $begin_stud <=$ende_ausl)   // Wenns beginndatum zwischen beginn und Ende Ausl liegt
                                        OR ($ende_stud >= $begin_ausl AND $ende_stud <=$ende_ausl)  // Wenns enddatum zwischen beginn und Ende Ausl liegt
                                        OR ($begin_stud <= $begin_ausl AND $ende_stud >=$ende_ausl) // Wenns Ausl-Datum zwischen einem Zeitraum liegt
                                      ){
                                       echo "<tr>
				              <td>$row4[ort]</td>
				              <td align='center'><img border=\"0\" src=\"../images/cross.jpg\"></td>
				             </tr>
				            ";
                                    }else{
                                       echo "<tr>
				              <td>$row4[ort]</td>
				              <td align='center'><img border=\"0\" src=\"../images/ok.gif\"></td>
				             </tr>
				            ";
                                    } // Ende wenn Sperrzeitverletzung

                                  }
                                  echo "</table>";
                                }else{
                                  echo "kein Auslandsaufenthalt";
                                } // Ende wenn Ausland
                                
                                #########################
                                ## Sperrfrist Auslandspraktium Ende
                                #########################

                                 echo"
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 <b>Zeitvorgaben eingehalten:</b><br>
                                 <font size='1'>(ggf. Ausnahmegenehmigung einholen)</font>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 <table width=100%>
                                   <tr>
                                     <td width='20%'><b>Mindestdauer</b></td>
                                     <td width='20%'><b>Maximaldauer</b></td>
                                     <td width='40%'><b>Ort</b></td>
                                     <td width='20%'><b>Status</b></td>
                                   </tr>";
                                     
                                     $query = "SELECT t1.ort, t1.art, t1.sachbereich, date_format(t1.beginn, '%d') beg_tag
                                                      , date_format(t1.beginn, '%m') beg_mon , date_format(t1.beginn, '%Y') beg_jahr
                                                      , date_format(t1.ende, '%d') ende_tag, date_format(t1.ende, '%m') ende_mon
                                                      , date_format(t1.ende, '%Y') ende_jahr, date_format(t1.beginn, '%Y%m%d') beginnform
                                                 FROM stan_antrag t1
                                                WHERE t1.status = (
						              SELECT MAX(t2.status)
						                FROM stan_antrag t2
						               WHERE t1.aendid = t2.aendid
						             )
                                                  AND t1.uid='$uid1'
                                                  AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                                  ORDER BY beginnform ASC
                                              "; // Zeit des Stud im Ausland
                                         
                                     $result = $db->query ($query)
                                                            or die ("Cannot execute query");
                                     
                                     while ($row5 = $result->fetch_array()){
                                       $result2 = $db->query("SELECT artid FROM stan_stellenart WHERE merkmal = 'A'");
                                       $row2 = $result2->fetch_array();
                                       
                                       $result2a = $db->query("SELECT max_mon FROM stan_stellenbereiche WHERE sbid = '$row5[sachbereich]'");
                                       $row2a = $result2a->fetch_array();
                                     
                                       if($row2[artid] != $row5[art]){ 
                                        $max_mon = "$row2a[max_mon]"; 
                                       } else { 
                                        $max_mon = "3";   // bei Ausland max. 3 Monate
                                       }
                                       
                                       
                                       $ende_min = date("d.m.Y", mktime(0, 0, 0, $row5[beg_mon]+2, $row5[beg_tag]-1, $row5[beg_jahr]));
				       $ende_max = date("d.m.Y", mktime(0, 0, 0, $row5[beg_mon]+$max_mon, $row5[beg_tag]-1, $row5[beg_jahr]));
				       $ende_min_zahl = strtotime($ende_min);
				       $ende_max_zahl = strtotime($ende_max);
				       $ende_stud = strtotime(date("d.m.Y", mktime(0, 0, 0, $row5[ende_mon], $row5[ende_tag], $row5[ende_jahr])));
				       
				       $img = "<img border=\"0\" src=\"../images/ok.gif\">"; // Standard, wenn alles OK
				       $text = "";
				       
				       if($ende_stud < $ende_min_zahl){
				         $img = "<img border=\"0\" src=\"../images/cross.jpg\">";
				         $text = "Mind. bis: $ende_min";
				       }
				       
				       if($ende_stud > $ende_max_zahl){
				         $img = "<img border=\"0\" src=\"../images/cross.jpg\">";
				         $text = "Max. bis: $ende_max";				       
				       }
                                       
                                     echo"<tr>
                                            <td width='20%'>2 Mon.</td>
                                            <td width='20%'>$max_mon Mon.</td>
                                            <td width='40%'>$row5[ort]</td>
                                            <td width='20%'><nobr>$img $text</nobr></td>
                                          </tr>
                                         ";
                                     
                                     }
                                 echo"
                                 </table>
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                <b>Einverständnisse<br>der Dienststellen liegt vor:</b><br>
                                <font size='1'>(Bei Auslandsstellen nicht erforderlich)</font>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                <table>
                                ";
                                $db = dbconnect();
				
#				$res = $db->query("SELECT Jahrgang FROM stud WHERE uid='$uid1'");
#				$stud_jahr = $res->fetch_array();
			        
			        $res = $db->query("SELECT artid FROM `stan_stellenart` 
                                                     WHERE merkmal = 'A'");
                                $ausland = $res->fetch_array();      


				
				$query = "SELECT t1.saaid,
                                                 t1.einver_dsts,
                                                 t1.ort,
                                                 t1.uid
                                            FROM stan_antrag t1
                                           WHERE t1.status = (
                                                              SELECT MAX(t2.status)
                                                                FROM stan_antrag t2
                                                               WHERE t1.aendid = t2.aendid
                                                              )
                                             AND t1.uid = '$uid1'
                                             AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                           ORDER BY t1.beginn ASC
				         ";
				
				$result = $db->query($query)
				          or die ("Cannot execute query");
				
                                while ($row2 = $result->fetch_array()){
                                 
                                 #if($row2[art] != $ausland[artid]){  ## Einverständniserklärung vom Ausland ist nicht notwendig
				  if($row2[einver_dsts] == 'N'){
				    echo "<tr>
				            <td>$row2[ort]</td>
				            <td align='center'><img border=\"0\" src=\"../images/cross.jpg\"></td>
				          </tr>";
				  }else{
				    echo "<tr>
				            <td>$row2[ort]</td>
				            <td align='center'><img border=\"0\" src=\"../images/ok.gif\"></td>
				          </tr>";
				  }
				 #}
				}
				
                                echo"
                                
                                
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                <b>Wurden mind. 3 Sachbereiche abgedeckt?</b>
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">";
                                $db = dbconnect();
                                
                                
				$res_anz = $db->query("SELECT count(distinct t1.sachbereich) Anzahl
                                                          FROM stan_antrag t1
                                                         WHERE t1.status = (
                                                                            SELECT MAX(t2.status)
                                                                              FROM stan_antrag t2
                                                                             WHERE t1.aendid = t2.aendid
                                                                           )
                                                           AND t1.uid = '$uid1'
                                                           AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                                      ");
				$anzahl_bereich = $res_anz->fetch_array();
				
				if($anzahl_bereich[Anzahl] < 3){
				  echo "<img border=\"0\" src=\"../images/cross.jpg\"> ($anzahl_bereich[Anzahl] von 3 notwendigen Sachbereichen wurden abgedeckt)"; 
				  echo "<p>";
				  $query3 = "SELECT t1.sachbereich
				                  , t1.ort
				                  , date_format(t1.beginn, '%Y%m%d') beginnform
                                               FROM stan_antrag t1
                                              WHERE t1.status = (
                                                                 SELECT MAX(t2.status)
                                                                   FROM stan_antrag t2
                                                                  WHERE t1.aendid = t2.aendid
                                                                )
                                                AND t1.uid = '$uid1'
                                                AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                              ORDER BY beginnform ASC
				             ";
				           
				  $result3 = $db->query($query3)
				            or die ("Cannot execute query3");
				  echo "<table><tr><td><b>Sachbereich</b></td><td><b>Praxisstelle</b></td></tr>";
                                  while ($row5 = $result3->fetch_array()){
			            $res_bez = $db->query("SELECT bezeichnung
			                                      FROM `stan_stellenbereiche` 
                                                             WHERE sbid = '$row5[sachbereich]'");
                                    $stell_bez = $res_bez->fetch_array();
                                    echo "<tr><td>$stell_bez[bezeichnung]</td><td>$row5[ort]</td></tr>";
                                  }
                                  echo "</table>";
				  
				}else{
				  echo "<img border=\"0\" src=\"../images/ok.gif\">";
				}
				
                                echo"
                                </td>
                            </tr>
                            </tr>
                            
                            
                            
                            </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>
            <br>
            
        </div>
        </td>
    </tr>
</table>
<br>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" 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\">zu sendende Änderungsanträge</font><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>";
                         $query = "SELECT t1.saaid
                                        , t1.sachbereich
                                        , t1.ort
                                        , DATE_Format(t1.beginn, '%d.%m.%Y') beginn
                                        , DATE_Format(t1.ende, '%d.%m.%Y') ende
                                        , DATE_FORMAT(t1.beginn, '%Y%m%d') beginnform
                                     FROM stan_antrag t1
                                     WHERE t1.status = (
                                                        SELECT MAX(t2.status)
                                                          FROM stan_antrag t2
                                                         WHERE t1.aendid = t2.aendid
                                                        )
                                      AND t1.uid = '$uid1'
                                      AND t1.status = '2'
                                      AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
                                    ORDER BY beginnform ASC
                                  ";
                                  
                         $result = $db->query ($query)
                       or die ("Cannot execute query");
                    
                    echo"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\">
                                                <tr>
		                                    <td style=\"border-style: none; border-width: medium\" height=\"32\">
		                                     <b>Stellenart</b>
		                                    </td>
		                                    <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
		                                     <b>Ort</b>
		                                    </td>
		                                    <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
		                                     <b>Zeitraum</b>
		                                    </td>
		                                    <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
		                                     <b>Löschen</b>
		                                    </td>
		                                </tr>";

                    
                    while ($row3 = $result->fetch_array()){
                      $res = $db->query("SELECT bezeichnung FROM stan_stellenbereiche WHERE sbid='$row3[sachbereich]'");
                      $stell_ber = $res->fetch_array();
                            echo"
                            <tr>
                                <td style=\"border-style: none; border-width: medium\" height=\"32\">
                                 $stell_ber[bezeichnung]
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 $row3[ort]
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                 $row3[beginn] - $row3[ende]
                                </td>
                                <td align=\"left\" style=\"border-style: none; border-width: medium\" height=\"32\">
                                  <a href=".$_SERVER['PHP_SELF'] ."?action=del&ID=$row3[saaid]>
                                       <img title = \"Antrag l&ouml;schen\"border=\"0\" src=\"../images/drop.png\"></a>
                                </td>
                            </tr>";
                        }

                        echo"</table>";
                        require("func_check_aend.php");
			$test = check($uid1);
                        
			$res_aend = $db->query("SELECT count(*) anz_aend
			                          FROM stan_antrag 
                                                 WHERE uid = '$uid1'
                                                   AND status = '2'
                                               ");
                        $anz_aend = $res_aend->fetch_array();
                        # Elsif rein: wenn $test AND $anz_aend[anz_aend] > 0
                        #             elseif anzahl 0 --> nachricht: Keine Änderungsaufträge vorhanden
                        #             else Fehler korrigieren
                        if($test AND $anz_aend[anz_aend] > 0){ // Wenn alle Eintragungen stimmen und nicht verschickte Änderungsanträge vorhanden sind, dann Abschickenbutton anzeigen
			  echo "<p align='center'><a href=".$_SERVER['PHP_SELF'] ."?action=aenderung><img src='../images/aenderung_stellen.png' border='0'></a></p>";
			}elseif($anz_aend[anz_aend] == 0){
			  echo "<p align='center'><img src='../images/keine_aenderung.png' border='0'></p>";
			}else{
			  echo "<p align='center'><img src='../images/daten_pruefen.png' border='0'></p>";
			}
                       
                       echo "
                    </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>
            <br>
            
        </div>
        </td>
    </tr>
</table>
</body>
</html>
";

break;
case "aenderung":

$query = "SELECT t1.aendid
            FROM stan_antrag t1
           WHERE t1.status = (
                              SELECT MAX(t2.status)
                                FROM stan_antrag t2
                               WHERE t1.aendid = t2.aendid
                             )
             AND t1.uid = '$uid1'
             AND t1.status = '2'
         ";
         
$result = $db->query ($query)
   or die ("Cannot execute query");


while ($row3 = $result->fetch_array()){
$sql = $db->query ("DELETE FROM stan_antrag
                      WHERE status='1'
                        AND aendid = '$row3[aendid]'
                   ");
}

$aend_dat = $datum=date("Y-m-d H:i:s");

$sql = $db->query ("UPDATE stan_antrag 
                        SET status='1'
                           ,aend_dat = '$aend_dat'
                      WHERE status='2'
                        AND uid = '$uid1'
                   ");



if ($sql){
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>Änderungsantrag gestellt!</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\">Änderungsantrag gestellt!</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\">Der Änderungsantrag wurde gestellt<br>
                                        und der Sachbearbeiter wurde informiert.<br>
                                        Sie können den Status unter Punkt <a href=\"status_aend.php\">3. Status</a> einsehen
                    </p>
                    <p align=\"center\"><a href=\"hauptframe.php\">
                    <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>";



  $result2 = $db->query("SELECT mtknr, vorname, nachname FROM stud WHERE uid='$uid1'");
  $row2 = $result2->fetch_array();
  
  $result3 = $db->query("SELECT wert1, wert2 FROM parameter WHERE pid=4");
  $row3 = $result3->fetch_array();

  $empfaenger = "$row3[wert2]";
  $betreff = "$row3[wert1]";
  $text = "
    <html>
    <head>
    <title>&Auml;nderungsantrag</title>
    </head>
    <body>
    <font face='Arial' size='2'>
      Guten Tag!<br><br>
      Im Stellenantragssystem wurde 
      ein &Auml;nderungsantrag gestellt:<br><br>
    </font>
    <br>
    <table>
      <tr>
		<td width='60%' style='border-style: none; border-width: medium' height='32'>
		  <font face='Arial' size='2'><b>Name:</b></font>
		</td>
		<td width='40%' align='left' style='border-style: none; border-width: medium' height='32'>
		  <font face='Arial' size='2'>$row2[vorname] $row2[nachname]</font>
		</td>
	</tr>
	<tr>
		<td width='60%' style='border-style: none; border-width: medium' height='32'>
		  <font face='Arial' size='2'><b>Matrikelnr:</b></font>
		</td>
		<td width='40%' align='left' style='border-style: none; border-width: medium' height='32'>
		  <font face='Arial' size='2'>$row2[mtknr]</font>
		</td>
	</tr>
    </table>
    <br><br>
    <font face='Arial' size='2'>
    Diese Mail wurde automatisch generiert!<br>
    Antworten Sie daher nicht auf diese Mail<br>
    <br>
    Vielen Dank
    </font>
    </body>
    </html>";



    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=utf-8\r\n";


    $return = @mail($empfaenger, $betreff, $text,  $headers);
    
}else{
echo "INTERNER FEHLER: GGF NEUER VERSUCH";
}


break;
Case "del":

$staID = $_GET['ID'];
setcookie("ck_staID","");
setcookie("ck_staID",$staID);


$res = $db->query("SELECT ort FROM stan_antrag WHERE saaid='$staID'");
$row = $res->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>Datensatz l&ouml;schen</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=\"70%\" 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\">Datensatz l&ouml;schen</font><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>
                    <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\" id=\"AutoNumber1\">
                    <tr>
                      <td width=\"100%\">
                        <p align=\"center\">
                        M&ouml;chten sie den Antrag<br><b>$row[ort]</b><br>wirklich löschen?<br><br>
                            <a href=".$_SERVER['PHP_SELF'] ."?action=del3>
	                    <img title = \"Abbrechen\"border=\"0\" src=\"../images/nein.gif\"></a>
	                     &nbsp;
                            <a href=".$_SERVER['PHP_SELF'] ."?action=del2>
	                    <img title = \"Antrag l&ouml;schen\"border=\"0\" src=\"../images/ja.gif\"></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\">
                    <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 "del2":

$saaid = $_COOKIE['ck_staID'];


$sql = $db->query ("DELETE FROM stan_antrag WHERE saaid='$saaid'");

if ($sql)  // Best&auml;tigungsseite bei Erfolg sonst Nichterfolgsmeldung
  {
    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>Datensatz gelöscht</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\">Datensatz gelöscht</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>Der Datensatz wurde gelöscht!</b>
                      </p>
                      <p align=\"center\"><a href=\"hauptframe.php\">
                      <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>";
  }else{
    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>unerwarteter Fehler</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\">unerwarteter Fehler</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 ist ein interner Fehler aufgetreten!<br>
                      Wenden Sie sich bitte umgehend an
                      <a href=\"mailto:$_POST[helpmail]?subject=Fehler bei der Antragsbearbeitung im Stellenatragssystem\">$_POST[ansprechpart]</a></b>
                      </p>
                      <p align=\"center\"><a href=\"hauptframe.php\">
                      <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>";
  }

break;
case "del3":

$Link = basename($_SERVER['PHP_SELF']);
echo "
  <meta http-equiv=\"refresh\" content=\"0; URL=$Link\">
";
   
}
?>