127 lines
5.1 KiB
PHP
127 lines
5.1 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>
|
|
<?php print("<meta http-equiv='refresh' content='1; URL=../$redirect'>"); ?>
|
|
<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'>");
|
|
}
|
|
|
|
if($type == 'year') {
|
|
|
|
$Name = strip_tags(htmlentities($_POST["Name"]));
|
|
$Name = str_replace('\'', ''', $Name);
|
|
$Name = str_replace('\\', '\', $Name);
|
|
|
|
if(empty($Name)) {
|
|
$_SESSION["errorCode"] = 'generalError';
|
|
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item'>");
|
|
}
|
|
else {
|
|
$generiert = '';
|
|
$string = "0123456789ABCDEFGHJIKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
for ($i = 1; $i <= 8; $i++)
|
|
{
|
|
$zufallszahl = rand(0, 62);
|
|
$zufallszahl = substr($string, $zufallszahl, 1);
|
|
$generiert = $generiert . $zufallszahl;
|
|
}
|
|
$conn->query("INSERT INTO `VokabelBoxNoten` (`Titel`,`ID`,`Nutzername`) VALUES ('$Name','$generiert','$Benutzername')");
|
|
$_SESSION["errorCode"] = 'createYearSuccess';
|
|
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$generiert:1'");
|
|
}
|
|
}
|
|
|
|
if($type == 'subject') {
|
|
|
|
$Name = strip_tags(htmlentities($_POST["Name"]));
|
|
$Name = str_replace('\'', ''', $Name);
|
|
$Name = str_replace('\\', '\', $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 {
|
|
$generiert = '';
|
|
$string = "0123456789ABCDEFGHJIKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
for ($i = 1; $i <= 8; $i++)
|
|
{
|
|
$zufallszahl = rand(0, 62);
|
|
$zufallszahl = substr($string, $zufallszahl, 1);
|
|
$generiert = $generiert . $zufallszahl;
|
|
}
|
|
$conn->query("INSERT INTO `VokabelBoxNoten` (`Note`,`Fach`,`ID`,`Nutzername`,`Farbe`) VALUES ('-','$Name','$item-$generiert','$Benutzername','$Color')");
|
|
$_SESSION["errorCode"] = 'createSubjectSuccess';
|
|
print("<meta http-equiv='refresh' content='0; URL=../marks?item=$item-$generiert'");
|
|
}
|
|
}
|
|
|
|
if($type == 'entry') {
|
|
|
|
$Name = strip_tags(htmlentities($_POST["Name"]));
|
|
$Name = str_replace('\'', ''', $Name);
|
|
$Name = str_replace('\\', '\', $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 {
|
|
$generiert = '';
|
|
$string = "0123456789ABCDEFGHJIKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
for ($i = 1; $i <= 8; $i++)
|
|
{
|
|
$zufallszahl = rand(0, 62);
|
|
$zufallszahl = substr($string, $zufallszahl, 1);
|
|
$generiert = $generiert . $zufallszahl;
|
|
}
|
|
$ID = $item . '_' . $generiert;
|
|
$conn->query("INSERT INTO `VokabelBoxNoten` (`Titel`,`Note`,`ID`,`Bezeichnung`,`Nutzername`,`Datum`) VALUES ('$Name','$Mark','$ID','$Type','$Benutzername','$Date')");
|
|
$_SESSION["errorCode"] = 'createEntrySuccess';
|
|
?>
|
|
<meta http-equiv='refresh' content='0; URL=../marks?item=<?php print("$item"); ?>_<?php print("$generiert"); ?>'>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|