1
0
mirror of https://github.com/JannikKoester/Tischverwaltung.git synced 2026-01-09 14:20:08 +01:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Jannik
8d752a381b . 2020-08-19 12:30:57 +03:00
Jannik
48ba18da23 . 2020-08-19 11:50:16 +03:00
Jannik
00866d0c65 errorhandling hinzugefügt 2020-08-19 11:33:26 +03:00
JannikKoester
7fe58aa025 neuerung 2020-08-18 17:08:29 +02:00
JannikKoester
23b3cccc28 install.php hinzugefügt/sql Dump entfernt 2020-08-18 09:53:19 +02:00
6 changed files with 162 additions and 61 deletions

View File

@@ -1,15 +1,11 @@
body {
background: url(../../assets/img/mountain_bg.jpg) #444;
background-size: cover;
background: url(../../assets/img/mountain_bg.jpg) blue;
height:100%;
padding-bottom: 80px;
background-repeat:no-repeat;
}
@media (min-width:768px) {
.header-dark {
}
}
.header-dark .navbar {
background: transparent;

View File

@@ -1,6 +1,11 @@
<!DOCTYPE html>
<body>
<?php
if(!file_exists("settings.php"))
{
header("location:install.php");
}
require 'required/header.php';
if (session_status() == PHP_SESSION_NONE) {
@@ -13,7 +18,8 @@ if (session_status() == PHP_SESSION_NONE) {
require 'settings.php';
require 'modal.php';
?>
<div class="container">
<div class="container-fluid">
<?php
@@ -215,10 +221,34 @@ require 'modal.php';
<div>
<div class="container" style="background-color:lightgrey;opacity: 0.6;border:solid;" >
<div class="container-fluid" style="background-color:lightgrey;opacity: 0.6;border:solid; width:800px;" >
<div class="right-tables">
<ul>
<ul> <li>
<div id="table4">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch4"] == "FREI")
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal4" style="color:green; width:120px;">Tisch 4 <br> ist frei.</button>';
}
else
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change4" style="color:red;width:120px;" >Tisch 4 ist belegt durch <br>'.$_SESSION["Tisch4"][4].'.</button>';
}
}
}
?>
</div>
</li>
<li>
<div id="table3">
<?php
@@ -228,12 +258,12 @@ require 'modal.php';
{
if($_SESSION["Tisch3"] == "FREI" || $_SESSION["Tisch3"][6] != $_SESSION["year"] )
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal3" style="color:green;opacity: 1.5;">Tisch 3 <br> ist frei.</button>';
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal3" style="color:green;opacity: 1.5;width:120px;">Tisch 3 <br> ist frei.</button>';
}
else
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change3" style="color:red;">Tisch 3 ist belegt durch <br>'.$_SESSION["Tisch3"][4].'.</button>';
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change3" style="color:red;width:120px;">Tisch 3 ist belegt durch <br>'.$_SESSION["Tisch3"][4].'.</button>';
}
@@ -302,31 +332,7 @@ require 'modal.php';
<div class="left-tables">
<ul>
<li>
<div id="table4">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch4"] == "FREI")
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal4" style="color:green;">Tisch 4 <br> ist frei.</button>';
}
else
{
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change4" style="color:red;" >Tisch 4 ist belegt durch <br>'.$_SESSION["Tisch4"][4].'.</button>';
}
}
}
?>
</div>
</li>
<li>

107
install.php Normal file
View File

@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Installer</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="container margin:0 auto;" style="width:800px;">
<form method="post">
<div class="form-group">
<label for="DBHost">Host</label>
<input type="text" class="form-control" name="dbhost" placeholder="localhost"required>
</div>
<div class="form-group">
<label for="DBUser">DB-User</label>
<input type="text" class="form-control" name="dbuser" placeholder="root"required>
</div>
<div class="form-group">
<label for="DBPW">DB-Password</label>
<input type="text" class="form-control" name="dbpw" placeholder="Database Password">
</div>
<button type="submit" name="dbConfigBtn" class="btn btn-primary">Weiter</button>
</form>
</div>
<?php
if(isset($_POST['dbConfigBtn']))
{
//Create Database and Tables
$servername = $_POST['dbhost'];
$username = $_POST['dbuser'];
$password = $_POST['dbpw'];
$db = 'calender';
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE calender";
if ($conn->query($sql) === TRUE) {
//echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
$conn->close();
$conn2 = new mysqli($servername, $username, $password,$db);
// Create Tables
$sql = "CREATE TABLE `calenderplanner` (
`uniqueid` int(16) NOT NULL AUTO_INCREMENT,
`year` int(16) NOT NULL,
`month` int(16) NOT NULL,
`day` int(16) NOT NULL,
`reserviert` int(16) NOT NULL,
`reserviertvon` varchar(16) NOT NULL,
`tisch` int(16) NOT NULL,
PRIMARY KEY (`uniqueid`)
)";
if ($conn2->query($sql) === TRUE) {
//echo "Tables created successfully";
} else {
echo "Error creating database: " . $conn2->error;
}
$conn2->close();
//Create Database and Tables Ende
$settingsfile = fopen("settings.php", "w") or die("Unable to open file!");
$txt = '<?php
$servername = "'.$_POST['dbhost'].'";
$username = "'.$_POST['dbuser'].'";
$password = "'.$_POST['dbpw'].'";
$db = "calender";
// Create connection
$conn = new mysqli($servername, $username, $password,$db);
// Check connection
if ($conn->connect_error) {
header("location:install.php");
}
?>';
fwrite($settingsfile, $txt);
fclose($settingsfile);
echo '<div class="alert alert-success">
Die Datenbank wurde erfolgreich erstellt!
</div>';
header("location:index.php");
}
?>
</body>
</html>

View File

@@ -13,14 +13,5 @@
<link rel="stylesheet" href="assets/css/styles.css">
</head>
<div class="footer-dark">
<footer>
<div class="container">
<div class="row">
</div>
<p class="copyright">Rene Knipschild © 2020</p>
</div>
</footer>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>

View File

@@ -18,8 +18,9 @@
<div class="collapse navbar-collapse"
id="navcol-1">
<ul class="nav navbar-nav">
<li class="nav-item" role="presentation"><a class="nav-link" href="#">Home</a></li>
<li class="nav-item" role="presentation"><a class="nav-link" href="#">Tischverwaltung</a></li>
</ul>
<!--
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul class="navbar-nav ml-auto">
<form class="form-inline" action="/action_page.php">
@@ -29,6 +30,7 @@
</form>
</ul>
</div>
-->
</nav>
</div>

View File

@@ -1,16 +1,15 @@
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "calender";
// Create connection
$conn = new mysqli($servername, $username, $password,$db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
$servername = "localhost";
$username = "root";
$password = "";
$db = "calender";
// Create connection
$conn = new mysqli($servername, $username, $password,$db);
// Check connection
if ($conn->connect_error) {
header("location:install.php");
}
?>