diff --git a/admin_restaurants.php b/admin_restaurants.php new file mode 100644 index 0000000..2509949 --- /dev/null +++ b/admin_restaurants.php @@ -0,0 +1,156 @@ + + + + + + Admin - Manage Restaurants + + + + + + + + + +
+
+

Manage Restaurants

+ +
+ +
+
+ + + + + + + + + + + + + query("SELECT * FROM restaurants ORDER BY id DESC"); + $restaurants = $stmt->fetchAll(); + foreach ($restaurants as $restaurant) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ''; + echo ""; + } + } catch (PDOException $e) { + echo ""; + } + ?> + +
IDNameAddressPhoneEmailActions
" . htmlspecialchars($restaurant['id']) . "" . htmlspecialchars($restaurant['name']) . "" . htmlspecialchars($restaurant['address']) . "" . htmlspecialchars($restaurant['phone']) . "" . htmlspecialchars($restaurant['email']) . " + + +
Error: " . $e->getMessage() . "
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/restaurants.php b/api/restaurants.php new file mode 100644 index 0000000..9c76102 --- /dev/null +++ b/api/restaurants.php @@ -0,0 +1,40 @@ + false, 'error' => 'Invalid action']); + break; +} + +function handle_create() { + $data = json_decode(file_get_contents('php://input'), true); + + if (empty($data['name']) || empty($data['address']) || empty($data['phone']) || empty($data['email'])) { + echo json_encode(['success' => false, 'error' => 'All fields are required.']); + return; + } + + try { + $pdo = db(); + $sql = "INSERT INTO restaurants (name, address, phone, email) VALUES (:name, :address, :phone, :email)"; + $stmt = $pdo->prepare($sql); + $stmt->execute([ + ':name' => $data['name'], + ':address' => $data['address'], + ':phone' => $data['phone'], + ':email' => $data['email'], + ]); + + echo json_encode(['success' => true]); + } catch (PDOException $e) { + echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]); + } +} diff --git a/index.php b/index.php index 7205f3d..b893b6f 100644 --- a/index.php +++ b/index.php @@ -83,30 +83,9 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); } - .loader { - margin: 1.25rem auto 1.25rem; - width: 48px; - height: 48px; - border: 3px solid rgba(255, 255, 255, 0.25); - border-top-color: #fff; - border-radius: 50%; - animation: spin 1s linear infinite; - } - @keyframes spin { - from { transform: rotate(0deg); } - to { transform: rotate(360deg); } - } .hint { opacity: 0.9; } - .sr-only { - position: absolute; - width: 1px; height: 1px; - padding: 0; margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - white-space: nowrap; border: 0; - } h1 { font-size: 3rem; font-weight: 700; @@ -129,18 +108,33 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; font-size: 0.8rem; opacity: 0.7; } + .btn { + display: inline-block; + padding: 0.75rem 1.5rem; + background-color: var(--bg-color-end); + color: var(--text-color); + text-decoration: none; + border-radius: 8px; + transition: background-color 0.3s; + border: none; + font-size: 1rem; + font-weight: 500; + cursor: pointer; + } + .btn:hover { + background-color: #1e5fa5; + }
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+

Welcome to Your New Application!

+

This is the starting point of your project.

+

+ Manage Restaurants +

+

Runtime: PHP — UTC