bewertung/bewertung.php
2023-04-25 13:09:11 +02:00

468 lines
20 KiB
PHP
Executable File

<?php
$doz_uid1=$_COOKIE["doz_uid1"];
if ($doz_uid1 == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
$lfdnr = $_GET["nr"];
include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
switch($action){
default:
setcookie("ck_lfdnr", "");
setcookie("ck_lfdnr", $lfdnr);
if ($lfdnr == 1){
$titel = "1. Hauptwunsch";
}
if ($lfdnr == 2){
$titel = "2. Hauptwunsch";
}
if ($lfdnr == 3){
$titel = "1. Ersatzwunsch";
}
if ($lfdnr == 4){
$titel = "2. Ersatzwunsch";
}
$db = dbconnect();
$result2 = $db->query("SELECT lv_name
, lv_ort
, studiengang
, ag
, jahrgang
, lv_art
, teilnehmer
FROM bew_wunsch
WHERE doz_uid='$doz_uid1'
AND lfd_nr = '$lfdnr'");
$row3 = $result2->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>Administrator anlegen</title>
<!--
<style type='text/css'>
select{
width:500px;
}
-->
</style>
</head>
<body onload=\"if(document.bewertung)document.bewertung.vorlesung.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\">$titel</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=bew"; echo" method=\"POST\" name=\"bewertung\">
<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse; border-width: 0\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\" height=\"194\">
<tr>
<td width=\"40%\">
<b>Vorlesungsname*:</b>
</td>
<td width=\"60%\">";
$query = "SELECT vlid, bezeichnung FROM bew_vorlesungen ORDER BY bezeichnung";
$result = $db->query ($query)
or die ("Cannot execute query");
echo "<select size=\"8\" name=\"vorlesung\">";
while ($row = $result->fetch_array()){
echo "<option value='$row[vlid]'"; if($row3[lv_name] == $row[vlid]){echo " selected"; } echo">".$row['bezeichnung']."&nbsp;&nbsp;&nbsp;</option>\n";
}
echo "</select>";
echo"
</td>
</tr>
<!--
<tr>
<td width=\"40%\">
<b>Vorlesungsort:</b>
</td>
<td width=\"60%\">
<input type=\"text\" name=\"ort\" value='$row3[lv_ort]' size=\"80\">
</td>
</tr>
-->
<tr>
<td width=\"40%\">
<b>Studiengang:</b>
</td>
<td width=\"60%\">
<select size=\"6\" name=\"stg\">";
$query = "SELECT kurzel, bezeichnung FROM bew_studiengang ORDER BY bezeichnung";
$result = $db->query ($query)
or die ("Cannot execute query");
while ($row = $result->fetch_array()){
echo"<option value='$row[kurzel]'"; if($row3[studiengang] == $row[kurzel]){ echo " selected"; } echo">$row[bezeichnung]</option>";
}
echo"
</select>
</td>
</tr>
<tr>
<td width=\"40%\">
<b>AG:</b>
</td>
<td width=\"60%\">";
$db = dbconnect();
$query1 = "SELECT distinct UPPER(ag) ag
FROM stud
ORDER BY ag ASC
";
$result1 = $db->query ($query1)
or die ("Cannot execute query");
echo "<select size=\"1\" name=\"ag\">";
while ($row1 = $result1->fetch_array()){
echo "<option value='$row1[ag]' "; if($row3[ag] == $row1[ag]){echo " selected"; } echo">$row1[ag]</option>\n";
}
echo "</select>";
$query2 = "SELECT distinct UPPER(jahrgang) jahrgang
FROM stud
WHERE jahrgang <'99'
ORDER BY jahrgang DESC
";
$result2 = $db->query ($query2)
or die ("Cannot execute query");
echo " / ";
echo "<select size=\"1\" name=\"jahrgang\">";
while ($row2 = $result2->fetch_array()){
echo "<option value='$row2[jahrgang]'"; if($row3[jahrgang] == $row2[jahrgang]){echo " selected"; } echo">$row2[jahrgang]</option>\n";
}
echo "</select>
</td>
</tr>
<tr>
<td width=\"40%\">
<b>Vorlesungsart:</b>
</td>
<td width=\"60%\">
<select size=\"5\" name=\"art\">";
$query = "SELECT aid, bezeichnung FROM bew_art ORDER BY bezeichnung";
$result = $db->query ($query)
or die ("Cannot execute query");
while ($row = $result->fetch_array()){
echo"<option value='$row[aid]'"; if($row3[lv_art] == $row[aid]){echo " selected"; } echo">$row[bezeichnung]</option>";
}
echo"
</select>
</td>
</tr
<tr>
<td width=\"40%\">
<b>Anzahl der Teilnehmer:</b>
</td>
<td width=\"60%\">
<input type=\"text\" name=\"anz\" value='$row3[teilnehmer]' size=\"13\">
</td>
</tr
<tr>
<td width=\"40%\">
* = Pflichtfelder
</td>
<td width=\"60%\">
&nbsp;
</td>
</tr>
</table>
<br>
<br>
<input type=\"submit\" value=\"Abschicken\" name=\"B1\">
<input type=\"reset\" value=\"Zur&uuml;cksetzen\" name=\"B2\">
</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 "bew":
$db = dbconnect();
$lfdnr = $_COOKIE["ck_lfdnr"];
if ($_POST[vorlesung] == ""){ // Fehler, falls Pflichtfelder unausgef&uuml;llt
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Eingabefehler</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Eingabefehler</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Es m&uuml;ssen mindestens die Pflichtfelder ausgef&uuml;llt werden!</b>
</p>
<p align=\"center\"><a href=\"javascript:history.back()\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>";
exit;
}
$result2 = $db->query("SELECT 1
FROM bew_wunsch
WHERE doz_uid='$doz_uid1'
AND lfd_nr = '$lfdnr'");
$row3 = $result2->fetch_array();
$heute = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")); // heutiges Datum & Zeit: https://de2.php.net/manual/de/function.date.php
$heuteformat = date("Y-m-d H:i:s", $heute); // Formatierung, wie es vor dem Dateinamen erscheinen soll
if($row3[0] != 1){
$sql = $db->query("INSERT INTO bew_wunsch ( doz_uid
, lv_name
, studiengang
, ag
, jahrgang
, lv_art
, teilnehmer
, lfd_nr
, datum
)
VALUES
( '$doz_uid1'
, '$_POST[vorlesung]'
, '$_POST[stg]'
, '$_POST[ag]'
, '$_POST[jahrgang]'
, '$_POST[art]'
, '$_POST[anz]'
, '$lfdnr'
, '$heuteformat'
)
");
}else{
$sql = $db->query("UPDATE bew_wunsch
SET doz_uid = '$doz_uid1'
, lv_name = '$_POST[vorlesung]'
, studiengang = '$_POST[stg]'
, ag = '$_POST[ag]'
, jahrgang = '$_POST[jahrgang]'
, lv_art = '$_POST[art]'
, teilnehmer = '$_POST[anz]'
, lfd_nr = '$lfdnr'
, datum = '$heuteformat'
WHERE doz_uid='$doz_uid1'
AND lfd_nr = '$lfdnr'
");
}
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>Einbindung</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\">Einbindung</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 Bewertungswunsch wurde abgegeben!
</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>Einbindung 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\">Einbindung 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 Administrator wurde nicht eingebunden!<br>Es trat ein interner Fehler auf!</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>";
}
}
?>