From c02cd74586af75688977611a2c22eb99486ed5be Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:35:22 +0200 Subject: [PATCH 1/4] Enabling basic functionality - removed deprecated functions (mysql) - adding function: select view at login - adapting queries to database structure - some minor stuff --- exampleAddOns/alarmMonitorWeb/config.php | 4 +- .../alarmMonitorWeb/do_eintragen.php | 57 +++++++ exampleAddOns/alarmMonitorWeb/eintragen.php | 143 ++++++++++++------ exampleAddOns/alarmMonitorWeb/index.php | 12 +- exampleAddOns/alarmMonitorWeb/login.php | 33 +++- exampleAddOns/alarmMonitorWeb/logout.php | 6 + exampleAddOns/alarmMonitorWeb/prefs.php | 8 +- 7 files changed, 203 insertions(+), 60 deletions(-) create mode 100644 exampleAddOns/alarmMonitorWeb/do_eintragen.php create mode 100644 exampleAddOns/alarmMonitorWeb/logout.php diff --git a/exampleAddOns/alarmMonitorWeb/config.php b/exampleAddOns/alarmMonitorWeb/config.php index 3d9fb88..f3a439c 100644 --- a/exampleAddOns/alarmMonitorWeb/config.php +++ b/exampleAddOns/alarmMonitorWeb/config.php @@ -1,8 +1,8 @@ + + + + + + +Zurück"; + exit; + } +$passwort = md5($passwort); + +$result = mysqli_query($verbindung, "SELECT id FROM login WHERE username LIKE '$username'"); +$menge = mysqli_num_rows($result); + +if($menge == 0) + { + $eintrag = "INSERT INTO login (username, passwort) VALUES ('$username', '$passwort')"; + $eintragen = mysqli_query($verbindung, $eintrag); + + if($eintragen == true) + { + echo "Benutzername $username wurde erstellt. Login"; + } + else + { + echo "Fehler beim Speichern des Benutzernames. Zurück"; + } + + + } + +else + { + echo "Benutzername schon vorhanden. Zurück"; + } +?> diff --git a/exampleAddOns/alarmMonitorWeb/eintragen.php b/exampleAddOns/alarmMonitorWeb/eintragen.php index 22488dc..91bba00 100644 --- a/exampleAddOns/alarmMonitorWeb/eintragen.php +++ b/exampleAddOns/alarmMonitorWeb/eintragen.php @@ -1,58 +1,111 @@ + + einloggen"; exit; } ?> +Zurück"; - exit; - } -$passwort = md5($passwort); - -$result = mysql_query("SELECT id FROM login WHERE username LIKE '$username'"); -$menge = mysql_num_rows($result); - -if($menge == 0) - { - $eintrag = "INSERT INTO login (username, passwort) VALUES ('$username', '$passwort')"; - $eintragen = mysql_query($eintrag); - - if($eintragen == true) - { - echo "Benutzername $username wurde erstellt. Login"; - } - else - { - echo "Fehler beim Speichern des Benutzernames. Zurück"; - } - - - } - -else - { - echo "Benutzername schon vorhanden. Zurück"; - } +require_once ("tpl/mysql.class.php"); +$db = new Database($dbhost, $dbuser, $dbpassword, $database, 1); //Show Error = 1! ?> + + + + BOSwatch + + + + + + + + + + + + + + + +
+ +
+ + + + +
+
Usermanagment
+
+ +
+ +
+Username:
+
+ +Passwort:
+
+ +Passwort wiederholen:
+
+ + +
+ +
+ +
+
+ + + + + + + + + + diff --git a/exampleAddOns/alarmMonitorWeb/index.php b/exampleAddOns/alarmMonitorWeb/index.php index c6165ce..a04cdaa 100644 --- a/exampleAddOns/alarmMonitorWeb/index.php +++ b/exampleAddOns/alarmMonitorWeb/index.php @@ -40,7 +40,7 @@ $db = new Database($dbhost, $dbuser, $dbpassword, $database, 1); //Show Error = @@ -75,6 +75,14 @@ Dein Passwort:

+Startanzeige:
+
+ + @@ -100,4 +108,4 @@ name="password">
- \ No newline at end of file + diff --git a/exampleAddOns/alarmMonitorWeb/login.php b/exampleAddOns/alarmMonitorWeb/login.php index f12c4dd..264c6b5 100644 --- a/exampleAddOns/alarmMonitorWeb/login.php +++ b/exampleAddOns/alarmMonitorWeb/login.php @@ -4,25 +4,44 @@ session_start(); Login"; + exit; +} $username = $_POST["username"]; $passwort = md5($_POST["password"]); -$abfrage = "SELECT username, passwort FROM" $tableLOG "WHERE username LIKE '$username' LIMIT 1"; -$ergebnis = mysql_query($abfrage); -$row = mysql_fetch_object($ergebnis); + +$abfrage = "SELECT username, passwort FROM ".$tableLOG." WHERE username LIKE '$username' LIMIT 1"; +$ergebnis = mysqli_query($verbindung, $abfrage); +$row = mysqli_fetch_object($ergebnis); if($row->passwort == $passwort) { $_SESSION["username"] = $username; - header("Location: /show_pocsag.php"); + switch ($_POST["view"]) { + case 'pocsag': + header("Location: show_pocsag.php"); + break; + case 'zvei': + header("Location: show_zvei.php"); + break; + case 'fms': + header("Location: show_fms.php"); + break; + default: + header("Location: show_pocsag.php"); + } } else { - echo "Benutzername und/oder Passwort waren falsch. Login"; + echo "Benutzername und/oder Passwort waren falsch. Login"; } ?> diff --git a/exampleAddOns/alarmMonitorWeb/logout.php b/exampleAddOns/alarmMonitorWeb/logout.php new file mode 100644 index 0000000..314640c --- /dev/null +++ b/exampleAddOns/alarmMonitorWeb/logout.php @@ -0,0 +1,6 @@ + diff --git a/exampleAddOns/alarmMonitorWeb/prefs.php b/exampleAddOns/alarmMonitorWeb/prefs.php index 29a2a35..ddf6378 100644 --- a/exampleAddOns/alarmMonitorWeb/prefs.php +++ b/exampleAddOns/alarmMonitorWeb/prefs.php @@ -11,7 +11,7 @@ session_start(); ?>
Einstellungen
- +
@@ -60,4 +60,4 @@ echo($ini_array['filter_range_end']); - \ No newline at end of file + From 61398d95cb3d4845419a63f334cf8835d1dafbb1 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:37:25 +0200 Subject: [PATCH 2/4] Increase usability make the login-data readable for users --- exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql b/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql index b7b4bc5..925dd53 100644 --- a/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql +++ b/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql @@ -36,7 +36,7 @@ CREATE TABLE `login` ( LOCK TABLES `login` WRITE; /*!40000 ALTER TABLE `login` DISABLE KEYS */; -INSERT INTO `login` VALUES ,(1,'Test','098f6bcd4621d373cade4e832627b4f6'); +INSERT INTO `login` VALUES (1,'admin',md5('admin')); /*!40000 ALTER TABLE `login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; From 4c60d501b58694b27e62b8a6e06e599b4d9a5784 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:38:16 +0200 Subject: [PATCH 3/4] fixing deprecated stuff removed deprecated functions adpating to db-structure --- exampleAddOns/alarmMonitorWeb/tpl/a_header.php | 3 ++- .../alarmMonitorWeb/tpl/mysql.class.php | 16 ++++++++-------- exampleAddOns/alarmMonitorWeb/tpl/pocsag.php | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/exampleAddOns/alarmMonitorWeb/tpl/a_header.php b/exampleAddOns/alarmMonitorWeb/tpl/a_header.php index 3614643..866b34f 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/a_header.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/a_header.php @@ -41,7 +41,8 @@
  • FMS
  • ZVEI
  • Einstellungen
  • -
  • Nutzer anlegen
  • +
  • Nutzer anlegen
  • +
  • Ausloggen
  • diff --git a/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php b/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php index 69d5fbd..3910fd9 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php @@ -23,16 +23,16 @@ Simple Database Class (C) by Bastian Schroll function __construct($host, $user, $password, $database, $show_error = 1) { $this->show_error = $show_error; - @$this->conn = mysql_connect($host, $user, $password); + @$this->conn = mysqli_connect($host, $user, $password); if ($this->conn == false) { - $this->error("Keine Verbindung zum Datenbank Server!", mysql_error()); + $this->error("Keine Verbindung zum Datenbank Server!", mysqli_error($this->conn)); return false; } - if (!@mysql_select_db($database, $this->conn)) + if (!@mysqli_select_db($this->conn, $database)) { - $this->error("Datenbank nicht gefunden!", mysql_error()); + $this->error("Datenbank nicht gefunden!", mysqli_error($this->conn)); return false; } return true; @@ -48,10 +48,10 @@ Simple Database Class (C) by Bastian Schroll */ function query($query) { - $this->result = @mysql_query($query, $this->conn); + $this->result = @mysqli_query($this->conn, $query); if ($this->result == false) { - $this->error("Fehlerhafte Datenbank Anfrage!", mysql_error()); + $this->error("Fehlerhafte Datenbank Anfrage!", mysqli_error($this->conn)); return false; } return $this->result; @@ -69,10 +69,10 @@ Simple Database Class (C) by Bastian Schroll { if ($result != null) { - return @mysql_fetch_assoc($result); + return @mysqli_fetch_assoc($result); } else { - return @mysql_fetch_assoc($this->result); + return @mysqli_fetch_assoc($this->result); } } diff --git a/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php b/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php index 4e4c6f2..5e86ebb 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php @@ -10,7 +10,7 @@ query("SELECT id, time, ric, funktion, text, description FROM ".$tablePOC." ORDER BY id DESC LIMIT 100"); + $db->query("SELECT id, time, ric, function, msg, description FROM ".$tablePOC." ORDER BY id DESC LIMIT 100"); $Rows = array(); while ($daten = $db->fetchAssoc()) { @@ -29,11 +29,11 @@ // echo "". $poc['id'] . ""; // echo "". $poc['description'] . ""; - echo "". $poc['text'] . ""; + echo "". $poc['msg'] . ""; echo "". $time . ""; echo "". $poc['ric'] . ""; - echo "". $poc['funktion'] . ""; + echo "". $poc['function'] . ""; echo ""; } ?> - \ No newline at end of file + From 35e3ba80694f081e61d088b1b88d01fe3bdf243d Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:38:51 +0200 Subject: [PATCH 4/4] remove file moved and renamed --- exampleAddOns/alarmMonitorWeb/eintragen.html | 111 ------------------- 1 file changed, 111 deletions(-) delete mode 100644 exampleAddOns/alarmMonitorWeb/eintragen.html diff --git a/exampleAddOns/alarmMonitorWeb/eintragen.html b/exampleAddOns/alarmMonitorWeb/eintragen.html deleted file mode 100644 index b850f57..0000000 --- a/exampleAddOns/alarmMonitorWeb/eintragen.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - -einloggen"; - exit; - } -?> - - - - - - BOSwatch - - - - - - - - - - - - - - - -
    - -
    - - - - -
    -
    Usermanagment
    -
    - -
    - -
    -Username:
    -
    - -Passwort:
    -
    - -Passwort wiederholen:
    -
    - - -
    - -
    - -
    -
    - - - - - - - - - - \ No newline at end of file