Fragebogen/fragebogen_del.php
2024-01-22 10:09:24 +01:00

381 lines
18 KiB
PHP
Executable File

<?php
$uid=$_COOKIE["uid1"];
include("aespa/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
// Rechte&uuml;berpr&uuml;fung
$db = dbconnect();
$result = $db->query("SELECT 1 FROM aesp_admin_rechte_zuord WHERE uid = '$uid' AND aesp_admin_rolle = 'a_fragedel'");
$row = $result->fetch_array();
if ($row[0] != 1){ include("aespa/rechte.php"); exit;}
// Rechte&uuml;berpr&uuml;fung ende// Rechte&uuml;berpr&uuml;fung ende
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
switch($action){
default:
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>>Student bearbeiten</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_top.gif\" valign=\"top\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<font class=\"hd\">Fragebogen lö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>
<form action="; echo $_SERVER['PHP_SELF'] . "?action=del1"; echo" method=\"POST\" name=\"del1\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-width: 0\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\" height=\"115\">
<tr>
<td width=\"25%\">
</td>
<td width=\"25%\">&nbsp;</td>
<td width=\"25%\">
<p>&nbsp;
</td>
<td width=\"25%\">
<p>
</td>
</tr>
<tr>
<td width=\"25%\">
<p>
</td>
<td width=\"50%\"colspan=\"2\">&nbsp;</td>
<td width=\"25%\">
<p>
</td>
</tr>
<tr>
<td width=\"25%\">
<p>
</td>
<td width=\"50%\" colspan=\"2\">
<p align=\"center\">
";
$db = dbconnect();
$query = "SELECT a.uid, a.nachname, a.vorname, a.ag, a.jahrgang, a.durchgefallen
FROM kurs.stud a, aespa.aesp_pers_ang b
WHERE a.durchgefallen != 'Y'
AND a.uid = b.uid
ORDER BY a.nachname";
$result = $db->query ($query)
or die ("Cannot execute query");
echo "<select size=\"20\" name=\"stud_uid\">";
while ($row = $result->fetch_array()){
echo "
<option value=\"".$row[0]."\">$row[nachname], &nbsp;$row[vorname] ($row[ag]/$row[jahrgang])
";
IF ($row['durchgefallen'] == "Y")
echo " *"; ## kann nicht passieren, durch select :-)
echo "
&nbsp;&nbsp;</option>\n";
}
echo "</select>
</td>
<td width=\"25%\">
<p>
</td>
</tr>
<tr>
<td width=\"25%\">
<p>
</td>
<td width=\"50%\" colspan=\"2\" align=\"center\">
&nbsp;</td>
<td width=\"25%\">
<p>
</td>
</tr>
<tr>
<td width=\"25%\">
</td>
<td width=\"50%\" colspan=\"2\" align=\"center\">
<input type=\"submit\" value=\"Löschen\" name=\"B1\"></td>
<td width=\"25%\">
</td>
</tr>
<tr>
<td width=\"25%\">
</td>
<td width=\"50%\" colspan=\"2\" align=\"center\">
&nbsp;</td>
<td width=\"25%\">
</td>
</tr> <tr>
<td width=\"25%\">
</td>
<td width=\"50%\" colspan=\"2\" align=\"center\">
</td>
<td width=\"25%\">
</td>
</tr>
<tr>
<td width=\"25%\">
</td>
<td width=\"50%\" colspan=\"2\" align=\"center\">&nbsp;</td>
<td width=\"25%\">
</td>
</tr>
</table>
</form>
</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 "del1":
$deluid = $_POST['stud_uid'];
setcookie("ck_studuid", "");
setcookie("ck_studuid", $deluid);
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>Zugeordnete Studenten</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\">Fragebogen wirklich lö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>
";
$db = dbconnect();
$query = "SELECT vorname, nachname, ag, jahrgang
FROM kurs.stud
WHERE uid = '$deluid'
";
$result = $db->query($query)
or die ("Cannot execute query");
$row2 = $result->fetch_array();
echo"
<p>
<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 Fragebogen von <br><b>$row2[vorname] $row2[nachname] ($row2[ag]/$row2[jahrgang])</b><br> wirklich l&ouml;schen?<br><br>
<a href=".$_SERVER['PHP_SELF'] .">
<img title = \"Nein\"border=\"0\" src=\"images/nein.gif\"></a>
&nbsp;
<a href=".$_SERVER['PHP_SELF'] ."?action=del2>
<img title = \"Fragebogen 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":
$deluid = $_COOKIE["ck_studuid"];
$sql1 = $db->query ("DELETE FROM aesp_schluss WHERE uid = '$deluid'");
$sql2 = $db->query ("DELETE FROM aesp_freizeit WHERE uid = '$deluid'");
$sql3 = $db->query ("DELETE FROM aesp_bewertung WHERE uid = '$deluid'");
$sql4 = $db->query ("DELETE FROM aesp_unterkunft WHERE uid = '$deluid'");
$sql5 = $db->query ("DELETE FROM aesp_allgemein WHERE uid = '$deluid'");
$sql6 = $db->query ("DELETE FROM aesp_bewerbung WHERE uid = '$deluid'");
$sql7 = $db->query ("DELETE FROM aesp_pers_ang WHERE uid = '$deluid'");
if (!$sql1 or !$sql2 or !$sql3 or !$sql4 or !$sql5 or !$sql6 or !$sql7)
{
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>Fehlgeschlagen</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\">Fehlgeschlagen</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 Fragebogen konnte aufgrund eines<br>internen Fehlers nicht vollst&auml;dig gel&ouml;scht werden!</b>
<br><br>
<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><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;
}
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>Aktualisierung beendet</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\">Aktualisierung beendet</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 Fragebogen wurde gel&ouml;scht!</b>
<br><br>
<p align=\"center\"><a href="; echo $_SERVER['PHP_SELF'] . ">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</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>";
} //Ende Action Abfrage
?>