diff --git a/admin_dashboard.php b/admin_dashboard.php new file mode 100644 index 0000000..94dbaa7 --- /dev/null +++ b/admin_dashboard.php @@ -0,0 +1,27 @@ + + + + + + + Admin Dashboard - READY BUDDY + + + + +
+

Admin Dashboard

+

Welcome, Admin !

+

This is the admin dashboard. You can manage competitions, users, and more from here.

+

Logout

+
+ + diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..f4e29a7 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,134 @@ +/* General Body Styles */ +body { + font-family: 'Poppins', sans-serif; + color: #444; + line-height: 1.75; + background-color: #f9f9f9; + padding-top: 56px; +} + +/* Navigation Bar */ +.navbar { + transition: background-color 0.3s; + box-shadow: 0 2px 4px rgba(0,0,0,0.04); +} + +.navbar-brand { + font-weight: 700; + font-size: 1.5rem; +} + +.nav-link { + font-weight: 500; + transition: color 0.3s; +} + +/* Hero Section */ +.hero-section { + background: linear-gradient(45deg, #007bff, #00d2ff); + color: white; + padding: 100px 0; + text-align: center; + height: auto; +} + +.hero-section h1 { + font-size: 3.5rem; + font-weight: 700; + margin-bottom: 20px; +} + +.hero-section .lead { + font-size: 1.25rem; + margin-bottom: 30px; +} + +/* Sections */ +section { + padding: 80px 0; +} + +section h2 { + text-align: center; + font-weight: 700; + font-size: 2.5rem; + margin-bottom: 60px; + position: relative; +} + +section h2::after { + content: ''; + display: block; + width: 60px; + height: 4px; + background: #007bff; + margin: 20px auto 0; +} + +/* Cards */ +.card { + border: none; + border-radius: 15px; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05); + transition: transform 0.3s, box-shadow 0.3s; + overflow: hidden; + margin-bottom: 1.5rem; +} + +.card:hover { + transform: translateY(-10px); + box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1); +} + +.card-body { + padding: 30px; +} + +.card-title { + font-weight: 600; +} + +/* Buttons */ +.btn-primary { + background-color: #007bff; + border-color: #007bff; + border-radius: 50px; + padding: 12px 30px; + font-weight: 600; + transition: background-color 0.3s, transform 0.3s; +} + +.btn-primary:hover { + background-color: #0056b3; + transform: translateY(-3px); +} + +/* Forms */ +.form-control { + border-radius: 10px; + padding: 15px; + border: 1px solid #ced4da; +} + +.form-control:focus { + border-color: #007bff; + box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25); +} + + +/* Footer */ +footer { + background-color: #343a40; + color: white; + padding: 40px 0; +} + +footer a { + color: #00d2ff; + text-decoration: none; + transition: color 0.3s; +} + +footer a:hover { + color: white; +} \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..92fe353 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,39 @@ +document.addEventListener('DOMContentLoaded', function () { + // Smooth scrolling for anchor links + document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); + }); + }); + + // Contact form submission + const contactForm = document.getElementById('contactForm'); + if (contactForm) { + contactForm.addEventListener('submit', function (e) { + e.preventDefault(); + const form = e.target; + const formData = new FormData(form); + const formMessages = document.getElementById('form-messages'); + + fetch(form.action, { + method: 'POST', + body: formData + }) + .then(response => response.text().then(text => ({ status: response.status, text }))) + .then(({ status, text }) => { + if (status === 200) { + formMessages.innerHTML = '
' + text + '
'; + form.reset(); + } else { + formMessages.innerHTML = '
' + text + '
'; + } + }).catch(() => { + formMessages.innerHTML = '
Oops! An error occurred.
'; + }); + }); + } +}); diff --git a/competitions.php b/competitions.php new file mode 100644 index 0000000..bd2bfd7 --- /dev/null +++ b/competitions.php @@ -0,0 +1,22 @@ +query('SELECT title, description, start_date FROM competitions ORDER BY start_date ASC'); + $competitions = $stmt->fetchAll(PDO::FETCH_ASSOC); + + foreach ($competitions as $competition) { + echo '
'; + echo '
'; + echo '
'; + echo '
' . htmlspecialchars($competition['title']) . '
'; + echo '

' . htmlspecialchars($competition['description']) . '

'; + echo '

Starts on: ' . date("F j, Y", strtotime($competition['start_date'])) . '

'; + echo '
'; + echo '
'; + echo '
'; + } +} catch (PDOException $e) { + echo '

Failed to load competitions.

'; +} diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..f74e7d3 --- /dev/null +++ b/contact.php @@ -0,0 +1,56 @@ +prepare($sql); + $stmt->execute([$name, $email, $message]); + } catch (PDOException $e) { + http_response_code(500); + echo "Oops! Something went wrong and we couldn't send your message."; + exit; + } + + $to = getenv('MAIL_TO') ?: null; + $subject = "New Contact Form Submission from $name"; + $html_content = "You have received a new message from your website contact form.

". + "Name: $name
". + "Email: $email
". + "Message:
$message"; + $text_content = "You have received a new message from your website contact form. + +". + "Name: $name +". + "Email: $email +". + "Message: +$message"; + + $result = MailService::sendMail($to, $subject, $html_content, $text_content, ['reply_to' => $email]); + + if (!empty($result['success'])) { + http_response_code(200); + echo "Thank You! Your message has been sent."; + } else { + http_response_code(500); + echo "Oops! Something went wrong and we couldn't send your message."; + } + +} else { + http_response_code(403); + echo "There was a problem with your submission, please try again."; +} diff --git a/db/migrations/001_initial_schema.sql b/db/migrations/001_initial_schema.sql new file mode 100644 index 0000000..2b4410c --- /dev/null +++ b/db/migrations/001_initial_schema.sql @@ -0,0 +1,32 @@ +CREATE TABLE IF NOT EXISTS `competitions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL, + `description` text NOT NULL, + `start_date` date NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `contact_submissions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `message` text NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `role` enum('user','admin') NOT NULL DEFAULT 'user', + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `competitions` (`title`, `description`, `start_date`) VALUES +('Annual Coding Challenge', 'Showcase your coding skills and win exciting prizes.', '2025-11-15'), +('Design Masters Cup', 'The ultimate design competition for creative minds.', '2025-12-01'), +('Startup Pitch Contest', 'Pitch your innovative startup idea to a panel of investors.', '2025-11-20'); diff --git a/index.php b/index.php index 7205f3d..e6c1bdf 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,139 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + READY BUDDY + + + + + + + + + + + + + -
-
-

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 READY BUDDY

+

Your platform for competitive excellence

+ View Competitions +
+
+ +
+
+
+
+

About Us

+

READY BUDDY is the ultimate platform for individuals who are passionate about competing and showcasing their talents. Whether you are a coder, a designer, or a startup enthusiast, we provide a space for you to challenge yourself, learn, and grow. Our mission is to foster a vibrant community of competitors and provide a fair and transparent platform for everyone to shine.

+
+ +
+
+
+ +
+
+

Upcoming Competitions

+
+ +
+
+
+ +
+
+

Testimonials

+
+
+
+
+

"READY BUDDY helped me to push my limits and learn new skills. The competitions are challenging and fun."

+
John Doe
+
+
+
+
+
+
+

"A great platform to connect with like-minded people and compete in a healthy environment."

+
Jane Smith
+
+
+
+
+
+
+

"I won my first competition on READY BUDDY! The experience was amazing."

+ +
+
+
+
+
+
+ +
+
+

Contact Us

+
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + + + + - + \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..8af845c --- /dev/null +++ b/login.php @@ -0,0 +1,143 @@ +prepare($sql); + $stmt->execute([$email]); + $user = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($user && password_verify($password, $user['password'])) { + $_SESSION['user_id'] = $user['id']; + $_SESSION['user_name'] = $user['name']; + $_SESSION['user_role'] = $user['role']; + + if ($user['role'] === 'admin') { + header("location: admin_dashboard.php"); // Create this page next + } else { + header("location: user_dashboard.php"); // Create this page next + } + exit; + } else { + $error = "The email or password you entered is incorrect."; + } + } catch (PDOException $e) { + $error = "Database error: " . $e->getMessage(); + } + } +} +?> + + + + + + Login - READY BUDDY + + + + + + +
+

Login to Your Account

+ +
+ +
+
+ + +
+
+ + +
+ +
+ +
+ + + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..083c0ff --- /dev/null +++ b/logout.php @@ -0,0 +1,7 @@ + diff --git a/privacy.php b/privacy.php new file mode 100644 index 0000000..7ef5bbe --- /dev/null +++ b/privacy.php @@ -0,0 +1,17 @@ + + + + + + Privacy Policy - READY BUDDY + + + + +
+

Privacy Policy

+

This is a placeholder for the Privacy Policy page. You should replace this with your own privacy policy.

+ Go back to Home +
+ + diff --git a/register.php b/register.php new file mode 100644 index 0000000..7022107 --- /dev/null +++ b/register.php @@ -0,0 +1,171 @@ +prepare($sql); + $stmt->execute([$email]); + if ($stmt->fetch()) { + $error = "Email already exists."; + } else { + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + $sql = "INSERT INTO users (name, email, password, role) VALUES (?, ?, ?, ?)"; + $stmt = $pdo->prepare($sql); + if ($stmt->execute([$name, $email, $hashed_password, $role])) { + $success = "Registration successful! You can now login."; + + } else { + $error = "Something went wrong. Please try again later."; + } + } + } catch (PDOException $e) { + $error = "Database error: " . $e->getMessage(); + } + } +} +?> + + + + + + Register - READY BUDDY + + + + + + +
+

Create Account

+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + + diff --git a/setup.php b/setup.php new file mode 100644 index 0000000..62c1461 --- /dev/null +++ b/setup.php @@ -0,0 +1,23 @@ + PDO::ERRMODE_EXCEPTION, + ]); + + // Create the database + $pdo->exec('CREATE DATABASE IF NOT EXISTS '.DB_NAME); + + // Now connect to the newly created database + $pdo = db(); + + // Execute the initial schema + $sql = file_get_contents('db/migrations/001_initial_schema.sql'); + $pdo->exec($sql); + + echo "Database setup completed successfully."; +} catch (PDOException $e) { + die("Database setup failed: " . $e->getMessage()); +} \ No newline at end of file diff --git a/user_dashboard.php b/user_dashboard.php new file mode 100644 index 0000000..fd8491f --- /dev/null +++ b/user_dashboard.php @@ -0,0 +1,83 @@ +query('SELECT title, description, start_date FROM competitions ORDER BY start_date ASC'); + $competitions = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + // Handle DB error + $competitions = []; + $db_error = "Failed to load competitions."; +} + +?> + + + + + + User Dashboard - READY BUDDY + + + + + + +
+
+

User Dashboard

+

Welcome, !

+
+ +

This is your user dashboard. You can view available competitions below.

+ +
+

Available Competitions

+
+ +

+ +

No competitions available at the moment.

+ + +
+
+
+
+

+

Starts on:

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