mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-27 02:14:19 +01:00
Enabling basic functionality
- removed deprecated functions (mysql) - adding function: select view at login - adapting queries to database structure - some minor stuff
This commit is contained in:
parent
1a9e2a34d1
commit
c02cd74586
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "USERNAME";
|
||||
$dbpassword = "PASSWORD";
|
||||
$dbuser = "boswatch";
|
||||
$dbpassword = "boswatch";
|
||||
$database = "boswatch";
|
||||
|
||||
$tableFMS = "bos_fms";
|
||||
|
|
|
|||
57
exampleAddOns/alarmMonitorWeb/do_eintragen.php
Normal file
57
exampleAddOns/alarmMonitorWeb/do_eintragen.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(($_SESSION["username"])!="admin")
|
||||
{
|
||||
echo "Sie sind nicht berechtigt fuer diesen Bereich";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
@require_once("config.php");
|
||||
$verbindung = mysqli_connect($dbhost, $dbuser , $dbpassword, $database)
|
||||
or die("Verbindung zur Datenbank konnte nicht hergestellt werden");
|
||||
|
||||
$username = $_POST["username"];
|
||||
$passwort = $_POST["passwort"];
|
||||
$passwort2 = $_POST["passwort2"];
|
||||
|
||||
if($passwort != $passwort2 OR $username == "" OR $passwort == "")
|
||||
{
|
||||
echo "Eingabefehler. Bitte alle Felder korekt ausfüllen. <a href=\"eintragen.html\">Zurück</a>";
|
||||
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 <b>$username</b> wurde erstellt. <a href=\"index.php\">Login</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Fehler beim Speichern des Benutzernames. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo "Benutzername schon vorhanden. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,58 +1,111 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Escape Velocity by HTML5 UP
|
||||
html5up.net | @n33co
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
-->
|
||||
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(($_SESSION["username"])!="Kevin")
|
||||
if(!isset($_SESSION["username"]))
|
||||
{
|
||||
echo "Sie sind nicht berechtigt fuer diesen Bereich";
|
||||
echo "Bitte erst <a href='login.html'>einloggen</a>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
require_once ("config.php");
|
||||
require_once ("tpl/parser.php");
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$verbindung = mysql_connect("localhost", "root" , "kevin21")
|
||||
or die("Verbindung zur Datenbank konnte nicht hergestellt werden");
|
||||
|
||||
mysql_select_db("login") or die ("Datenbank konnte nicht ausgewählt werden");
|
||||
|
||||
$username = $_POST["username"];
|
||||
$passwort = $_POST["passwort"];
|
||||
$passwort2 = $_POST["passwort2"];
|
||||
|
||||
if($passwort != $passwort2 OR $username == "" OR $passwort == "")
|
||||
{
|
||||
echo "Eingabefehler. Bitte alle Felder korekt ausfüllen. <a href=\"eintragen.html\">Zurück</a>";
|
||||
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 <b>$username</b> wurde erstellt. <a href=\"login.html\">Login</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Fehler beim Speichern des Benutzernames. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo "Benutzername schon vorhanden. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
require_once ("tpl/mysql.class.php");
|
||||
$db = new Database($dbhost, $dbuser, $dbpassword, $database, 1); //Show Error = 1!
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>BOSwatch</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/jquery.dropotron.min.js"></script>
|
||||
<script src="js/skel.min.js"></script>
|
||||
<script src="js/skel-layers.min.js"></script>
|
||||
<script src="js/init.js"></script>
|
||||
<noscript>
|
||||
<link rel="stylesheet" href="css/skel.css" />
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="css/style-desktop.css" />
|
||||
</noscript>
|
||||
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
|
||||
</head>
|
||||
<body class="no-sidebar">
|
||||
|
||||
<!-- Header -->
|
||||
<div id="header-wrapper" class="wrapper">
|
||||
<div id="header">
|
||||
|
||||
|
||||
|
||||
<!-- Nav -->
|
||||
<nav id="nav">
|
||||
<ul>
|
||||
<li><a href="show_pocsag.php">POCSAG</a></li>
|
||||
<li><a href="show_fms.php">FMS</a></li>
|
||||
<li><a href="show_zvei.php">ZVEI</a></li>
|
||||
<li><a href="prefs.php">Einstellungen</a></li>
|
||||
<li><a href="eintragen.php">Nutzer anlegen</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Highlights -->
|
||||
<div class="wrapper style1">
|
||||
<div class="title">Usermanagment</div>
|
||||
<div class="container">
|
||||
|
||||
<div style="width: 400px;margin-left:auto;margin-right:auto;text-align:center;">
|
||||
|
||||
<form action="do_eintragen.php" method="post">
|
||||
Username:<br>
|
||||
<input type="text" size="12"
|
||||
name="username"><br>
|
||||
|
||||
Passwort:<br>
|
||||
<input type="password" size="24" maxlength="50"
|
||||
name="passwort"><br>
|
||||
|
||||
Passwort wiederholen:<br>
|
||||
<input type="password" size="24" maxlength="50"
|
||||
name="passwort2"><br>
|
||||
|
||||
<input type="submit" value="Abschicken">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="copyright">
|
||||
<ul>
|
||||
<li style="color:grey;">© BOSWatch</li><li style="color:grey;">Design: <a href="http://html5up.net">HTML5 UP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ $db = new Database($dbhost, $dbuser, $dbpassword, $database, 1); //Show Error =
|
|||
|
||||
<!-- Logo -->
|
||||
<div id="logo">
|
||||
<h1><a href="index.html">Willkommen bei BOSWatch</a></h1>
|
||||
<h1><a href="index.php">Willkommen bei BOSWatch</a></h1>
|
||||
</div>
|
||||
|
||||
<!-- Nav -->
|
||||
|
|
@ -75,6 +75,14 @@ Dein Passwort:<br>
|
|||
<input type="password" size="24" maxlength="50"
|
||||
name="password"><br>
|
||||
|
||||
Startanzeige:<br>
|
||||
<select name="view">
|
||||
<option value="pocsag">POCSAG</option>
|
||||
<option value="fms">FMS</option>
|
||||
<option value="zvei">ZVEI</option>
|
||||
</select><br>
|
||||
|
||||
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
|
||||
|
|
@ -100,4 +108,4 @@ name="password"><br>
|
|||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -4,25 +4,44 @@ session_start();
|
|||
|
||||
<?php
|
||||
require_once ("config.php");
|
||||
$verbindung = mysql_connect($dbhost, $dbuser , $dbpassword)
|
||||
$verbindung = mysqli_connect($dbhost, $dbuser , $dbpassword)
|
||||
or die("Verbindung zur Datenbank konnte nicht hergestellt werden");
|
||||
mysql_select_db($tableLOG) or die ("Datenbank konnte nicht ausgewählt werden");
|
||||
mysqli_select_db($verbindung, $database) or die ("Datenbank konnte nicht ausgewählt werden");
|
||||
|
||||
if (!isset($_POST["username"]) XOR !isset($_POST["password"]))
|
||||
{
|
||||
echo "Fehlende Eingaben - <a href='index.php'>Login</a>";
|
||||
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. <a href=\"login.html\">Login</a>";
|
||||
echo "Benutzername und/oder Passwort waren falsch. <a href=\"index.php\">Login</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
6
exampleAddOns/alarmMonitorWeb/logout.php
Normal file
6
exampleAddOns/alarmMonitorWeb/logout.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
session_unset();
|
||||
header("Location: index.php");
|
||||
|
||||
?>
|
||||
|
|
@ -11,7 +11,7 @@ session_start();
|
|||
?>
|
||||
|
||||
<?php
|
||||
if(($_SESSION["username"])!="Test")
|
||||
if(($_SESSION["username"])!="admin")
|
||||
{
|
||||
echo "Sie sind nicht berechtigt fuer diesen Bereich";
|
||||
exit;
|
||||
|
|
@ -27,7 +27,7 @@ include("tpl/a_header.php");
|
|||
<div class="wrapper style3">
|
||||
<div class="title">Einstellungen</div>
|
||||
<div id="highlights" class="container" style="">
|
||||
|
||||
<!--
|
||||
<tr>
|
||||
<td>Filter Range Start:</td><td>
|
||||
<input type="text" size="24" maxlength="50" value="
|
||||
|
|
@ -43,7 +43,7 @@ $ini_array = parse_ini_file("config.ini");
|
|||
echo($ini_array['filter_range_end']);
|
||||
?>
|
||||
"></td>
|
||||
</tr>
|
||||
</tr>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -60,4 +60,4 @@ echo($ini_array['filter_range_end']);
|
|||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue