Initial commit
This commit is contained in:
109
actions/add-vokab.php
Normal file
109
actions/add-vokab.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php session_start();
|
||||
|
||||
$Benutzername = $_SESSION["Benutzername"];
|
||||
$Passwort = $_SESSION["Passwort"];
|
||||
|
||||
$_SESSION["Benutzername"] = $Benutzername;
|
||||
$_SESSION["Passwort"] = $Passwort;
|
||||
|
||||
$redirect = $_SESSION["redirect"];
|
||||
$parameter = $_SESSION["parameter"];
|
||||
|
||||
$import_to = strip_tags(htmlentities($_POST["import-to"]));
|
||||
$import_from = strip_tags(htmlentities($_SESSION["import-from"]));
|
||||
unset($_SESSION["import-from"]);
|
||||
|
||||
$folderID = strip_tags(htmlentities($_SESSION["folderID"]));
|
||||
$number_rows = strip_tags(htmlentities($_POST["number-rows"]));
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../files/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="middle">
|
||||
<div class="bar-content">
|
||||
<div class="bar1 bar"></div>
|
||||
<div class="bar2 bar"></div>
|
||||
<div class="bar3 bar"></div>
|
||||
<div class="bar4 bar"></div>
|
||||
<div class="bar5 bar"></div>
|
||||
<div class="bar6 bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<?php
|
||||
|
||||
require "../files/ezine_db.inc.php";
|
||||
|
||||
include "../files/loginscript.inc.php";
|
||||
|
||||
include "../files/errorcodesscript.inc.php";
|
||||
|
||||
if($LoggedIn == 'true') {
|
||||
if($import_to != '' && $import_from != '') {
|
||||
|
||||
if($import_to == 'NEWFOLDER-SHARE' || $import_to == 'NEWFOLDER-LIBRARY') {
|
||||
if($import_to == 'NEWFOLDER-SHARE') {
|
||||
$_SESSION["forwarding"] = 'share?id=' . $import_from;
|
||||
print("<meta http-equiv='refresh' content='0; URL=../index?action=add-folder'>");
|
||||
}
|
||||
if($import_to == 'NEWFOLDER-LIBRARY') {
|
||||
$_SESSION["forwarding"] = 'share?id=' . $import_from;
|
||||
print("<meta http-equiv='refresh' content='0; URL=../index?action=add-folder'>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT * FROM `VokabelBoxVokabeln` WHERE `ID` = '$import_from' AND `Sprache1` != ''";
|
||||
|
||||
$result_articles = $conn->query($sql);
|
||||
while ($articleDb = mysqli_fetch_object($result_articles)) {
|
||||
|
||||
$conn->query("INSERT INTO `VokabelBoxVokabeln` (`Sprache1`,`Sprache2`,`Nutzername`,`ID`) VALUES ('$articleDb->Sprache1','$articleDb->Sprache2','$Benutzername','$import_to')");
|
||||
$_SESSION["errorCode"] = 'addVokabSuccess';
|
||||
|
||||
}
|
||||
print("<meta http-equiv='refresh' content='0; URL=../index?folderID=$import_to'>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(empty($folderID)) {
|
||||
$_SESSION["errorCode"] = 'generalError';
|
||||
print("<meta http-equiv='refresh' content='1; URL=../index?folderID=$folderID'>");
|
||||
}
|
||||
else{
|
||||
|
||||
while($number_rows > '0') {
|
||||
|
||||
${'Vok'.$number_rows.'_1'} = strip_tags(htmlentities($_POST['Vok'.$number_rows.'-1']));
|
||||
${'Vok'.$number_rows.'_2'} = strip_tags(htmlentities($_POST['Vok'.$number_rows.'-2']));
|
||||
|
||||
${'Vok'.$number_rows.'_1'} = str_replace('\'', ''', ${'Vok'.$number_rows.'_1'});
|
||||
${'Vok'.$number_rows.'_2'} = str_replace('\'', ''', ${'Vok'.$number_rows.'_2'});
|
||||
|
||||
${'Vok'.$number_rows.'_1'} = str_replace('\\', '\', ${'Vok'.$number_rows.'_1'});
|
||||
${'Vok'.$number_rows.'_2'} = str_replace('\\', '\', ${'Vok'.$number_rows.'_2'});
|
||||
|
||||
if(${'Vok'.$number_rows.'_1'} != '' && ${'Vok'.$number_rows.'_2'} != '') {
|
||||
$conn->query("INSERT INTO `VokabelBoxVokabeln` (`Sprache1`,`Sprache2`,`Nutzername`,`ID`) VALUES ('${'Vok'.$number_rows.'_1'}','${'Vok'.$number_rows.'_2'}','$Benutzername','$folderID')");
|
||||
}
|
||||
|
||||
$number_rows = $number_rows - 1;
|
||||
}
|
||||
|
||||
$_SESSION["errorCode"] = 'addVokabSuccess';
|
||||
print("<meta http-equiv='refresh' content='1; URL=../index?folderID=$folderID'>");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user