funktionierender login/logout
This commit is contained in:
parent
e727f0e97e
commit
08d5f3c68f
37
login.php
37
login.php
|
@ -2,16 +2,49 @@
|
||||||
require_once 'general.php';
|
require_once 'general.php';
|
||||||
|
|
||||||
returnHeader();
|
returnHeader();
|
||||||
|
session_start();
|
||||||
$config = getConfig();
|
$config = getConfig();
|
||||||
|
|
||||||
if (isset($_POST['login']) && !empty($_POST['username'])
|
if (isset($_POST['user']) && !empty($_POST['user'])
|
||||||
&& !empty($_POST['password'])) {
|
&& !empty($_POST['password'])) {
|
||||||
|
|
||||||
if ($_POST['user'] == $config['user'] && $_POST['password'] == $config['password']) {
|
if ($_POST['user'] == $config['user'] && $_POST['password'] == $config['password']) {
|
||||||
$_SESSION['timeout'] = time();
|
$_SESSION['user'] = "Hello World";
|
||||||
|
header('Location: ' . $config['url'] . '/overview.php');
|
||||||
|
die();//https://thedailywtf.com/articles/WellIntentioned-Destruction
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "passwort nicht akzeptiert";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column col-2"></div>
|
||||||
|
<div class="column col-8">
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="user">Benutzer</label>
|
||||||
|
<input type="text" name="user" id="user" required="required" class="form-input">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="password">Passwort</label>
|
||||||
|
<input type="password" name="password" id="password" required="required" class="form-input">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn">Anmelden</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
returnFooter();
|
returnFooter();
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'general.php';
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
$config = getConfig();
|
||||||
|
|
||||||
|
header('Location: ' . $config['url'] . '/');
|
|
@ -27,7 +27,7 @@ $entries = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
<div class="md:mt-6 top-0 right-0 absolute">
|
<div class="md:mt-6 top-0 right-0 absolute">
|
||||||
<button class="bg-blue-500 px-2 py-2 text-lg font-semibold tracking-wider text-white rounded hover:bg-blue-600">als CSV exportieren</button>
|
<button class="bg-blue-500 px-2 py-2 text-lg font-semibold tracking-wider text-white rounded hover:bg-blue-600">als CSV exportieren</button>
|
||||||
<button class="bg-blue-500 px-4 py-2 text-lg font-semibold tracking-wider text-white rounded hover:bg-blue-600">ausloggen</button>
|
<a href="logout.php" class="bg-blue-500 px-4 py-2 text-lg font-semibold tracking-wider text-white rounded hover:bg-blue-600">ausloggen</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="overviewTable" class="display">
|
<table id="overviewTable" class="display">
|
||||||
|
|
Loading…
Reference in New Issue