From a15a30927edefb0eef418de3e7cdfe6d85b3e89f Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 22 Nov 2025 14:52:53 +0000 Subject: [PATCH] Auto commit: 2025-11-22T14:52:53.002Z --- assets/css/custom.css | 46 ++++ db/config.php | 11 + db/migrate.php | 5 + db/migrations/001_create_products_table.sql | 8 + db/seed.php | 51 +++++ index.php | 235 ++++++++------------ 6 files changed, 215 insertions(+), 141 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 db/migrate.php create mode 100644 db/migrations/001_create_products_table.sql create mode 100644 db/seed.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..7268db2 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,46 @@ +body { + font-family: 'Lato', sans-serif; + color: #343A40; +} + +.navbar-brand, .footer-text { + font-family: 'Playfair Display', serif; +} + +.product-card { + border: 1px solid #eee; + border-radius: 0.5rem; + transition: all 0.3s ease-in-out; +} + +.product-card:hover { + transform: translateY(-5px); + box-shadow: 0 4px 15px rgba(0,0,0,0.1); +} + +.product-card .card-img-top { + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; + height: 200px; + object-fit: cover; +} + +.btn-primary { + background-color: #C0A080; + border-color: #C0A080; +} + +.btn-primary:hover { + background-color: #A98B6C; + border-color: #A98B6C; +} + +.btn-outline-secondary { + color: #C0A080; + border-color: #C0A080; +} + +.btn-outline-secondary:hover { + background-color: #C0A080; + color: #fff; +} diff --git a/db/config.php b/db/config.php index e10b154..38a587e 100644 --- a/db/config.php +++ b/db/config.php @@ -15,3 +15,14 @@ function db() { } return $pdo; } + +function run_migrations() { + $pdo = db(); + $migrationsDir = __DIR__ . '/migrations'; + $files = glob($migrationsDir . '/*.sql'); + foreach ($files as $file) { + $sql = file_get_contents($file); + $pdo->exec($sql); + echo "Executed migration: " . basename($file) . "\n"; + } +} diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..02e54e5 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,5 @@ +query("SELECT COUNT(*) FROM products"); + if ($stmt->fetchColumn() > 0) { + echo "Products table is not empty. Skipping seeding.\n"; + return; + } + + $products = [ + [ + 'name' => 'Gilded Napkin Ring', + 'description' => 'A touch of elegance for your dining table. These gilded napkin rings are perfect for special occasions.', + 'price' => 12.99, + 'image_url' => 'https://images.pexels.com/photos/1034662/pexels-photo-1034662.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1' + ], + [ + 'name' => 'Modern Candle Stand', + 'description' => 'Sleek and minimalist candle stand, crafted from brushed metal. A perfect centerpiece.', + 'price' => 39.99, + 'image_url' => 'https://images.pexels.com/photos/3747505/pexels-photo-3747505.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1' + ], + [ + 'name' => 'Rustic Wooden Coasters', + 'description' => 'Set of four handcrafted wooden coasters. Protect your surfaces with a touch of rustic charm.', + 'price' => 19.99, + 'image_url' => 'https://images.pexels.com/photos/1309766/pexels-photo-1309766.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1' + ], + [ + 'name' => 'Ceramic Bud Vase', + 'description' => 'A small, elegant ceramic vase for single stems or small bouquets. Available in various colors.', + 'price' => 24.99, + 'image_url' => 'https://images.pexels.com/photos/1103970/pexels-photo-1103970.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1' + ] + ]; + + $stmt = $pdo->prepare("INSERT INTO products (name, description, price, image_url) VALUES (?, ?, ?, ?)"); + + foreach ($products as $product) { + $stmt->execute([$product['name'], $product['description'], $product['price'], $product['image_url']]); + } + + echo "Database seeded successfully.\n"; +} + +seed_database(); + diff --git a/index.php b/index.php index 7205f3d..2f7b60b 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,103 @@ query("SELECT * FROM products"); +$products = $stmt->fetchAll(); + +$project_name = !empty($_SERVER['PROJECT_NAME']) ? $_SERVER['PROJECT_NAME'] : 'Tabeltop Decor'; +$project_description = !empty($_SERVER['PROJECT_DESCRIPTION']) ? $_SERVER['PROJECT_DESCRIPTION'] : 'An e-commerce site for tabletop decoration products.'; +$project_image_url = !empty($_SERVER['PROJECT_IMAGE_URL']) ? $_SERVER['PROJECT_IMAGE_URL'] : ''; -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); ?> - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + <?= htmlspecialchars($project_name) ?> + + + + + + + + + + + + + + + + + + -
-
-

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

+ + + +
+
+ +
+
+ <?= htmlspecialchars($product['name']) ?> +
+
+

+

$

+
+ + +
+
+
+
+ +
-
- + + + + + - + \ No newline at end of file