From 1d3febeec157fd75cb9b7997fa34267cc6142929 Mon Sep 17 00:00:00 2001
From: max Database initialized successfully! Database already exists.
" . $conn->error;
- }
-}
-
-$conn->close();
-?>
-
-
-
-
- Add New Restaurant
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/central.css b/central.css
index 7b8c026..192d1cb 100644
--- a/central.css
+++ b/central.css
@@ -128,7 +128,7 @@ th {
/* Specific elements for your pages */
/* You can add more specific styles here as needed */
-/* Example for the welcome message on index.php */
+/* Example for the welcome message on index.html */
.welcome-message {
margin-bottom: 20px;
font-size: 1.2em;
diff --git a/db_connection.php b/db_connection.php
deleted file mode 100644
index 51c55e1..0000000
--- a/db_connection.php
+++ /dev/null
@@ -1,60 +0,0 @@
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-
- // Check if the User table exists
- $result = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='User'");
- $userTableExists = $result->fetchColumn();
-
- if (!$userTableExists) {
- // Initialize the database structure
- $db->exec("
- CREATE TABLE User (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- vorname TEXT NOT NULL,
- nachname TEXT NOT NULL,
- username TEXT UNIQUE NOT NULL,
- password TEXT NOT NULL
- )
- ");
-
- $db->exec("
- CREATE TABLE Restaurant (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- name TEXT NOT NULL,
- maps_link TEXT
- )
- ");
-
- $db->exec("
- CREATE TABLE Bewertung (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- fk_user_id INTEGER NOT NULL,
- fk_restaurant_id INTEGER NOT NULL,
- bewertung INTEGER NOT NULL CHECK (bewertung BETWEEN 0 AND 10),
- bewertung_str TEXT,
- FOREIGN KEY (fk_user_id) REFERENCES User(id),
- FOREIGN KEY (fk_restaurant_id) REFERENCES Restaurant(id)
- )
- ");
-
- echo "Add New Restaurant
+
+
+
\ No newline at end of file
diff --git a/htmls/chart.html b/htmls/chart.html
new file mode 100644
index 0000000..0b359ab
--- /dev/null
+++ b/htmls/chart.html
@@ -0,0 +1,81 @@
+Restaurant Tier List
+Login
+
+
+
\ No newline at end of file
diff --git a/htmls/overview.html b/htmls/overview.html
new file mode 100644
index 0000000..4ef476c
--- /dev/null
+++ b/htmls/overview.html
@@ -0,0 +1,21 @@
+Restaurant Overview
+Request Account
+
+
+
+
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..b1f6481
--- /dev/null
+++ b/index.html
@@ -0,0 +1,268 @@
+
+
+
+
+
+
Don't have an account? Register here
- - \ No newline at end of file diff --git a/logout.php b/logout.php deleted file mode 100644 index f359438..0000000 --- a/logout.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/php/add_restaurant.php b/php/add_restaurant.php new file mode 100644 index 0000000..b7f797d --- /dev/null +++ b/php/add_restaurant.php @@ -0,0 +1,29 @@ + false, 'error' => 'Not logged in.']); + exit(); +} + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + $name = sanitize_input($_POST['name']); + $maps_link = sanitize_input($_POST['maps_link']); + + $stmt = $db->prepare("INSERT INTO Restaurant (name, maps_link) VALUES (:name, :maps_link)"); + $stmt->bindParam(':name', $name); + $stmt->bindParam(':maps_link', $maps_link); + + if ($stmt->execute()) { + echo json_encode(['success' => true, 'message' => 'Restaurant added successfully!']); + exit(); + } else { + echo json_encode(['success' => false, 'error' => 'Error: ' . print_r($stmt->errorInfo(), true)]); + exit(); + } +} else { + echo json_encode(['success' => false, 'error' => 'Invalid request method.']); + exit(); +} +?> \ No newline at end of file diff --git a/add_review.php b/php/add_review.php similarity index 97% rename from add_review.php rename to php/add_review.php index 600ca5a..3d5b05d 100644 --- a/add_review.php +++ b/php/add_review.php @@ -65,6 +65,6 @@ $conn->close(); Review Text: