Initial commit
This commit is contained in:
120
lieder/liednotizen.php
Normal file
120
lieder/liednotizen.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
# Fuer debugging
|
||||
#error_reporting(E_ALL);
|
||||
#ini_set('display_errors', 1);
|
||||
#echo __LINE__."<br>";
|
||||
|
||||
include_once '../classes/lg-on_Smarty.class_subdir.php';
|
||||
$smarty = new lgon_Smarty();
|
||||
require_once("../config.inc.php");
|
||||
require_once("../func_rollenrechte.php");
|
||||
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
|
||||
require_once "../language/german.inc.php";
|
||||
|
||||
|
||||
$db = dbconnect();
|
||||
// Rechteüberprüfung
|
||||
|
||||
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
|
||||
if(!rore($user_admin,'a_notes','RE')){require("lib/rechte.php");exit;}
|
||||
// Rechteüberprüfung ende
|
||||
|
||||
|
||||
$teile = explode(" ", $_GET ["load"]);
|
||||
$art= trim($teile[0]);
|
||||
$nummer = trim($teile[1]);
|
||||
|
||||
if(isset($teile[2])){
|
||||
$zusatz = trim($teile[2]);
|
||||
}else{
|
||||
$zusatz ='';
|
||||
}
|
||||
|
||||
|
||||
setcookie("liednotizen_load",$_GET["load"]);
|
||||
setcookie("liednotizen_art","$art");
|
||||
setcookie("liednotizen_nummer","$nummer");
|
||||
setcookie("liednotizen_zusatz","$zusatz");
|
||||
|
||||
|
||||
if(isset($_GET['action'])){
|
||||
$action = $_GET['action'];
|
||||
}else{
|
||||
$action = '';
|
||||
}
|
||||
if($action == ''){
|
||||
if($zusatz == ''){
|
||||
$zusatz="IS NULL";
|
||||
}else{
|
||||
$zusatz="= '$zusatz'";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$result = $db->query( "SELECT notiz
|
||||
FROM lieder_notizen
|
||||
WHERE art = '$art'
|
||||
AND nr = '$nummer'
|
||||
AND zusatz $zusatz
|
||||
AND vaid=$user_vaid
|
||||
");
|
||||
$row = $result->fetch_array();
|
||||
|
||||
|
||||
$notiz =str_replace ('"', '\"' , $row['notiz']);
|
||||
$notiz =str_replace ("'", "\'" , $notiz);
|
||||
$notiz = preg_replace("/\r*|\n*/s", "", $notiz);
|
||||
$notiz = preg_replace("/(\r\n|\n|\r)/", "", $notiz);
|
||||
# echo $notiz;
|
||||
# exit;
|
||||
#$notiz = strip_tags($notiz);
|
||||
|
||||
$smarty->assign('notes_text', "$notiz");
|
||||
|
||||
# $smarty->assign('notes_lid', "$lid");
|
||||
|
||||
}
|
||||
|
||||
if($action == 'notes'){
|
||||
|
||||
|
||||
$zusatz = $_COOKIE['liednotizen_zusatz'];
|
||||
$art = $_COOKIE['liednotizen_art'];
|
||||
$nummer = $_COOKIE['liednotizen_nummer'];
|
||||
$load = $_COOKIE['liednotizen_load'];
|
||||
|
||||
if ($zusatz == '') {
|
||||
$zusatz1 = "NULL";
|
||||
} else {
|
||||
$zusatz1 = "'" . $zusatz . "'";
|
||||
}
|
||||
|
||||
if($zusatz == ''){
|
||||
$zusatz2="IS NULL";
|
||||
}else{
|
||||
$zusatz2="= '$zusatz'";
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM lieder_notizen
|
||||
WHERE vaid=$user_vaid
|
||||
AND art='$art'
|
||||
AND nr = '$nummer'
|
||||
AND zusatz $zusatz2");
|
||||
|
||||
$smarty->assign('notes_load', "$load");
|
||||
$notiz = $db->real_escape_string(stripslashes( $_POST['notizen'] ));
|
||||
|
||||
$db = dbconnect();
|
||||
# echo "INSERT INTO lieder_notizen (vaid, art, nr, zusatz, notiz) VALUES ($user_vaid, '$art', '$nummer', $zusatz1, '$notiz' )";
|
||||
#exit;
|
||||
$db->query( "INSERT INTO lieder_notizen (vaid, art, nr, zusatz, notiz) VALUES ($user_vaid, '$art', '$nummer', $zusatz1, '$notiz' )");
|
||||
$db->query( "DELETE FROM lieder_notizen WHERE notiz=''" );
|
||||
|
||||
#session_destroy();
|
||||
$smarty->assign('notes_redirect', "1");
|
||||
|
||||
}
|
||||
|
||||
$smarty->assign('action', "$action");
|
||||
$smarty->display("../templates/$template/lieder/$templatename");
|
||||
?>
|
Reference in New Issue
Block a user