mirror of
http://git.frickel.earth/Tysox/BOS-Pinneberg.git
synced 2025-12-15 22:34:22 +01:00
[+] Admin Webinterface
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: tom
|
||||
* Date: 03.10.16
|
||||
* Time: 16:54
|
||||
*/
|
||||
$pass = hash('sha512', 'Semikolon1!eZ');
|
||||
echo $pass;
|
||||
8
admin/scripts/check.php
Normal file
8
admin/scripts/check.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: tom
|
||||
* Date: 03.10.16
|
||||
* Time: 18:30
|
||||
*/
|
||||
phpinfo();
|
||||
50
admin/scripts/login.php
Normal file
50
admin/scripts/login.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
session_start();
|
||||
include '../config/config.inc.php';
|
||||
$data = new Config();
|
||||
|
||||
try{
|
||||
$pdo = new PDO('mysql:host=' . $data->getSQLHost() . ';dbname=' . $data->getSQLDatabase() . ';charset=utf8mb4', $data->getSQLUser(), $data->getSQLPassword());
|
||||
}catch(PDOException $exception) {
|
||||
echo "Fehler: ".$exception->getMessage();
|
||||
exit;
|
||||
}
|
||||
if ($_POST) {
|
||||
|
||||
if (isset($_POST['username'], $_POST['password'])) {
|
||||
if ($_POST["username"] AND $_POST["password"]) {
|
||||
$pass = hash('sha512', $_POST['password']);
|
||||
$usr = $_POST['username'];
|
||||
$query = $pdo->prepare("SELECT username, password FROM users WHERE username=:username AND password=:password");
|
||||
$query->bindParam(':username', $usr);
|
||||
$query->bindParam(':password', $pass);
|
||||
$query->execute();
|
||||
$row = $query->fetch();
|
||||
if ($row['password'] == $pass) {
|
||||
$_SESSION['status'] = 'logged_in';
|
||||
$_SESSION["Name"] = $_POST['username'];
|
||||
echo "Erfolgreich eingeloggt.";
|
||||
} else {
|
||||
echo "Falscher Benutzername oder Passowrt.";
|
||||
}
|
||||
} else {
|
||||
echo "Bitte gebe den Nutzernamen oder das Passwort ein.";
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "ERROR keine Daten empfangen";
|
||||
}
|
||||
|
||||
if ($_SESSION['status'] == 'logged_in') { ?>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
setTimeout("window.location.href='index.php'", 1000);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
23
admin/scripts/logout.php
Normal file
23
admin/scripts/logout.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Jan
|
||||
* Date: 27.09.2016
|
||||
* Time: 19:12
|
||||
*/
|
||||
session_start();
|
||||
session_destroy();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<meta http-equiv="refresh" content="0; URL=../login.php">
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user