--- a/fhiiqm/deprecated/info_ins.php Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/info_ins.php Wed Aug 06 09:42:40 2014 +0200
@@ -1,185 +1,185 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 08/2011
- *
- * INSERT Informationen
- */
-
- error_reporting(E_ALL ^ E_NOTICE);
-
- session_start();
- if (! isset($_SESSION["userid"]))
- {
- include_once ("inc/func_lib.inc.php");
- login($_SERVER["PHP_SELF"]);
- exit;
- }
-
- if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
- {
- header("Location: start.php");
- exit;
- }
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/>
- <link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
-
- <title>Eingabe Informationen</title>
-</head>
-
-<body>
-
-<?php
- echo " ";
- echo "<div class=\"float-br smaller\" valign='top'>";
- echo " user: " . $_SESSION["userid"];
- echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
- echo "<div class=\"float-r\"><img src=\"img/document_image_ver.png\" border=\"0\" alt=\"Informationen eingeben\" title=\"Informationen eingeben\"/></div>\n";
-
- include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
- //$dbc = new dbconnection();
-
- $ok = $_POST["ok"];
- $inf = $_POST["inf"];
- $submit = $_POST["ins"];
- if (!$inf["okn"]) $ok = false;
- if (!$ok || !$submit)
- {
- include($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/info_form.inc.php");
- if ($submit)
- {
- echo
- "<tr>
- <td>Upload Infodokument </td>
- <td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
- $_FILES["ifile"]["name"] . "\"/></td>
- </tr>";
-
- $frage = "Alle Angaben ok?<br>
- erst wenn Haken gesetzt, Upload-File wählen!";
- echo "<tr>
- <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
- <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
- if ($ok) echo "checked";
- echo "></td>\n</tr>\n";
- }
-
- echo "<tr>\n";
- echo "
- <td> </td>
- <td><input class=\"button\" type=\"submit\" value=\"eingeben\" name=\"ins\" title=\"insert\" /></td>\n";
- echo "</tr>\n";
- echo "</table>\n";
- echo "</div>\n";
- echo "</form>\n";
-
- }
- else
- {
- echo "<div align='center'>\n";
- //daten speichern
- $inf["iname"] = substr($inf["iname"],0,300);
- $inf["ilong"] = substr($inf["ilong"],0,8000);
- if ($inf["ityp"] == -1) $inf["ityp"] = null;
-
- if ($inf["ijahr"] && $inf["imon"] && $inf["itag"])
- {
- $idat = $inf["ijahr"]."-".$inf["imon"]."-".$inf["itag"];
- // Datum valid?
- if (!$idat = new DateTime_s($idat)) $idat = null;
- }
- else
- $idat = null;
- if ($inf["bjahr"] && $inf["bmon"] && $inf["btag"])
- {
- $bdat = $inf["bjahr"]."-".$inf["bmon"]."-".$inf["btag"];
- if (!$bdat = new DateTime_s($bdat)) $bdat = null;
- }
- else
- $bdat = null;
- if ($inf["ejahr"] && $inf["emon"] && $inf["etag"])
- {
- $edat = $inf["ejahr"]."-".$inf["emon"]."-".$inf["etag"];
- if (!$edat = new DateTime_s($edat)) $edat = null;
- }
- else
- $edat = null;
-
- if ($inf["pers"] == -1) $inf["pers"] = null;
- if ($inf["prid"] <1 ) $inf["prid"] = null;
- if ($inf["infrel"] == -1) $inf["infrel"] = null;
- if ($inf["lang"] == -1) $inf["lang"] = null;
- //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";
-
- if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
- $stmt = $dbc -> stmtinit();
- if (is_object($stmt))
- {
- $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
- infotyp_ID,persknr,lang,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?)");
- $stmt -> bind_param('sssssiisi', $inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
- $result = $stmt -> execute();
- }
- if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
- if ($result)
- { // INSERT o.k.
- // info_ID ermitteln
- $infid = $dbc -> insertId();
-
- // n:m Tabellen INSERT
- include ("inc/info_tab_ins.inc.php");
-
- // upload File
- if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
- {
- include ("inc/file_upload.inc.php");
- $fname = gen_filename($inf['ifname'],"ifile",$infid);
- $retf = upload("ifile", $fname, $infid, "infos"); // Datei prüfen und in Dokumentenverzeichnis verschieben
-
- if ($retf)
- { // upload o.k.
- //UPDATE des Filenamens
- $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
- $retv=$dbc->execute($sql);
- if (!$retv)
- echo $dbc -> error . "<br>\n";
- }
-
- }
- else
- {
- $retf=1; //kein Infodoc hochgeladen
- }
- if ($result && $retf && $reta && $retp) // INSERT Raum
- {
- //Eingabe Daten, Upload File erfolgreich
- echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
- echo "<br /><br />\n";
-
- // Anzeigen gespeicherte Raumdaten
- if ($fname)
- $ifile = $infid . "_" . $fname;
- else
- $ifile = $inf['ifname'];
- include ("inc/info_dat_show.inc.php");
- }
- }
- $dbc -> close();
- echo "</div>\n";
- echo "<p class='sc'> <a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur Infolisteliste</a></p>\n";
- echo "<p class='sc'> <a href=\"info_ins.php\" target=\"_self\" title=\"Information erfassen\">Weitere Information erfassen</a></p>\n";
- }
-
-
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 08/2011
+ *
+ * INSERT Informationen
+ */
+
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ session_start();
+ if (! isset($_SESSION["userid"]))
+ {
+ include_once ("inc/func_lib.inc.php");
+ login($_SERVER["PHP_SELF"]);
+ exit;
+ }
+
+ if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
+ {
+ header("Location: start.php");
+ exit;
+ }
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/>
+ <link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
+
+ <title>Eingabe Informationen</title>
+</head>
+
+<body>
+
+<?php
+ echo " ";
+ echo "<div class=\"float-br smaller\" valign='top'>";
+ echo " user: " . $_SESSION["userid"];
+ echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+ echo "<div class=\"float-r\"><img src=\"img/document_image_ver.png\" border=\"0\" alt=\"Informationen eingeben\" title=\"Informationen eingeben\"/></div>\n";
+
+ include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+ //$dbc = new dbconnection();
+
+ $ok = $_POST["ok"];
+ $inf = $_POST["inf"];
+ $submit = $_POST["ins"];
+ if (!$inf["okn"]) $ok = false;
+ if (!$ok || !$submit)
+ {
+ include($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/info_form.inc.php");
+ if ($submit)
+ {
+ echo
+ "<tr>
+ <td>Upload Infodokument </td>
+ <td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
+ $_FILES["ifile"]["name"] . "\"/></td>
+ </tr>";
+
+ $frage = "Alle Angaben ok?<br>
+ erst wenn Haken gesetzt, Upload-File wählen!";
+ echo "<tr>
+ <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+ <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+ if ($ok) echo "checked";
+ echo "></td>\n</tr>\n";
+ }
+
+ echo "<tr>\n";
+ echo "
+ <td> </td>
+ <td><input class=\"button\" type=\"submit\" value=\"eingeben\" name=\"ins\" title=\"insert\" /></td>\n";
+ echo "</tr>\n";
+ echo "</table>\n";
+ echo "</div>\n";
+ echo "</form>\n";
+
+ }
+ else
+ {
+ echo "<div align='center'>\n";
+ //daten speichern
+ $inf["iname"] = substr($inf["iname"],0,300);
+ $inf["ilong"] = substr($inf["ilong"],0,8000);
+ if ($inf["ityp"] == -1) $inf["ityp"] = null;
+
+ if ($inf["ijahr"] && $inf["imon"] && $inf["itag"])
+ {
+ $idat = $inf["ijahr"]."-".$inf["imon"]."-".$inf["itag"];
+ // Datum valid?
+ if (!$idat = new DateTime_s($idat)) $idat = null;
+ }
+ else
+ $idat = null;
+ if ($inf["bjahr"] && $inf["bmon"] && $inf["btag"])
+ {
+ $bdat = $inf["bjahr"]."-".$inf["bmon"]."-".$inf["btag"];
+ if (!$bdat = new DateTime_s($bdat)) $bdat = null;
+ }
+ else
+ $bdat = null;
+ if ($inf["ejahr"] && $inf["emon"] && $inf["etag"])
+ {
+ $edat = $inf["ejahr"]."-".$inf["emon"]."-".$inf["etag"];
+ if (!$edat = new DateTime_s($edat)) $edat = null;
+ }
+ else
+ $edat = null;
+
+ if ($inf["pers"] == -1) $inf["pers"] = null;
+ if ($inf["prid"] <1 ) $inf["prid"] = null;
+ if ($inf["infrel"] == -1) $inf["infrel"] = null;
+ if ($inf["lang"] == -1) $inf["lang"] = null;
+ //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";
+
+ if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+ $stmt = $dbc -> stmtinit();
+ if (is_object($stmt))
+ {
+ $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
+ infotyp_ID,persknr,lang,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?)");
+ $stmt -> bind_param('sssssiisi', $inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
+ $result = $stmt -> execute();
+ }
+ if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
+ if ($result)
+ { // INSERT o.k.
+ // info_ID ermitteln
+ $infid = $dbc -> insertId();
+
+ // n:m Tabellen INSERT
+ include ("inc/info_tab_ins.inc.php");
+
+ // upload File
+ if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
+ {
+ include ("inc/file_upload.inc.php");
+ $fname = gen_filename($inf['ifname'],"ifile",$infid);
+ $retf = upload("ifile", $fname, $infid, "infos"); // Datei prüfen und in Dokumentenverzeichnis verschieben
+
+ if ($retf)
+ { // upload o.k.
+ //UPDATE des Filenamens
+ $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
+ $retv=$dbc->execute($sql);
+ if (!$retv)
+ echo $dbc -> error . "<br>\n";
+ }
+
+ }
+ else
+ {
+ $retf=1; //kein Infodoc hochgeladen
+ }
+ if ($result && $retf && $reta && $retp) // INSERT Raum
+ {
+ //Eingabe Daten, Upload File erfolgreich
+ echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
+ echo "<br /><br />\n";
+
+ // Anzeigen gespeicherte Raumdaten
+ if ($fname)
+ $ifile = $infid . "_" . $fname;
+ else
+ $ifile = $inf['ifname'];
+ include ("inc/info_dat_show.inc.php");
+ }
+ }
+ $dbc -> close();
+ echo "</div>\n";
+ echo "<p class='sc'> <a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur Infolisteliste</a></p>\n";
+ echo "<p class='sc'> <a href=\"info_ins.php\" target=\"_self\" title=\"Information erfassen\">Weitere Information erfassen</a></p>\n";
+ }
+
+
+?>
+
+</body>
</html>
\ No newline at end of file