commit 7cd04e2a52a25208236f8a8ebe6b5280f5ad2ee5
Author: max
" . $conn->error;
+ }
+}
+
+$conn->close();
+?>
+
+
+
+
+ Add New Restaurant
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/add_review.php b/add_review.php
new file mode 100644
index 0000000..600ca5a
--- /dev/null
+++ b/add_review.php
@@ -0,0 +1,70 @@
+ 10) {
+ $review_error = "Rating must be between 0 and 10.";
+ } else {
+ $sql = "INSERT INTO Bewertung (fk_user_id, fk_restaurant_id, bewertung, bewertung_str) VALUES ($fk_user_id, $fk_restaurant_id, $bewertung_int, '$bewertung_str')";
+
+ if ($conn->query($sql) === TRUE) {
+ $review_success = "Review added successfully!";
+ } else {
+ $review_error = "Error: " . $sql . "
" . $conn->error;
+ }
+ }
+}
+
+// Fetch restaurants for the dropdown
+$restaurants_sql = "SELECT id, name FROM Restaurant";
+$restaurants_result = $conn->query($restaurants_sql);
+$restaurants = [];
+if ($restaurants_result->num_rows > 0) {
+ while ($row = $restaurants_result->fetch_assoc()) {
+ $restaurants[$row['id']] = $row['name'];
+ }
+}
+
+$conn->close();
+?>
+
+
+
+
+ Add New Review
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/central.css b/central.css
new file mode 100644
index 0000000..7b8c026
--- /dev/null
+++ b/central.css
@@ -0,0 +1,136 @@
+/* central.css */
+
+/* General Styles */
+body {
+ font-family: sans-serif;
+ margin: 20px;
+ background-color: #f4f4f4;
+ color: #333;
+}
+
+h1, h2, h3 {
+ color: #337ab7;
+}
+
+a {
+ color: #337ab7;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+p {
+ line-height: 1.6;
+ margin-bottom: 15px;
+}
+
+/* Form Styles */
+form {
+ background-color: #fff;
+ padding: 20px;
+ border: 1px solid #ddd;
+ border-radius: 5px;
+ margin-bottom: 20px;
+}
+
+label {
+ display: block;
+ margin-bottom: 5px;
+ font-weight: bold;
+}
+
+input[type="text"],
+input[type="password"],
+input[type="number"],
+select,
+textarea {
+ width: calc(100% - 12px); /* Adjust for padding */
+ padding: 8px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-sizing: border-box; /* Ensure padding and border are inside the element's total width and height */
+ font-size: 1em;
+}
+
+input[type="submit"] {
+ background-color: #5cb85c;
+ color: white;
+ padding: 10px 15px;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 1em;
+}
+
+input[type="submit"]:hover {
+ background-color: #4cae4c;
+}
+
+.error {
+ color: red;
+ margin-bottom: 10px;
+}
+
+.success {
+ color: green;
+ margin-bottom: 10px;
+}
+
+/* Navigation Styles (if you add a navigation later) */
+nav ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ background-color: #333;
+ overflow: hidden;
+ border-radius: 5px;
+ margin-bottom: 20px;
+}
+
+nav ul li {
+ float: left;
+}
+
+nav ul li a {
+ display: block;
+ color: white;
+ text-align: center;
+ padding: 14px 16px;
+ text-decoration: none;
+}
+
+nav ul li a:hover {
+ background-color: #111;
+}
+
+/* Table Styles (if you display data in tables) */
+table {
+ width: 100%;
+ border-collapse: collapse;
+ margin-bottom: 20px;
+ border: 1px solid #ddd;
+}
+
+th, td {
+ border: 1px solid #ddd;
+ padding: 8px;
+ text-align: left;
+}
+
+th {
+ background-color: #f2f2f2;
+ font-weight: bold;
+}
+
+/* Specific elements for your pages */
+/* You can add more specific styles here as needed */
+
+/* Example for the welcome message on index.php */
+.welcome-message {
+ margin-bottom: 20px;
+ font-size: 1.2em;
+ font-weight: bold;
+}
\ No newline at end of file
diff --git a/db_connection.php b/db_connection.php
new file mode 100644
index 0000000..462aa68
--- /dev/null
+++ b/db_connection.php
@@ -0,0 +1,16 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+} catch (PDOException $e) {
+ die("Database connection failed: " . $e->getMessage());
+}
+
+// Function to sanitize user input (remains the same)
+function sanitize_input($data) {
+ $data = trim($data);
+ $data = stripslashes($data);
+ return htmlspecialchars($data);
+}
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..cf1bc2a
--- /dev/null
+++ b/index.php
@@ -0,0 +1,13 @@
+Add Restaurant
Don't have an account? Register here
+ + \ No newline at end of file diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..f359438 --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/register.php b/register.php new file mode 100644 index 0000000..694e270 --- /dev/null +++ b/register.php @@ -0,0 +1,55 @@ +query($check_sql); + + if ($check_result->num_rows > 0) { + $registration_error = "Username already exists. Please choose a different one."; + } else { + $sql = "INSERT INTO User (vorname, nachname, username, password) VALUES ('$vorname', '$nachname', '$username', '$hashed_password')"; + + if ($conn->query($sql) === TRUE) { + $registration_success = "Registration successful! You can now login."; + } else { + $registration_error = "Error: " . $sql . "Already have an account? Login here
+ + \ No newline at end of file