1
0
mirror of https://github.com/JannikKoester/Tischverwaltung.git synced 2026-01-09 22:30:08 +01:00
Files
Tischverwaltung/login.php
JannikKoester 90155483d8 neues Design
2020-08-17 16:44:21 +02:00

38 lines
1018 B
PHP

<?php
require 'settings.php';
require 'getTables.php';
session_start();
if(isset($_POST['loginBtn'])){
$uname = $_POST['uname'];
$pw = $_POST['pw'];
//Check if User exists
$sql = "SELECT * FROM users WHERE users='$uname' AND password='$pw'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$_SESSION["LoggedInUser"] = array($row['uniqueid'],$row['users']);
header("location:index.php?result=loggedin");
}
$_SESSION["month"] = '';
$_SESSION["month_string"] = '';
$_SESSION["day"] = '';
$_SESSION["day_string"] = '';
}
else
{
header("location:index.php?result=gotrecords");
$_SESSION["accnotfound"] = '<div class="alert alert-danger">
Benutzername oder Passwort falsch!</div>';
}
// echo $pw .$uname;
//header("location:index.php?result=gotrecords");
}
else
{
header("location:index.php");
}