From 1b66a017fa8bde43240d6cab835f2868e81b00af Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 5 Dec 2025 19:48:45 +0000 Subject: [PATCH] v1.incomplete --- assets/css/custom.css | 166 +++++++++++ assets/js/main.js | 37 +++ dashboard.php | 75 +++++ db/migrations/001_create_users_table.php | 27 ++ db/migrations/002_create_services_table.php | 20 ++ .../003_create_user_services_table.php | 23 ++ db/migrations/004_seed_services_table.php | 45 +++ includes/footer.php | 27 ++ includes/header.php | 91 ++++++ index.php | 271 ++++++++---------- login.php | 88 ++++++ logout.php | 6 + register.php | 107 +++++++ subscribe.php | 45 +++ 14 files changed, 879 insertions(+), 149 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 dashboard.php create mode 100644 db/migrations/001_create_users_table.php create mode 100644 db/migrations/002_create_services_table.php create mode 100644 db/migrations/003_create_user_services_table.php create mode 100644 db/migrations/004_seed_services_table.php create mode 100644 includes/footer.php create mode 100644 includes/header.php create mode 100644 login.php create mode 100644 logout.php create mode 100644 register.php create mode 100644 subscribe.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..2ebd99d --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,166 @@ +/* General Body Styles */ +body { + font-family: 'Roboto', sans-serif; + color: #333; + line-height: 1.6; +} + +/* Typography */ +h1, h2, h3, h4, h5, h6 { + font-family: 'Poppins', sans-serif; + font-weight: 700; +} + +/* Header & Navbar */ +.navbar { + transition: background-color 0.3s ease-in-out; +} + +.navbar-brand { + font-family: 'Poppins', sans-serif; + font-weight: 700; + color: #fff !important; +} + +.nav-link { + font-weight: 500; + transition: color 0.2s; +} + +/* Hero Section */ +.hero-section { + background: linear-gradient(135deg, #007BFF, #0056b3); + color: white; + padding: 100px 0; + text-align: center; +} + +.hero-section h1 { + font-size: 3.5rem; + font-weight: 700; + margin-bottom: 0.5rem; +} + +.hero-section .lead { + font-size: 1.25rem; + margin-bottom: 2rem; +} + +.btn-primary { + background-color: #fff; + border-color: #fff; + color: #007BFF; + font-weight: 700; + padding: 0.75rem 1.5rem; + border-radius: 50px; + transition: all 0.3s ease; +} + +.btn-primary:hover { + background-color: #f0f0f0; + border-color: #f0f0f0; + transform: translateY(-2px); +} + +/* Sections */ +.section { + padding: 80px 0; +} + +.section-title { + text-align: center; + margin-bottom: 4rem; + font-size: 2.5rem; + font-weight: 700; +} + +/* Segment Cards */ +.segment-card { + border: none; + border-radius: 0.75rem; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); + transition: transform 0.3s, box-shadow 0.3s; + overflow: hidden; +} + +.segment-card:hover { + transform: translateY(-10px); + box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12); +} + +.segment-card .card-body { + padding: 2rem; +} + +/* Pricing/Plans Section */ +.pricing-card { + border-radius: 0.75rem; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); + transition: transform 0.3s, box-shadow 0.3s; + border: none; +} + +.pricing-card:hover { + transform: translateY(-10px); + box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12); +} + +.pricing-card .card-header { + background: transparent; + border-bottom: none; + padding: 1.5rem; +} + +.pricing-card .price { + font-size: 2.5rem; + font-weight: 700; +} + +.pricing-card .price .period { + font-size: 1rem; + font-weight: 400; + color: #6c757d; +} + +.pricing-card .btn { + border-radius: 50px; + font-weight: 700; + padding: 0.75rem 1.5rem; +} + +.pricing-card.featured { + border: 2px solid #007BFF; +} + +.pricing-card.featured .btn-primary { + background-color: #007BFF; + border-color: #007BFF; + color: #fff; +} +.pricing-card.featured .btn-primary:hover { + background-color: #0056b3; + border-color: #0056b3; +} + + +/* Footer */ +.footer { + background-color: #343a40; + color: #f8f9fa; + padding: 40px 0; +} + +.footer a { + color: #f8f9fa; + text-decoration: none; + transition: color 0.2s; +} + +.footer a:hover { + color: #007BFF; +} + +.social-icons a { + font-size: 1.5rem; + margin: 0 0.5rem; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..dc643fe --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,37 @@ +document.addEventListener('DOMContentLoaded', function () { + + // Navbar transparency scroll effect + const navbar = document.querySelector('.navbar'); + if (navbar) { + function handleScroll() { + if (window.scrollY > 50) { + navbar.classList.add('bg-dark'); + } else { + navbar.classList.remove('bg-dark'); + } + } + + // Initial check + handleScroll(); + + // Listen for scroll events + window.addEventListener('scroll', handleScroll); + } + + // Smooth scrolling for anchor links + document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + + const targetId = this.getAttribute('href'); + const targetElement = document.querySelector(targetId); + + if (targetElement) { + targetElement.scrollIntoView({ + behavior: 'smooth' + }); + } + }); + }); + +}); diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..00b36d9 --- /dev/null +++ b/dashboard.php @@ -0,0 +1,75 @@ + + +
+
+
+

Welcome to your Dashboard, !

+

This is your central hub to manage your account and services. More features will be added soon.

+
+
+ +
+
+

Your Subscribed Services

+ prepare("SELECT s.name, s.description FROM services s JOIN user_services us ON s.id = us.service_id WHERE us.user_id = ? AND us.status = 'active'"); + $stmt->execute([$_SESSION['user_id']]); + $user_services = $stmt->fetchAll(PDO::FETCH_ASSOC); + + if (count($user_services) > 0) { + echo "
    "; + foreach ($user_services as $service) { + echo "
  • "; + echo "" . htmlspecialchars($service['name']) . ": " . htmlspecialchars($service['description']); + echo "
  • "; + } + echo "
"; + } else { + echo "

You are not subscribed to any services yet.

"; + } + ?> +
+
+ +
+
+

Available Services

+
+
+ +
+ query("SELECT * FROM services"); + $services = $stmt->fetchAll(PDO::FETCH_ASSOC); + + foreach ($services as $service) { + ?> +
+
+
+
+

+

$ /

+ Subscribe +
+
+
+ +
+
+ + diff --git a/db/migrations/001_create_users_table.php b/db/migrations/001_create_users_table.php new file mode 100644 index 0000000..9759c49 --- /dev/null +++ b/db/migrations/001_create_users_table.php @@ -0,0 +1,27 @@ +exec($sql); + echo "Migration 001: Users table created successfully." . PHP_EOL; + } catch (PDOException $e) { + die("Migration 001 failed: " . $e->getMessage() . PHP_EOL); + } +} + +// Self-invocation check +if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) { + migrate_001_create_users_table(); +} diff --git a/db/migrations/002_create_services_table.php b/db/migrations/002_create_services_table.php new file mode 100644 index 0000000..c79034b --- /dev/null +++ b/db/migrations/002_create_services_table.php @@ -0,0 +1,20 @@ +exec($sql); + echo "Table 'services' created successfully." . PHP_EOL; +} catch (PDOException $e) { + die("Could not create table 'services': " . $e->getMessage()); +} diff --git a/db/migrations/003_create_user_services_table.php b/db/migrations/003_create_user_services_table.php new file mode 100644 index 0000000..b3f152c --- /dev/null +++ b/db/migrations/003_create_user_services_table.php @@ -0,0 +1,23 @@ +exec($sql); + echo "Table 'user_services' created successfully." . PHP_EOL; +} catch (PDOException $e) { + die("Could not create table 'user_services': " . $e->getMessage()); +} diff --git a/db/migrations/004_seed_services_table.php b/db/migrations/004_seed_services_table.php new file mode 100644 index 0000000..3a9944e --- /dev/null +++ b/db/migrations/004_seed_services_table.php @@ -0,0 +1,45 @@ + 'Basic Plan', + 'description' => 'Access to basic features.', + 'price' => 9.99, + 'billing_cycle' => 'monthly' + ], + [ + 'name' => 'Pro Plan', + 'description' => 'Access to all features and priority support.', + 'price' => 29.99, + 'billing_cycle' => 'monthly' + ], + [ + 'name' => 'Annual Basic Plan', + 'description' => 'One year of the Basic Plan.', + 'price' => 99.99, + 'billing_cycle' => 'yearly' + ], + [ + 'name' => 'Annual Pro Plan', + 'description' => 'One year of the Pro Plan.', + 'price' => 299.99, + 'billing_cycle' => 'yearly' + ] + ]; + + $sql = "INSERT INTO services (name, description, price, billing_cycle) VALUES (:name, :description, :price, :billing_cycle)"; + $stmt = $pdo->prepare($sql); + + foreach ($services as $service) { + $stmt->execute($service); + } + + echo "Services seeded successfully." . PHP_EOL; + +} catch (PDOException $e) { + die("Could not seed services: " . $e->getMessage()); +} diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..40669e0 --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,27 @@ + + + + + + + + + + + + + diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..49176af --- /dev/null +++ b/includes/header.php @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + <?php echo htmlspecialchars($project_name); ?> + + + + + + + + + + + + + + + + + +
+ +
+ +
diff --git a/index.php b/index.php index 7205f3d..8bf495a 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,123 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

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

-
-
-
- Page updated: (UTC) -
- - + +
+
+

Connect Your World

+

Reliable, fast, and seamless communication solutions for everyone.

+ See Our Plans +
+
+ + +
+
+

Built for Everyone

+
+ +
+
+
+ +

Residential

+

High-speed internet and streaming for your home. Enjoy uninterrupted connectivity for work, school, and entertainment.

+ Learn More +
+
+
+ +
+
+
+ +

Small Business

+

Affordable and scalable solutions to power your business growth. Keep your team connected and productive.

+ Discover Solutions +
+
+
+ +
+
+
+ +

Enterprise

+

Dedicated fiber, cloud services, and robust infrastructure for large-scale operations. Mission-critical reliability.

+ Explore Services +
+
+
+
+
+
+ + +
+
+

Our Plans

+
+ +
+
+
+

Starter

+
+
+

$29.99/mo

+
    +
  • 100 Mbps Download
  • +
  • Unlimited Data
  • +
  • HD Streaming
  • +
  • 24/7 Priority Support
  • +
+
+ +
+
+ +
+ +
+ +
+
+
+

Business Ultimate

+
+
+

$99.99/mo

+
    +
  • 2 Gbps Symmetric
  • +
  • Unlimited Data
  • +
  • Dedicated Account Rep
  • +
  • SLA Guarantee
  • +
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..8293920 --- /dev/null +++ b/login.php @@ -0,0 +1,88 @@ +prepare("SELECT * FROM users WHERE email = ?"); + $stmt->execute([$email]); + $user = $stmt->fetch(); + + if ($user) { + echo "User found. "; + if (password_verify($password, $user['password_hash'])) { + $_SESSION['user_id'] = $user['id']; + $_SESSION['user_name'] = $user['name']; + header("Location: dashboard.php"); + exit; + } else { + echo "Password verification failed."; + die(); + $errors[] = 'Invalid password'; + } + } else { + echo "No user found."; + die(); + $errors[] = 'No user found with that email address'; + } + } +} + +require_once 'includes/header.php'; +?> + +
+
+
+
+
+

Login

+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..f83284d --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ +prepare("SELECT * FROM users WHERE email = ?"); + $stmt->execute([$email]); + $existing_user = $stmt->fetch(); + + if ($existing_user) { + $errors[] = 'Email already exists'; + } else { + $password_hash = password_hash($password, PASSWORD_DEFAULT); + $stmt = $pdo->prepare("INSERT INTO users (name, email, password_hash) VALUES (?, ?, ?)"); + if ($stmt->execute([$name, $email, $password_hash])) { + $success = "Registration successful! You can now login."; + } else { + $errors[] = 'Failed to register. Please try again.'; + } + } + } +} + +require_once 'includes/header.php'; +?> + +
+
+
+
+
+

Register

+
+
+ +
+ +

+ +
+ + +
+

+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+ +
+
+
+
+ + diff --git a/subscribe.php b/subscribe.php new file mode 100644 index 0000000..1f76d96 --- /dev/null +++ b/subscribe.php @@ -0,0 +1,45 @@ +prepare("SELECT * FROM user_services WHERE user_id = ? AND service_id = ? AND status = 'active'"); + $stmt->execute([$user_id, $service_id]); + + if ($stmt->rowCount() > 0) { + $message = "You are already subscribed to this service."; + } else { + // Add the subscription + $stmt = $pdo->prepare("INSERT INTO user_services (user_id, service_id) VALUES (?, ?)"); + $stmt->execute([$user_id, $service_id]); + $message = "You have successfully subscribed to the service!"; + } + } catch (PDOException $e) { + $message = "An error occurred: " . $e->getMessage(); + } +} else { + header('Location: dashboard.php'); + exit; +} + +?> + + + +