Fragebogen/admin_del.php
2024-02-21 13:18:33 +01:00

381 lines
17 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_admindel'");
$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>>Adminrechte lö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=\"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\">Adminrechte 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=rechte1"; echo" method=\"POST\" name=\"beleg\">
<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
FROM kurs.stud a
WHERE a.durchgefallen != 'Y'
AND a.uid IN (SELECT DISTINCT uid FROM aesp_admin_rechte_zuord b)
ORDER BY 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 (isset($row['durchgefallen']) AND $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=\"Abschicken\" 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 "rechte1":
if(isset($_POST['stud_uid'])){
$deluid = $_POST['stud_uid'];
}else{
echo "<meta http-equiv=\"refresh\" content=\"0; URL=?\">";
exit;
}
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\">Adminrechte 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 die Adminrechte 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 = \"Adminrechte 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_admin_rechte_zuord WHERE uid = '$deluid'");
if (!$sql1)
{
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>Die Adminrechte konnten 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\">Löschung erfolgreich</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 Adminrechte 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
?>