Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34236e9979 |
201
auth.php
Normal file
201
auth.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
|
||||
$action = $_GET['action'] ?? '';
|
||||
|
||||
switch ($action) {
|
||||
case 'register':
|
||||
handle_register();
|
||||
break;
|
||||
case 'login':
|
||||
handle_login();
|
||||
break;
|
||||
case 'logout':
|
||||
handle_logout();
|
||||
break;
|
||||
case 'update_profile':
|
||||
handle_update_profile();
|
||||
break;
|
||||
case 'create_thread':
|
||||
handle_create_thread();
|
||||
break;
|
||||
case 'create_post':
|
||||
handle_create_post();
|
||||
break;
|
||||
default:
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
function handle_update_profile() {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: profile.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$name = $_POST['name'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$bio = $_POST['bio'] ?? '';
|
||||
$skills = $_POST['skills'] ?? '';
|
||||
$interests = $_POST['interests'] ?? '';
|
||||
$goals = $_POST['goals'] ?? '';
|
||||
|
||||
if (empty($name) || empty($email)) {
|
||||
die('Name and Email are required');
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("UPDATE users SET name = ?, email = ?, bio = ?, skills = ?, interests = ?, goals = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $email, $bio, $skills, $interests, $goals, $user_id]);
|
||||
|
||||
$_SESSION['user_name'] = $name; // Update session name
|
||||
|
||||
header('Location: profile.php?success=1');
|
||||
exit;
|
||||
} catch (PDOException $e) {
|
||||
die("Profile update failed: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function handle_register() {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: register.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$name = $_POST['name'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if (empty($name) || empty($email) || empty($password)) {
|
||||
die('Please fill all fields');
|
||||
}
|
||||
|
||||
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("INSERT INTO users (name, email, password) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$name, $email, $hashed_password]);
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
} catch (PDOException $e) {
|
||||
die("Registration failed: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function handle_login() {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$email = $_POST['email'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if (empty($email) || empty($password)) {
|
||||
die('Please fill all fields');
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
||||
$stmt->execute([$email]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$_SESSION['user_id'] = $user['id'];
|
||||
$_SESSION['user_name'] = $user['name'];
|
||||
$_SESSION['user_role'] = $user['role'];
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
} else {
|
||||
die('Invalid login');
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
die("Login failed: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function handle_logout() {
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
function handle_create_thread() {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: forums.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$forum_id = $_POST['forum_id'] ?? null;
|
||||
$title = $_POST['title'] ?? '';
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
if (empty($forum_id) || empty($title)) {
|
||||
// Or redirect with an error message
|
||||
die('Forum ID and Title are required.');
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("INSERT INTO discussion_threads (forum_id, user_id, title) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$forum_id, $user_id, $title]);
|
||||
|
||||
$new_thread_id = $pdo->lastInsertId();
|
||||
|
||||
// Redirect to the new thread page
|
||||
header('Location: thread.php?id=' . $new_thread_id);
|
||||
exit;
|
||||
} catch (PDOException $e) {
|
||||
die("Failed to create thread: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function handle_create_post() {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: forums.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$thread_id = $_POST['thread_id'] ?? null;
|
||||
$content = $_POST['content'] ?? '';
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
if (empty($thread_id) || empty($content)) {
|
||||
// Redirect back to the thread with an error
|
||||
header('Location: thread.php?id=' . $thread_id . '&error=1');
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("INSERT INTO discussion_posts (thread_id, user_id, content) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$thread_id, $user_id, $content]);
|
||||
|
||||
// Redirect back to the thread page
|
||||
header('Location: thread.php?id=' . $thread_id);
|
||||
exit;
|
||||
} catch (PDOException $e) {
|
||||
die("Failed to create post: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
52
courses.php
Normal file
52
courses.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query('SELECT * FROM courses ORDER BY created_at DESC');
|
||||
$courses = $stmt->fetchAll();
|
||||
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center mb-4">Courses</h1>
|
||||
|
||||
<?php if (empty($courses)): ?>
|
||||
<div class="alert alert-info">No courses available yet.</div>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<?php foreach ($courses as $course): ?>
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($course['title']); ?></h5>
|
||||
<div>
|
||||
<span class="badge bg-info me-2"><?php echo ucfirst(htmlspecialchars($course['type'])); ?></span>
|
||||
<?php if ($course['tier'] === 'premium'): ?>
|
||||
<span class="badge bg-success">Premium</span>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-secondary">Free</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<p class="card-text mt-2 flex-grow-1"><?php echo htmlspecialchars($course['description']); ?></p>
|
||||
|
||||
<div class="mt-auto">
|
||||
<?php if ($course['tier'] === 'premium' && !empty($course['price'])): ?>
|
||||
<p class="fw-bold fs-5 mb-2">$<?php echo htmlspecialchars($course['price']); ?></p>
|
||||
<?php endif; ?>
|
||||
<a href="#" class="btn btn-primary">View Course</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php require_once 'templates/footer.php'; ?>
|
||||
21
dashboard.php
Normal file
21
dashboard.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
include 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h2>Dashboard</h2>
|
||||
<p>Welcome, <?php echo htmlspecialchars($_SESSION['user_name']); ?>!</p>
|
||||
<p>Your role is: <?php echo htmlspecialchars($_SESSION['user_role']); ?></p>
|
||||
<a href="auth.php?action=logout">Logout</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include 'templates/footer.php';
|
||||
?>
|
||||
41
db/migrate.php
Normal file
41
db/migrate.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Create migrations table if it doesn't exist
|
||||
$pdo->exec("CREATE TABLE IF NOT EXISTS `migrations` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`migration` VARCHAR(255) NOT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||
|
||||
// Get all run migrations
|
||||
$stmt = $pdo->query("SELECT `migration` FROM `migrations`");
|
||||
$run_migrations = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
|
||||
// Get all migration files
|
||||
$migration_files = glob(__DIR__ . '/migrations/*.sql');
|
||||
sort($migration_files);
|
||||
|
||||
foreach ($migration_files as $file) {
|
||||
$migration_name = basename($file);
|
||||
if (!in_array($migration_name, $run_migrations)) {
|
||||
echo "Running migration: {$migration_name}...\n";
|
||||
$sql = file_get_contents($file);
|
||||
$pdo->exec($sql);
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO `migrations` (`migration`) VALUES (?)");
|
||||
$stmt->execute([$migration_name]);
|
||||
echo "Success: {$migration_name} migrated.\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "All migrations have been run.\n";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("Migration failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
8
db/migrations/001_create_users_table.sql
Normal file
8
db/migrations/001_create_users_table.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
role ENUM('student', 'instructor', 'admin') NOT NULL DEFAULT 'student',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
5
db/migrations/002_add_profile_fields_to_users.sql
Normal file
5
db/migrations/002_add_profile_fields_to_users.sql
Normal file
@ -0,0 +1,5 @@
|
||||
ALTER TABLE `users`
|
||||
ADD COLUMN `bio` TEXT DEFAULT NULL,
|
||||
ADD COLUMN `skills` VARCHAR(255) DEFAULT NULL,
|
||||
ADD COLUMN `interests` VARCHAR(255) DEFAULT NULL,
|
||||
ADD COLUMN `goals` TEXT DEFAULT NULL;
|
||||
9
db/migrations/003_create_courses_table.sql
Normal file
9
db/migrations/003_create_courses_table.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS `courses` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`description` TEXT NOT NULL,
|
||||
`instructor_id` INT,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`instructor_id`) REFERENCES `users`(`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
59
db/migrations/004_add_features_tables.sql
Normal file
59
db/migrations/004_add_features_tables.sql
Normal file
@ -0,0 +1,59 @@
|
||||
-- Monetization & Content Strategy
|
||||
ALTER TABLE `courses`
|
||||
ADD COLUMN `tier` ENUM('free', 'premium') NOT NULL DEFAULT 'free' AFTER `description`,
|
||||
ADD COLUMN `price` DECIMAL(10, 2) DEFAULT NULL AFTER `tier`,
|
||||
ADD COLUMN `type` ENUM('course', 'micro-lesson') NOT NULL DEFAULT 'course' AFTER `price`;
|
||||
|
||||
-- Scalability & Compliance
|
||||
ALTER TABLE `users`
|
||||
ADD COLUMN `language` VARCHAR(5) NOT NULL DEFAULT 'en' AFTER `email`,
|
||||
ADD COLUMN `parental_controls_enabled` BOOLEAN NOT NULL DEFAULT FALSE AFTER `language`;
|
||||
|
||||
-- Community & Engagement: Gamification
|
||||
CREATE TABLE IF NOT EXISTS `badges` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`description` TEXT,
|
||||
`icon` VARCHAR(255) -- e.g., path to an image or a font-awesome class
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_badges` (
|
||||
`user_id` INT NOT NULL,
|
||||
`badge_id` INT NOT NULL,
|
||||
`awarded_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`user_id`, `badge_id`),
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`badge_id`) REFERENCES `badges`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- Community & Engagement: Discussion Boards
|
||||
CREATE TABLE IF NOT EXISTS `discussion_forums` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`course_id` INT DEFAULT NULL, -- Can be null for general forums
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`description` TEXT,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`course_id`) REFERENCES `courses`(`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `discussion_threads` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`forum_id` INT NOT NULL,
|
||||
`user_id` INT NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`forum_id`) REFERENCES `discussion_forums`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `discussion_posts` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`thread_id` INT NOT NULL,
|
||||
`user_id` INT NOT NULL,
|
||||
`parent_post_id` INT DEFAULT NULL, -- For replies
|
||||
`content` TEXT NOT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`thread_id`) REFERENCES `discussion_threads`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`parent_post_id`) REFERENCES `discussion_posts`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
77
db/seeds/seed_courses.php
Normal file
77
db/seeds/seed_courses.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Temporarily disable foreign key checks to truncate the table
|
||||
$pdo->exec("SET FOREIGN_KEY_CHECKS=0;");
|
||||
$pdo->exec("TRUNCATE TABLE courses");
|
||||
$pdo->exec("SET FOREIGN_KEY_CHECKS=1;");
|
||||
|
||||
$courses = [
|
||||
[
|
||||
'title' => 'Introduction to PHP',
|
||||
'description' => 'Learn the fundamentals of PHP, the most popular server-side scripting language.',
|
||||
'tier' => 'free',
|
||||
'price' => null,
|
||||
'type' => 'course',
|
||||
'instructor_id' => null // No instructor assigned yet
|
||||
],
|
||||
[
|
||||
'title' => 'Advanced MySQL',
|
||||
'description' => 'Master advanced MySQL concepts like indexing, transactions, and stored procedures.',
|
||||
'tier' => 'premium',
|
||||
'price' => '99.99',
|
||||
'type' => 'course',
|
||||
'instructor_id' => null
|
||||
],
|
||||
[
|
||||
'title' => 'JavaScript for Beginners',
|
||||
'description' => 'Get started with JavaScript, the language of the web.',
|
||||
'tier' => 'free',
|
||||
'price' => null,
|
||||
'type' => 'course',
|
||||
'instructor_id' => null
|
||||
],
|
||||
[
|
||||
'title' => 'Quick CSS Flexbox',
|
||||
'description' => 'A 25-minute dive into the essentials of CSS Flexbox for modern layouts.',
|
||||
'tier' => 'free',
|
||||
'price' => null,
|
||||
'type' => 'micro-lesson',
|
||||
'instructor_id' => null
|
||||
],
|
||||
[
|
||||
'title' => 'The Complete Forex Trading Course',
|
||||
'description' => 'An in-depth course on Forex trading strategies, risk management, and market analysis.',
|
||||
'tier' => 'premium',
|
||||
'price' => '149.50',
|
||||
'type' => 'course',
|
||||
'instructor_id' => null
|
||||
]
|
||||
];
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
"INSERT INTO courses (title, description, tier, price, type, instructor_id)
|
||||
VALUES (:title, :description, :tier, :price, :type, :instructor_id)"
|
||||
);
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$stmt->execute([
|
||||
':title' => $course['title'],
|
||||
':description' => $course['description'],
|
||||
':tier' => $course['tier'],
|
||||
':price' => $course['price'],
|
||||
':type' => $course['type'],
|
||||
':instructor_id' => $course['instructor_id']
|
||||
]);
|
||||
}
|
||||
|
||||
echo "Successfully seeded the courses table.\n";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("Seeding failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
44
db/seeds/seed_forums.php
Normal file
44
db/seeds/seed_forums.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Truncate the tables to start fresh
|
||||
$pdo->exec("SET FOREIGN_KEY_CHECKS=0;");
|
||||
$pdo->exec("TRUNCATE TABLE discussion_forums");
|
||||
$pdo->exec("TRUNCATE TABLE discussion_threads");
|
||||
$pdo->exec("TRUNCATE TABLE discussion_posts");
|
||||
$pdo->exec("SET FOREIGN_KEY_CHECKS=1;");
|
||||
|
||||
// Find a course to associate with a forum
|
||||
$stmt = $pdo->query("SELECT id FROM courses WHERE title LIKE '%PHP%' LIMIT 1");
|
||||
$php_course = $stmt->fetch();
|
||||
$php_course_id = $php_course ? $php_course['id'] : null;
|
||||
|
||||
$forums = [
|
||||
[
|
||||
'course_id' => null,
|
||||
'title' => 'General Discussion',
|
||||
'description' => 'A place to talk about anything and everything.'
|
||||
],
|
||||
[
|
||||
'course_id' => $php_course_id,
|
||||
'title' => 'PHP Course Q&A',
|
||||
'description' => 'Ask questions and get help for the Introduction to PHP course.'
|
||||
]
|
||||
];
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO discussion_forums (course_id, title, description) VALUES (:course_id, :title, :description)");
|
||||
|
||||
foreach ($forums as $forum) {
|
||||
$stmt->execute($forum);
|
||||
}
|
||||
|
||||
echo "Successfully seeded the discussion_forums table.\n";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("Seeding failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
26
disclaimer.php
Normal file
26
disclaimer.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center my-5">Disclaimer</h1>
|
||||
<p><em>Last Updated: <?php echo date('F j, Y'); ?></em></p>
|
||||
|
||||
<h2>1. General Information</h2>
|
||||
<p>The information provided by our platform is for general informational and educational purposes only. All information on the site is provided in good faith, however, we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information on the site.</p>
|
||||
|
||||
<h2 class="text-danger">2. Forex & Trading Disclaimer</h2>
|
||||
<p><strong>High-Risk Investment Warning:</strong> Trading Forex (foreign exchange) and other leveraged products is highly speculative and carries a high level of risk. It is possible to lose all your capital. These products may not be suitable for everyone and you should ensure that you understand the risks involved. Seek independent advice if necessary.</p>
|
||||
<p>Our platform does not provide financial advice. The content on this site, including courses, mentorship, and discussions, is for educational purposes only. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice.</p>
|
||||
|
||||
<h2>3. External Links Disclaimer</h2>
|
||||
<p>The Site may contain (or you may be sent through the Site) links to other websites or content belonging to or originating from third parties. Such external links are not investigated, monitored, or checked for accuracy, adequacy, validity, reliability, availability or completeness by us.</p>
|
||||
|
||||
<h2>4. Contact Us</h2>
|
||||
<p>If you have any questions about this Disclaimer, please contact us.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once 'templates/footer.php';
|
||||
?>
|
||||
71
forum.php
Normal file
71
forum.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
|
||||
$forum_id = $_GET['id'] ?? null;
|
||||
if (!$forum_id) {
|
||||
header('Location: forums.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$pdo = db();
|
||||
|
||||
// Fetch forum details
|
||||
$stmt = $pdo->prepare('SELECT * FROM discussion_forums WHERE id = ?');
|
||||
$stmt->execute([$forum_id]);
|
||||
$forum = $stmt->fetch();
|
||||
|
||||
if (!$forum) {
|
||||
header('Location: forums.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Fetch threads in this forum
|
||||
$stmt = $pdo->prepare(
|
||||
'SELECT t.*, u.username FROM discussion_threads t JOIN users u ON t.user_id = u.id WHERE t.forum_id = ? ORDER BY t.created_at DESC'
|
||||
);
|
||||
$stmt->execute([$forum_id]);
|
||||
$threads = $stmt->fetchAll();
|
||||
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center mb-2"><?php echo htmlspecialchars($forum['title']); ?></h1>
|
||||
<p class="text-center text-muted mb-4"><?php echo htmlspecialchars($forum['description']); ?></p>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Create a New Thread</h5>
|
||||
<form action="auth.php?action=create_thread" method="POST">
|
||||
<input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>">
|
||||
<div class="form-group">
|
||||
<label for="thread_title">Title</label>
|
||||
<input type="text" class="form-control" id="thread_title" name="title" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-2">Post Thread</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="mb-3">Threads</h3>
|
||||
<div class="list-group">
|
||||
<?php if (empty($threads)): ?>
|
||||
<div class="alert alert-info">No threads in this forum yet. Be the first to post!</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($threads as $thread): ?>
|
||||
<a href="thread.php?id=<?php echo $thread['id']; ?>" class="list-group-item list-group-item-action">
|
||||
<h5 class="mb-1"><?php echo htmlspecialchars($thread['title']); ?></h5>
|
||||
<small>By <?php echo htmlspecialchars($thread['username']); ?> on <?php echo date('M j, Y', strtotime($thread['created_at'])); ?></small>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once 'templates/footer.php'; ?>
|
||||
35
forums.php
Normal file
35
forums.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query('SELECT * FROM discussion_forums ORDER BY title ASC');
|
||||
$forums = $stmt->fetchAll();
|
||||
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center mb-4">Forums</h1>
|
||||
|
||||
<div class="list-group">
|
||||
<?php if (empty($forums)): ?>
|
||||
<div class="alert alert-info">No forums available yet.</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($forums as $forum): ?>
|
||||
<a href="forum.php?id=<?php echo $forum['id']; ?>" class="list-group-item list-group-item-action flex-column align-items-start">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<h5 class="mb-1"><?php echo htmlspecialchars($forum['title']); ?></h5>
|
||||
</div>
|
||||
<p class="mb-1"><?php echo htmlspecialchars($forum['description']); ?></p>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once 'templates/footer.php'; ?>
|
||||
158
index.php
158
index.php
@ -1,103 +1,59 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
<?php include 'templates/header.php'; ?>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>Escape the Matrix</h1>
|
||||
<p style="font-size: 1.2rem; margin-bottom: 2rem;">Your journey to digital freedom starts here.</p>
|
||||
<a href="#overview" class="cta">Learn More</a>
|
||||
</header>
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #4B0082;
|
||||
--bg-color-end: #8A2BE2;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Welcome!</h1>
|
||||
<p>This is your new landing page.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
<section id="overview">
|
||||
<h2>Overview</h2>
|
||||
<p>We provide the tools and knowledge for you to break free from the old ways. Learn in-demand digital skills, connect with like-minded individuals, and build your own reality.</p>
|
||||
</section>
|
||||
|
||||
<section id="mentors">
|
||||
<h2>Mentor Highlights</h2>
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<h3>Morpheus</h3>
|
||||
<p>Specialty: Opening minds. Morpheus can show you the door, but you're the one who has to walk through it.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Trinity</h3>
|
||||
<p>Specialty: Digital infiltration and high-speed maneuvering. Learn to navigate the system's constructs with grace and power.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Neo</h3>
|
||||
<p>Specialty: Understanding the code. Neo helps you see the world for what it truly is and manipulate it to your will.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="success-stories">
|
||||
<h2>Success Stories</h2>
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<p>"I was lost in the system, a battery. Now I build my own worlds."</p>
|
||||
<h4>- A Former Blue Pill</h4>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p>"The mentors here don't just teach, they awaken."</p>
|
||||
<h4>- The Kid</h4>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="newsletter">
|
||||
<h2>Join the Resistance</h2>
|
||||
<form>
|
||||
<input type="email" name="email" placeholder="Enter your email to get transmissions" required>
|
||||
<button type="submit" class="cta">Subscribe</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2025 Neo's Crew. All rights reserved. There is no spoon.</p>
|
||||
</footer>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php include 'templates/footer.php'; ?>
|
||||
22
login.php
Normal file
22
login.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
include 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h2>Login</h2>
|
||||
<form action="auth.php?action=login" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" id="email" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="password" class="form-control" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include 'templates/footer.php';
|
||||
?>
|
||||
30
privacy_policy.php
Normal file
30
privacy_policy.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center my-5">Privacy Policy</h1>
|
||||
<p><em>Last Updated: <?php echo date('F j, Y'); ?></em></p>
|
||||
|
||||
<h2>1. Introduction</h2>
|
||||
<p>Welcome to our platform. We are committed to protecting your privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you visit our website.</p>
|
||||
|
||||
<h2>2. Information We Collect</h2>
|
||||
<p>We may collect information about you in a variety of ways. The information we may collect on the Site includes:</p>
|
||||
<ul>
|
||||
<li><strong>Personal Data:</strong> Personally identifiable information, such as your name, shipping address, email address, and telephone number, and demographic information, such as your age, gender, hometown, and interests, that you voluntarily give to us when you register with the Site or when you choose to participate in various activities related to the Site, such as online chat and message boards.</li>
|
||||
<li><strong>Derivative Data:</strong> Information our servers automatically collect when you access the Site, such as your IP address, your browser type, your operating system, your access times, and the pages you have viewed directly before and after accessing the Site.</li>
|
||||
</ul>
|
||||
|
||||
<h2>3. Use of Your Information</h2>
|
||||
<p>Having accurate information about you permits us to provide you with a smooth, efficient, and customized experience. Specifically, we may use information collected about you via the Site to...</p>
|
||||
<p><em>[Placeholder: Detailed text about information usage to be added here.]</em></p>
|
||||
|
||||
<h2>4. Contact Us</h2>
|
||||
<p>If you have questions or comments about this Privacy Policy, please contact us.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once 'templates/footer.php';
|
||||
?>
|
||||
62
profile.php
Normal file
62
profile.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?');
|
||||
$stmt->execute([$_SESSION['user_id']]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<h1 class="text-center mb-4">Your Profile</h1>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success">Profile updated successfully!</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="auth.php" method="POST">
|
||||
<input type="hidden" name="action" value="update_profile">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($user['name']); ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="bio" class="form-label">Bio</label>
|
||||
<textarea class="form-control" id="bio" name="bio" rows="3"><?php echo htmlspecialchars($user['bio'] ?? ''); ?></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="skills" class="form-label">Skills (comma-separated)</label>
|
||||
<input type="text" class="form-control" id="skills" name="skills" value="<?php echo htmlspecialchars($user['skills'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="interests" class="form-label">Interests (comma-separated)</label>
|
||||
<input type="text" class="form-control" id="interests" name="interests" value="<?php echo htmlspecialchars($user['interests'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="goals" class="form-label">Goals</label>
|
||||
<textarea class="form-control" id="goals" name="goals" rows="3"><?php echo htmlspecialchars($user['goals'] ?? ''); ?></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update Profile</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once 'templates/footer.php'; ?>
|
||||
26
register.php
Normal file
26
register.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h2>Register</h2>
|
||||
<form action="auth.php?action=register" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" name="name" id="name" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" id="email" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="password" class="form-control" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include 'templates/footer.php';
|
||||
?>
|
||||
53
templates/footer.php
Normal file
53
templates/footer.php
Normal file
@ -0,0 +1,53 @@
|
||||
<footer class="container text-center mt-5 py-3">
|
||||
<p class="text-muted">© <?php echo date("Y"); ?> Your Platform Name. All Rights Reserved.</p>
|
||||
<ul class="list-inline">
|
||||
<li class="list-inline-item"><a href="privacy_policy.php">Privacy Policy</a></li>
|
||||
<li class="list-inline-item"><a href="terms_of_service.php">Terms of Service</a></li>
|
||||
<li class="list-inline-item"><a href="disclaimer.php">Disclaimer</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
const canvas = document.getElementById('matrix-canvas');
|
||||
const context = canvas.getContext('2d');
|
||||
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
|
||||
const katakana = 'アァカサタナハマヤャラワガザダバパイィキシチニヒミリヰギジヂビピウゥクスツヌフムユュルグズブヅプエェケセテネヘメレヱゲゼデベペオォコソトノホモヨョロヲゴゾドボポヴッン';
|
||||
const latin = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const nums = '0123456789';
|
||||
|
||||
const alphabet = katakana + latin + nums;
|
||||
|
||||
const fontSize = 16;
|
||||
const columns = canvas.width / fontSize;
|
||||
|
||||
const rainDrops = [];
|
||||
|
||||
for (let x = 0; x < columns; x++) {
|
||||
rainDrops[x] = 1;
|
||||
}
|
||||
|
||||
const draw = () => {
|
||||
context.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||
context.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
context.fillStyle = '#0F0';
|
||||
context.font = fontSize + 'px monospace';
|
||||
|
||||
for (let i = 0; i < rainDrops.length; i++) {
|
||||
const text = alphabet.charAt(Math.floor(Math.random() * alphabet.length));
|
||||
context.fillText(text, i * fontSize, rainDrops[i] * fontSize);
|
||||
|
||||
if (rainDrops[i] * fontSize > canvas.height && Math.random() > 0.975) {
|
||||
rainDrops[i] = 0;
|
||||
}
|
||||
rainDrops[i]++;
|
||||
}
|
||||
};
|
||||
|
||||
setInterval(draw, 30);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
139
templates/header.php
Normal file
139
templates/header.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php session_start(); ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Escape the Matrix</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #000;
|
||||
color: #0f0;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
overflow-x: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 20px;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #0f0;
|
||||
text-shadow: 0 0 5px #0f0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0f0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn, .cta {
|
||||
background-color: #0F0;
|
||||
color: #000;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
border: 1px solid #0F0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn:hover, .cta:hover {
|
||||
background-color: #000;
|
||||
color: #0F0;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
background-color: #000;
|
||||
color: #0f0;
|
||||
border: 1px solid #0f0;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
header {
|
||||
text-align: center;
|
||||
padding: 4rem 0;
|
||||
}
|
||||
|
||||
section {
|
||||
padding: 4rem 0;
|
||||
border-top: 1px solid #0F0;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid #0F0;
|
||||
padding: 1.5rem;
|
||||
background: rgba(0, 255, 0, 0.05);
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
padding: 2rem 0;
|
||||
border-top: 1px solid #0F0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="matrix-canvas"></canvas>
|
||||
<nav>
|
||||
<a href="index.php">Home</a>
|
||||
<?php if (isset($_SESSION['user_id'])): ?>
|
||||
<a href="dashboard.php">Dashboard</a>
|
||||
<a href="profile.php">Profile</a>
|
||||
<a href="courses.php">Courses</a>
|
||||
<a href="forums.php">Forums</a>
|
||||
<a href="auth.php?action=logout">Logout</a>
|
||||
<?php else: ?>
|
||||
<a href="register.php">Register</a>
|
||||
<a href="login.php">Login</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div style="display: inline-block; margin-left: 20px;">
|
||||
<select id="language-switcher" class="form-control" style="width: auto; display: inline-block;">
|
||||
<option value="en" <?php echo (isset($_SESSION['language']) && $_SESSION['language'] === 'en') ? 'selected' : ''; ?>>English</option>
|
||||
<option value="krio" <?php echo (isset($_SESSION['language']) && $_SESSION['language'] === 'krio') ? 'selected' : ''; ?>>Krio</option>
|
||||
<option value="fr" <?php echo (isset($_SESSION['language']) && $_SESSION['language'] === 'fr') ? 'selected' : ''; ?>>French</option>
|
||||
</select>
|
||||
</div>
|
||||
</nav>
|
||||
30
terms_of_service.php
Normal file
30
terms_of_service.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="text-center my-5">Terms of Service</h1>
|
||||
<p><em>Last Updated: <?php echo date('F j, Y'); ?></em></p>
|
||||
|
||||
<h2>1. Agreement to Terms</h2>
|
||||
<p>By using our services, you agree to be bound by these Terms of Service. If you do not agree to these Terms, do not use the services.</p>
|
||||
|
||||
<h2>2. User Accounts</h2>
|
||||
<p>You may be required to create an account to access certain features. You are responsible for safeguarding your account and for all activities that occur under your account. You must notify us immediately of any unauthorized use of your account.</p>
|
||||
|
||||
<h2>3. Content</h2>
|
||||
<p>Our Service allows you to post, link, store, share and otherwise make available certain information, text, graphics, videos, or other material ("Content"). You are responsible for the Content that you post on or through the Service, including its legality, reliability, and appropriateness.</p>
|
||||
<p><em>[Placeholder: Detailed text about content ownership, rights, and responsibilities to be added here.]</em></p>
|
||||
|
||||
<h2>4. Prohibited Activities</h2>
|
||||
<p>You agree not to engage in any of the following prohibited activities...</p>
|
||||
<p><em>[Placeholder: List of prohibited activities to be added here.]</em></p>
|
||||
|
||||
<h2>5. Contact Us</h2>
|
||||
<p>If you have any questions about these Terms, please contact us.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once 'templates/footer.php';
|
||||
?>
|
||||
77
thread.php
Normal file
77
thread.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
require_once 'templates/header.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
|
||||
$thread_id = $_GET['id'] ?? null;
|
||||
if (!$thread_id) {
|
||||
header('Location: forums.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$pdo = db();
|
||||
|
||||
// Fetch thread details
|
||||
$stmt = $pdo->prepare('SELECT t.*, u.username FROM discussion_threads t JOIN users u ON t.user_id = u.id WHERE t.id = ?');
|
||||
$stmt->execute([$thread_id]);
|
||||
$thread = $stmt->fetch();
|
||||
|
||||
if (!$thread) {
|
||||
header('Location: forums.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Fetch posts in this thread
|
||||
$stmt = $pdo->prepare(
|
||||
'SELECT p.*, u.username FROM discussion_posts p JOIN users u ON p.user_id = u.id WHERE p.thread_id = ? ORDER BY p.created_at ASC'
|
||||
);
|
||||
$stmt->execute([$thread_id]);
|
||||
$posts = $stmt->fetchAll();
|
||||
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="mb-2"><?php echo htmlspecialchars($thread['title']); ?></h1>
|
||||
<p class="text-muted">Started by <?php echo htmlspecialchars($thread['username']); ?> on <?php echo date('M j, Y', strtotime($thread['created_at'])); ?></p>
|
||||
<hr>
|
||||
|
||||
<div id="posts-container">
|
||||
<?php if (empty($posts)): ?>
|
||||
<div class="alert alert-info">No replies yet.</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($posts as $post): ?>
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<p class="card-text"><?php echo nl2br(htmlspecialchars($post['content'])); ?></p>
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
By <?php echo htmlspecialchars($post['username']); ?> on <?php echo date('M j, Y, g:i a', strtotime($post['created_at'])); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Post a Reply</h5>
|
||||
<form action="auth.php?action=create_post" method="POST">
|
||||
<input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>">
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" id="post_content" name="content" rows="5" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-2">Submit Reply</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php require_once 'templates/footer.php'; ?>
|
||||
Loading…
x
Reference in New Issue
Block a user