From c56a30b688891e024a7d049b0bc1c18427b643e2 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Thu, 11 Dec 2025 09:01:24 +0000 Subject: [PATCH] 1.1.1.1.1 v1 --- admin.php | 255 +++++++++++++++++ assets/css/styles.css | 339 +++++++++++++++++++++++ dashboard.php | 31 +++ db/migrate.php | 46 +++ db/migrations/001_create_users_table.sql | 9 + home.php | 26 ++ includes/footer.php | 4 + includes/header.php | 40 +++ index.php | 170 ++---------- login.php | 58 ++++ logout.php | 6 + register.php | 78 ++++++ 12 files changed, 914 insertions(+), 148 deletions(-) create mode 100644 admin.php create mode 100644 assets/css/styles.css create mode 100644 dashboard.php create mode 100644 db/migrate.php create mode 100644 db/migrations/001_create_users_table.sql create mode 100644 home.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 diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..d52ecc4 --- /dev/null +++ b/admin.php @@ -0,0 +1,255 @@ + + + + + + Admin Dashboard + + + + +
+
+ + +
+
+ +
+
+

Admin Dashboard

+
+ + +
+
+

Total Users

+
+
+
+

KYC Approved

+
+
+
+

KYC Pending

+
+
+
+

KYC Rejected

+
+
+
+ + +
+
+

User Management

+ +
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
IDNameEmailKYC StatusCreated AtActions
+ + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/css/styles.css b/assets/css/styles.css new file mode 100644 index 0000000..ee81812 --- /dev/null +++ b/assets/css/styles.css @@ -0,0 +1,339 @@ +/* General Body Styles */ +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + background-color: #f8f9fa; + color: #212529; + margin: 0; + line-height: 1.6; +} + +/* Container */ +.container { + max-width: 1140px; + margin: 0 auto; + padding: 2rem 1rem; +} + +/* Header */ +header.main-header { + background-color: #ffffff; + border-bottom: 1px solid #e9ecef; + padding: 1rem 0; + box-shadow: 0 2px 4px rgba(0,0,0,0.04); +} + +header.main-header .container { + display: flex; + justify-content: space-between; + align-items: center; + padding-top: 0; + padding-bottom: 0; +} + +.logo { + font-size: 1.75rem; + font-weight: bold; + color: #007bff; + text-decoration: none; +} + +.main-nav ul { + list-style: none; + margin: 0; + padding: 0; + display: flex; +} + +.main-nav li { + margin-left: 1.5rem; +} + +.main-nav a { + text-decoration: none; + color: #495057; + font-weight: 500; + transition: color 0.2s ease-in-out; +} + +.main-nav a:hover, .main-nav a.active { + color: #007bff; +} + +/* Hero Section */ +.hero { + background: linear-gradient(45deg, #007bff, #6610f2); + color: #ffffff; + text-align: center; + padding: 6rem 1rem; +} + +.hero h1 { + font-size: 3.5rem; + font-weight: 700; + margin-bottom: 1rem; +} + +.hero p { + font-size: 1.25rem; + max-width: 600px; + margin: 0 auto 2rem auto; +} + +/* Buttons */ +.btn { + display: inline-block; + padding: 0.75rem 1.5rem; + border-radius: 50px; + text-decoration: none; + font-weight: 500; + transition: all 0.3s ease; + border: none; + cursor: pointer; +} + +.btn-primary { + background-color: #ffffff; + color: #007bff; + box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2); +} + +.btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3); +} + +.btn-secondary { + border: 2px solid #ffffff; + background-color: transparent; + color: #ffffff; +} + +.btn-secondary:hover { + background-color: #ffffff; + color: #007bff; +} + + +/* Admin Dashboard Specific Styles */ +.dashboard-header { + background-color: #fff; + padding: 2rem; + border-bottom: 1px solid #dee2e6; + box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075); +} + +.dashboard-header h1 { + margin: 0; + font-size: 2rem; +} + +.analytics-cards { + display: flex; + gap: 1.5rem; + margin-bottom: 2rem; + flex-wrap: wrap; +} + +.card { + background-color: #fff; + border-radius: 0.5rem; + box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075); + padding: 1.5rem; + flex: 1; + min-width: 220px; + border-left: 5px solid #007bff; +} + +.card h3 { + margin-top: 0; + font-size: 1rem; + color: #6c757d; +} + +.card .stat { + font-size: 2.5rem; + font-weight: bold; + color: #343a40; +} + +.user-management { + background-color: #fff; + padding: 2rem; + border-radius: 0.5rem; + box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075); +} + +.user-management-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 1.5rem; +} + +.user-management-header h2 { + margin: 0; +} + +.table-responsive { + overflow-x: auto; +} + +table { + width: 100%; + border-collapse: collapse; + margin-top: 1rem; +} + +th, td { + padding: 1rem; + text-align: left; + border-bottom: 1px solid #dee2e6; +} + +thead th { + background-color: #f8f9fa; + font-weight: 600; +} + +tbody tr:hover { + background-color: #f1f3f5; +} + +.badge { + display: inline-block; + padding: 0.35em 0.65em; + font-size: .75em; + font-weight: 700; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: 0.25rem; +} + +.badge-success { background-color: #28a745; } +.badge-warning { background-color: #ffc107; color: #212529; } +.badge-danger { background-color: #dc3545; } + +/* Modal Styles */ +.modal { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1000; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +} + +.modal-content { + background-color: #fefefe; + margin: 10% auto; + padding: 2rem; + border: 1px solid #888; + width: 80%; + max-width: 500px; + border-radius: 0.5rem; + box-shadow: 0 5px 15px rgba(0,0,0,0.3); +} + +.modal-header { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #dee2e6; + padding-bottom: 1rem; + margin-bottom: 1rem; +} + +.modal-header h2 { + margin: 0; +} + +.close-button { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; + cursor: pointer; +} + +.close-button:hover, +.close-button:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + +.form-group { + margin-bottom: 1rem; +} + +.form-group label { + display: block; + margin-bottom: 0.5rem; + font-weight: 500; +} + +.form-group input, .form-group select { + width: 100%; + padding: 0.75rem; + border: 1px solid #ced4da; + border-radius: 0.25rem; +} + +/* Login/Register Page Specifics */ +.form-card { + background-color: #fff; + padding: 2.5rem; + border-radius: 0.5rem; + box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,.075); + max-width: 450px; + margin: 2rem auto; +} + +.button { + display: block; + width: 100%; + padding: 0.85rem; + border-radius: 0.25rem; + background-color: #007bff; + color: #ffffff; + border: none; + font-size: 1rem; + font-weight: 500; + cursor: pointer; + transition: background-color 0.2s ease-in-out; +} + +.button:hover { + background-color: #0069d9; +} + +.text-center { + text-align: center; + margin-top: 1.5rem; +} + +/* Flash Messages */ +.message { + padding: 1rem; + margin-bottom: 1rem; + border-radius: 0.25rem; + border: 1px solid transparent; +} + +.message.error { + color: #721c24; + background-color: #f8d7da; + border-color: #f5c6cb; +} + +.message.success { + color: #155724; + background-color: #d4edda; + border-color: #c3e6cb; +} diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..bbe74ef --- /dev/null +++ b/dashboard.php @@ -0,0 +1,31 @@ + + + + + + + User Dashboard - Flatlogic + + + +
+
+

Welcome to your Dashboard

+
+
+

This is your protected dashboard area.

+ Logout +
+
+

© Flatlogic. All rights reserved.

+
+
+ + diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..e525798 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,46 @@ +exec($sql); + echo "Success.\n"; + } catch (PDOException $e) { + die("Migration failed: " . $e->getMessage() . "\n"); + } + } +} + +function seed_data() { + $pdo = db(); + // Seed users only if the table is empty + $stmt = $pdo->query('SELECT COUNT(*) FROM users'); + if ($stmt->fetchColumn() == 0) { + echo "Seeding users...\n"; + $users = [ + ['username' => 'admin', 'email' => 'admin@nic.app', 'password_hash' => password_hash('password', PASSWORD_DEFAULT), 'kyc_status' => 'approved'], + ['username' => 'alice', 'email' => 'alice@nic.app', 'password_hash' => password_hash('password', PASSWORD_DEFAULT), 'kyc_status' => 'pending'], + ['username' => 'bob', 'email' => 'bob@nic.app', 'password_hash' => password_hash('password', PASSWORD_DEFAULT), 'kyc_status' => 'rejected'], + ]; + + $stmt = $pdo->prepare("INSERT INTO users (username, email, password_hash, kyc_status) VALUES (:username, :email, :password_hash, :kyc_status)"); + + foreach ($users as $user) { + $stmt->execute($user); + } + echo "Seeding complete.\n"; + } else { + echo "Users table is not empty, skipping seed.\n"; + } +} + +run_migrations(); +seed_data(); + diff --git a/db/migrations/001_create_users_table.sql b/db/migrations/001_create_users_table.sql new file mode 100644 index 0000000..ef00c74 --- /dev/null +++ b/db/migrations/001_create_users_table.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS users ( + id INT AUTO_INCREMENT PRIMARY KEY, + username TEXT UNIQUE, + email TEXT UNIQUE, + password_hash TEXT, + profile_public BOOLEAN DEFAULT true, + kyc_status TEXT, -- pending/approved/rejected + created_at TIMESTAMP DEFAULT now() +); diff --git a/home.php b/home.php new file mode 100644 index 0000000..8d271f1 --- /dev/null +++ b/home.php @@ -0,0 +1,26 @@ + + +
+
+
+
+
+

Welcome, !

+

This is your personalized home page. From here, you can access various features of the platform.

+ Go to Dashboard + Logout +
+
+
+
+
+ + diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..b42dd13 --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,4 @@ + + + + diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..0e78dfb --- /dev/null +++ b/includes/header.php @@ -0,0 +1,40 @@ + + + + + + <?php echo $pageTitle ?? 'Flatlogic LAMP AI'; ?> + + + + + "> + + + + + + + "> + + + + + + + + +
+
+ + +
+
+
diff --git a/index.php b/index.php index 7205f3d..289da45 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,24 @@ -$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) -
- - + + +
+
+
+

Your New Application is Live

+

Welcome to your newly launched platform. Powerful, scalable, and ready to conquer the world. Manage your operations from our streamlined admin panel.

+ Go to Admin Panel +
+
+ +
+
+ +
+
+
+ + diff --git a/login.php b/login.php new file mode 100644 index 0000000..9f6b7f5 --- /dev/null +++ b/login.php @@ -0,0 +1,58 @@ +prepare("SELECT id, username, password FROM users WHERE email = :email"); + $stmt->bindParam(':email', $email); + $stmt->execute(); + $user = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($user && password_verify($password, $user['password'])) { + $_SESSION['user_id'] = $user['id']; + $_SESSION['username'] = $user['username']; // Store username for display + header('Location: home.php'); // Redirect to home.php + exit; + } else { + $error_message = 'Invalid email or password.'; + } + } catch (PDOException $e) { + $error_message = 'Database error: ' . $e->getMessage(); + } + } +} +$pageTitle = "Login - Flatlogic"; +include 'includes/header.php'; +?> +
+
+

Login

+
+
+ +
+ +
+
+ + +
+
+ + +
+ +
+

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..95db42c --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ +prepare("SELECT id FROM users WHERE email = :email"); + $stmt->bindParam(':email', $email); + $stmt->execute(); + + if ($stmt->fetch()) { + $error_message = 'An account with this email already exists.'; + } else { + $password_hash = password_hash($password, PASSWORD_DEFAULT); + + $stmt = $db->prepare("INSERT INTO users (username, email, password) VALUES (:username, :email, :password)"); + $stmt->bindParam(':username', $username); + $stmt->bindParam(':email', $email); + $stmt->bindParam(':password', $password_hash); + + if ($stmt->execute()) { + $success_message = 'Registration successful! You can now login.'; + } else { + $error_message = 'Registration failed. Please try again.'; + } + } + } catch (PDOException $e) { + $error_message = 'Database error: ' . $e->getMessage(); + } + } +} +$pageTitle = "Register - Flatlogic"; +include 'includes/header.php'; +?> +
+
+

Register

+
+
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +

Already have an account? Login here.

+
+ \ No newline at end of file