Leitgedanken/stichworte.php
2022-11-21 09:47:28 +01:00

70 lines
1.9 KiB
PHP

<?php
if(!isset($_SESSION)) { session_start(); }
include_once 'classes/lg-on_Smarty.class.php';
$smarty = new lgon_Smarty();
require_once("config.inc.php");
require_once("func_htmlclean.php");
$templatename = substr(basename($_SERVER['PHP_SELF']), 0, -3) . "html";
require_once "language/german.inc.php";
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = '';
}
$termin = $_GET['tid'];
if ($action == '') {
$eid = $_GET['eid'];
$_SESSION["eid"] = $eid;
$query = "SELECT luesid, eid, stichwort, case_sensitive
FROM lue_stichworte
WHERE eid= '$eid'
ORDER BY stichwort ASC";
$result = $db->query($query) or die("Cannot execute query");
while ($row = $result->fetch_array()) {
if($row['case_sensitive'] == 'N'){
$sensitive = 'Nein';
}else{
$sensitive = 'Ja';
}
$row['sensitive'] = $sensitive;
$table_data[] = $row;
}
$smarty->assign('table_data', $table_data);
}
if ($action == 'save') {
$stichwort = $_POST['stichwort'];
$sensitive = $_POST['sensitive'];
$stichwort = htmlentities($stichwort);
$stichwort = htmlclean($stichwort, $db);
$eid = $_SESSION["eid"];
if ($sensitive == '' or $sensitive == NULL){
$sensitive = 'N';
}else{
$sensitive = 'Y';
}
$sql1 = $db->query("insert into lue_stichworte (eid, stichwort, case_sensitive) VALUES('$eid', '$stichwort', '$sensitive')");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?eid=$eid\">";
}
if ($action == 'del') {
$luesid = $_GET['luesid'];
$eid = $_SESSION["eid"];
$sql1 = $db->query("DELETE FROM lue_stichworte WHERE luesid=$luesid");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?eid=$eid\">";
}
$smarty->assign('action', "$action");
$smarty->display("$template/$templatename");
?>