Files
vokspace/actions/edit-item.php
2026-01-02 21:00:45 +01:00

102 lines
4.0 KiB
PHP

<?php session_start();
$Benutzername = $_SESSION["Benutzername"];
$Passwort = $_SESSION["Passwort"];
$_SESSION["Benutzername"] = $Benutzername;
$_SESSION["Passwort"] = $Passwort;
$type = $_SESSION["type"];
$item = $_SESSION["item"];
unset($_SESSION["type"]);
unset($_SESSION["item"]);
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../files/style.css" />
</head>
<body>
<?php
require "../files/ezine_db.inc.php";
include "../files/loginscript.inc.php";
include "../files/errorcodesscript.inc.php";
if($LoggedIn == 'true') {
if($type != 'year' && $type != 'subject' && $type != 'entry' || empty($Benutzername) || empty($item)) {
$_SESSION["errorCode"] = 'generalError';
print("<meta http-equiv='refresh' content='0; URL=../marks?item='>");
}
if($type == 'year') {
$Name = strip_tags(htmlentities($_POST["Name"]));
$Name = str_replace('\'', '&apos;', $Name);
$Name = str_replace('\\', '&#92;', $Name);
$item = strstr($item, ':', true);
if(empty($Name)) {
$_SESSION["errorCode"] = 'generalError';
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item'>");
}
else {
$conn->query("UPDATE `VokabelBoxNoten` SET `Titel` = '$Name' WHERE `ID` = '$item'");
$_SESSION["errorCode"] = 'editFolderSuccess';
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item:1'");
}
}
if($type == 'subject') {
$Name = strip_tags(htmlentities($_POST["Name"]));
$Name = str_replace('\'', '&apos;', $Name);
$Name = str_replace('\\', '&#92;', $Name);
$Color = strip_tags(htmlentities($_POST["color"]));
if(empty($Name) || ($Color != 'FF5E5E' && $Color != 'FF9D5E' && $Color != 'FFBB5E' && $Color != 'FFDF5E' && $Color != 'FFFA5E' && $Color != 'EBFF5E' && $Color != 'CCFF5E' && $Color != 'A5FF5E' && $Color != '87FF5E' && $Color != '5EFF5E' && $Color != '5EFFB1' && $Color != '5EFFD6' && $Color != '5EE2FF' && $Color != '5EC7FF' && $Color != '5EA5FF' && $Color != '5E83FF' && $Color != '795EFF' && $Color != 'A55EFF' && $Color != 'D85EFF' && $Color != 'FF5EFA' && $Color != 'FF5ED6' && $Color != 'FF5EB8' && $Color != 'FF5E8F' && $Color != 'FF5E79')) {
$_SESSION["errorCode"] = 'generalError';
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item'>");
}
else {
$conn->query("UPDATE `VokabelBoxNoten` SET `Farbe` = '$Color', `Fach` = '$Name' WHERE `ID` = '$item'");
$_SESSION["errorCode"] = 'editFolderSuccess';
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item'");
}
}
if($type == 'entry') {
$Name = strip_tags(htmlentities($_POST["Name"]));
$Name = str_replace('\'', '&apos;', $Name);
$Name = str_replace('\\', '&#92;', $Name);
$Type = strip_tags(htmlentities($_POST["type"]));
$Mark = strip_tags(htmlentities($_POST["mark"]));
$Date = strip_tags(htmlentities($_POST["date"]));
$Date = date("d.m.Y", strtotime($Date));
if(empty($Name) || empty($Type) || ($Type != '1' && $Type != '2' && $Type != '3' && $Type != '4') || empty($Mark) || ($Mark != '1' && $Mark != '1.3' && $Mark != '1.7' && $Mark != '2' && $Mark != '2.3' && $Mark != '2.7' && $Mark != '3' && $Mark != '3.3' && $Mark != '3.7' && $Mark != '4' && $Mark != '4.3' && $Mark != '4.7' && $Mark != '5' && $Mark != '5.3' && $Mark != '5.7' && $Mark != '6')) {
$_SESSION["errorCode"] = 'generalError';
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item'>");
}
else {
$conn->query("UPDATE `VokabelBoxNoten` SET `Titel` = '$Name',`Note` = '$Mark',`Bezeichnung` = '$Type',`Datum` = '$Date' WHERE `ID` = '$item'");
$_SESSION["errorCode"] = 'editFolderSuccess';
?>
<meta http-equiv='refresh' content='0; URL=../marks?item=<?php print("$item"); ?>'>
<?php
}
}
}
?>
</body>
</html>