BOSWatch/exampleAddOns/alarmMonitorWeb/login.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2015-07-13 23:33:36 +02:00
<?php
session_start();
?>
<?php
require_once ("config.php");
$verbindung = mysqli_connect($dbhost, $dbuser , $dbpassword)
2015-07-13 23:33:36 +02:00
or die("Verbindung zur Datenbank konnte nicht hergestellt 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;
}
2015-07-13 23:33:36 +02:00
$username = $_POST["username"];
$passwort = md5($_POST["password"]);
$abfrage = "SELECT username, passwort FROM ".$tableLOG." WHERE username LIKE '$username' LIMIT 1";
$ergebnis = mysqli_query($verbindung, $abfrage);
$row = mysqli_fetch_object($ergebnis);
2015-07-13 23:33:36 +02:00
if($row->passwort == $passwort)
{
$_SESSION["username"] = $username;
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");
}
2015-07-13 23:33:36 +02:00
}
else
{
echo "Benutzername und/oder Passwort waren falsch. <a href=\"index.php\">Login</a>";
2015-07-13 23:33:36 +02:00
}
?>