mirror of
https://github.com/JannikKoester/Tischverwaltung.git
synced 2026-01-09 14:20:08 +01:00
install.php hinzugefügt/sql Dump entfernt
This commit is contained in:
58
index.php
58
index.php
@@ -13,7 +13,7 @@ if (session_status() == PHP_SESSION_NONE) {
|
|||||||
require 'settings.php';
|
require 'settings.php';
|
||||||
require 'modal.php';
|
require 'modal.php';
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -215,10 +215,34 @@ require 'modal.php';
|
|||||||
<div>
|
<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">
|
<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>
|
<li>
|
||||||
<div id="table3">
|
<div id="table3">
|
||||||
<?php
|
<?php
|
||||||
@@ -228,12 +252,12 @@ require 'modal.php';
|
|||||||
{
|
{
|
||||||
if($_SESSION["Tisch3"] == "FREI" || $_SESSION["Tisch3"][6] != $_SESSION["year"] )
|
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
|
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 +326,7 @@ require 'modal.php';
|
|||||||
|
|
||||||
<div class="left-tables">
|
<div class="left-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;">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>
|
<li>
|
||||||
|
|
||||||
|
|||||||
107
install.php
Normal file
107
install.php
Normal 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) {
|
||||||
|
die("Connection failed: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>';
|
||||||
|
fwrite($settingsfile, $txt);
|
||||||
|
fclose($settingsfile);
|
||||||
|
|
||||||
|
echo '<div class="alert alert-success">
|
||||||
|
Die Datenbank wurde erfolgreich erstellt!
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
header("location:index.php");
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -18,8 +18,9 @@
|
|||||||
<div class="collapse navbar-collapse"
|
<div class="collapse navbar-collapse"
|
||||||
id="navcol-1">
|
id="navcol-1">
|
||||||
<ul class="nav navbar-nav">
|
<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>
|
</ul>
|
||||||
|
<!--
|
||||||
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
|
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
|
||||||
<ul class="navbar-nav ml-auto">
|
<ul class="navbar-nav ml-auto">
|
||||||
<form class="form-inline" action="/action_page.php">
|
<form class="form-inline" action="/action_page.php">
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
29
settings.php
29
settings.php
@@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$servername = "localhost";
|
||||||
$servername = "localhost";
|
$username = "root";
|
||||||
$username = "root";
|
$password = "";
|
||||||
$password = "";
|
$db = "calender";
|
||||||
$db = "calender";
|
|
||||||
|
|
||||||
// Create connection
|
// Create connection
|
||||||
$conn = new mysqli($servername, $username, $password,$db);
|
$conn = new mysqli($servername, $username, $password,$db);
|
||||||
|
// Check connection
|
||||||
// Check connection
|
if ($conn->connect_error) {
|
||||||
if ($conn->connect_error) {
|
die("Connection failed: " . $conn->connect_error);
|
||||||
die("Connection failed: " . $conn->connect_error);
|
}
|
||||||
}
|
|
||||||
|
?>
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user