189 lines
6.5 KiB
PHP
Executable File
189 lines
6.5 KiB
PHP
Executable File
<?php
|
|
header("Expires: Mon, 12 Jul 1995 05:00:00 GMT");
|
|
header("Last-Modified: " . gmdate("D, d M Y H.i:s") . " GMT");
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
header("Pragma: no-cache");
|
|
$verz = "upload/"; // relatives Uploadverzeichnis (relativ zum 'Spassworddort' dieser Datei, wohin die Dateien kopiert werden sollen
|
|
|
|
## INDEX gegen DB
|
|
if(!isset($_SESSION)) { session_start(); }
|
|
|
|
include_once '../classes/TestProjektSmarty.class_subdir.php';
|
|
require_once("../config.inc.php");
|
|
require_once("../config/datenbankanbindung.php");
|
|
require_once("../func_get_parameter.php");
|
|
require_once("../config/func_cryption.php");
|
|
$smarty = new SmartyAdmin();
|
|
$templatename = substr(basename($_SERVER['PHP_SELF']), 0, -3) . "html";
|
|
require_once "../language/german.inc.php";
|
|
|
|
$action = $_GET['action'];
|
|
if ($action == '') {
|
|
|
|
|
|
$dst_id = $_SESSION["prx_dst_id"];
|
|
|
|
|
|
# Gespeicherte Werte
|
|
# Persönliche Angaben
|
|
$result = $db->query("SELECT bezeichnung, name, str, plz, ort, tel, internet, mail, date_format(gueltig_von, '%d.%m.%Y') gueltig_von_form, date_format(gueltig_bis, '%d.%m.%Y') gueltig_bis_form
|
|
FROM bpm_dienststellen
|
|
WHERE dst_id = '$dst_id'
|
|
LIMIT 1");
|
|
$row = @$result->fetch_array();
|
|
if($row['gueltig_von_form'] == '00.00.0000'){
|
|
$gueltig_von_form = "";
|
|
}else{
|
|
$gueltig_von_form = $row['gueltig_von_form'];
|
|
}
|
|
if($row['gueltig_bis_form'] == '00.00.0000'){
|
|
$gueltig_bis_form = "";
|
|
}else{
|
|
$gueltig_bis_form = $row['gueltig_bis_form'];
|
|
}
|
|
|
|
$smarty->assign('dst_bezeichnung', $row['bezeichnung']);
|
|
$smarty->assign('dst_name', $row['name']);
|
|
$smarty->assign('dst_str', $row['str']);
|
|
$smarty->assign('dst_plz', $row['plz']);
|
|
$smarty->assign('dst_ort', $row['ort']);
|
|
$smarty->assign('dst_mail', $row['mail']);
|
|
$smarty->assign('dst_value_gueltigvon', "$gueltig_von_form");
|
|
$smarty->assign('dst_value_gueltigbis', "$gueltig_bis_form");
|
|
|
|
# -- Fehlermeldungen -- #
|
|
if (isset($_GET['error'])) {
|
|
|
|
$errorno = $_GET['error'];
|
|
|
|
$smarty->assign('dst_error', 1);
|
|
|
|
$smarty->assign('dst_bezeichnung', $_SESSION["dst_bezeichnung"]);
|
|
$smarty->assign('dst_name', $_SESSION["dst_name"]);
|
|
$smarty->assign('dst_str', $_SESSION["dst_str"]);
|
|
$smarty->assign('dst_plz', $_SESSION["dst_plz"]);
|
|
$smarty->assign('dst_ort', $_SESSION["dst_ort"]);
|
|
$smarty->assign('dst_mail', $_SESSION["dst_mail"]);
|
|
$smarty->assign('dst_pwd', $_SESSION["dst_pwd"]);
|
|
$smarty->assign('dst_pwd_wied', $_SESSION["dst_pwd_wied"]);
|
|
$smarty->assign('dst_value_gueltigvon', $_SESSION["dst_value_gueltigvon"]);
|
|
$smarty->assign('dst_value_gueltigbis', $_SESSION["dst_value_gueltigbis"]);
|
|
|
|
|
|
if ($errorno == 1) {
|
|
# ungültiges Datum
|
|
$smarty->assign('dst_error_text', "Es müssen alle Felder ausgefüllt werden!");
|
|
}
|
|
if ($errorno == 2) {
|
|
# ungültiges Datum
|
|
$smarty->assign('dst_error_text', "Das eingegebene Passwort stimmt nicht mit der Passwortwiederholung überein!");
|
|
}
|
|
if ($errorno == 3) {
|
|
# ungültiges Datum
|
|
$smarty->assign('dst_error_text', "Das eingegebene Gültig von Datum ist nicht korrekt. Bitte korrigieren Sie das Datum!");
|
|
}
|
|
if ($errorno == 4) {
|
|
# ungültiges Datum
|
|
$smarty->assign('dst_error_text', "Das eingegebene Gültig bis Datum ist nicht korrekt. Bitte korrigieren Sie das Datum!");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if ($action == 'save') {
|
|
|
|
$art = $_POST['art'];
|
|
$name = $_POST['name'];
|
|
$str = $_POST['str'];
|
|
$plz = $_POST['plz'];
|
|
$ort = $_POST['ort'];
|
|
$mail = $_POST['mail'];
|
|
$pwd = $_POST['pwd_prx'];
|
|
$pwd_wied = $_POST['pwd_prx_wied'];
|
|
$bez = $art." ".$name;
|
|
$dst_id = $_SESSION["prx_dst_id"];
|
|
$gueltigvon = $_POST['gueltigvon'];
|
|
$gueltigbis = $_POST['gueltigbis'];
|
|
|
|
$gueltigvon_form = preg_replace('/^(\\d{2})\\.(\\d{2})\\.(\\d{4})$/', '$3-$2-$1', $gueltigvon);
|
|
$gueltigbis_form = preg_replace('/^(\\d{2})\\.(\\d{2})\\.(\\d{4})$/', '$3-$2-$1', $gueltigbis);
|
|
|
|
|
|
function validateDate($date, $format = 'Y-m-d')
|
|
{
|
|
$d = DateTime::createFromFormat($format, $date);
|
|
return $d && $d->format($format) == $date;
|
|
}
|
|
|
|
if(!validateDate($gueltigvon_form) AND $gueltigvon_form != ''){
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?error=3\">";
|
|
exit;
|
|
}
|
|
|
|
if(!validateDate($gueltigbis_form) AND $gueltigbis_form != ''){
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?error=4\">";
|
|
exit;
|
|
}
|
|
|
|
if($gueltigvon_form == ''){
|
|
$gueltigvon_form ='0000-00-00';
|
|
}
|
|
|
|
if($gueltigbis_form == ''){
|
|
$gueltigbis_form ='0000-00-00';
|
|
}
|
|
|
|
|
|
$_SESSION["dst_bezeichnung"] = $art;
|
|
$_SESSION["dst_name"] = $name;
|
|
$_SESSION["dst_str"] = $str;
|
|
$_SESSION["dst_plz"] = $plz;
|
|
$_SESSION["dst_ort"] = $ort;
|
|
$_SESSION["dst_mail"] = $mail;
|
|
$_SESSION["dst_pwd"] = $pwd;
|
|
$_SESSION["dst_pwd_wied"] = $pwd_wied;
|
|
|
|
|
|
if($art == '' or $name == '' or $str == '' or $plz == '' or $ort == '' or $mail == ''){
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?&error=1\">";
|
|
exit;
|
|
}
|
|
if($pwd != ''){
|
|
if($pwd != $pwd_wied){
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?&error=2\">";
|
|
exit;
|
|
}
|
|
$pwd_md5 = md5($pwd);
|
|
}else{
|
|
# Passwort holen und unverändert lassen
|
|
$result = $db->query("SELECT pwd
|
|
FROM bpm_dienststellen
|
|
WHERE dst_id = '$dst_id'
|
|
LIMIT 1");
|
|
$row = @$result->fetch_array();
|
|
$pwd_md5 = $row['pwd'];
|
|
}
|
|
|
|
$result = $db->query("UPDATE bpm_dienststellen
|
|
SET bezeichnung = '$art'
|
|
, name = '$name'
|
|
, bez = '$bez'
|
|
, str = '$str'
|
|
, plz = '$plz'
|
|
, ort = '$ort'
|
|
, mail = '$mail'
|
|
, pwd = '$pwd_md5'
|
|
, gueltig_von = '$gueltigvon_form'
|
|
, gueltig_bis = '$gueltigbis_form'
|
|
WHERE dst_id = $dst_id
|
|
");
|
|
echo "<meta http-equiv=\"refresh\" content=\"1; URL=" . $_SERVER['PHP_SELF'] . "?\">";
|
|
}
|
|
|
|
|
|
|
|
$smarty->assign('action', "$action");
|
|
$smarty->display("$template/praxisstelle/$templatename");
|
|
?>
|