diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..79a5950 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,171 @@ +/* SunSkills App Custom Stylesheet */ +@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;500;700&display=swap'); + +:root { + --primary-dark: #1A1A2E; + --secondary-accent: #E94560; + --background-light: #F0F2F5; + --surface-white: #FFFFFF; + --text-primary: #1A1A2E; + --text-secondary: #555770; + --gradient-start: #16213E; + --gradient-end: #1A1A2E; + + --font-heading: 'Playfair Display', serif; + --font-body: 'Inter', sans-serif; + + --spacing-unit: 1rem; + --border-radius: 0.75rem; +} + +body { + font-family: var(--font-body); + background-color: var(--background-light); + color: var(--text-secondary); + line-height: 1.6; +} + +h1, h2, h3, h4, h5, h6 { + font-family: var(--font-heading); + color: var(--text-primary); + font-weight: 700; +} + +.btn-primary { + background-color: var(--secondary-accent); + border-color: var(--secondary-accent); + border-radius: var(--border-radius); + padding: 0.75rem 1.5rem; + font-weight: 500; + transition: all 0.3s ease; +} + +.btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4); +} + +.navbar { + background-color: var(--surface-white); + box-shadow: 0 2px 10px rgba(0,0,0,0.05); +} + +.hero { + background: linear-gradient(45deg, var(--gradient-start), var(--gradient-end)); + color: white; + padding: 8rem 0; + text-align: center; +} + +.hero h1 { + color: white; + font-size: 3.5rem; +} + +.section { + padding: 5rem 0; +} + +.card { + border: none; + border-radius: var(--border-radius); + box-shadow: 0 10px 30px rgba(0,0,0,0.07); + transition: all 0.3s ease; +} + +.card:hover { + transform: translateY(-5px); + box-shadow: 0 15px 40px rgba(0,0,0,0.1); +} + +.form-control { + border-radius: var(--border-radius); + padding: 0.75rem 1rem; +} + +.footer { + background-color: var(--primary-dark); + color: var(--background-light); + padding: 3rem 0; +} + +.footer a { + color: var(--background-light); + text-decoration: none; +} + +.footer a:hover { + color: var(--secondary-accent); +} + +/* Pricing Page Styles */ +.pricing-card .card-price { + font-size: 2.5rem; + font-weight: 700; + color: var(--text-primary); +} + +.pricing-card .card-price .text-muted { + font-size: 1rem; + font-weight: 400; +} + +.pricing-card ul li { + margin-bottom: 0.5rem; +} + +.card-popular { + border: 2px solid var(--secondary-accent) !important; + position: relative; + overflow: hidden; +} + +.popular-badge { + position: absolute; + top: 15px; + right: -30px; + background-color: var(--secondary-accent); + color: white; + padding: 5px 30px; + transform: rotate(45deg); + font-size: 0.8rem; + font-weight: bold; +} + +/* Dashboard Premium Styles */ +.premium-badge { + position: absolute; + top: 10px; + left: 10px; + background-color: var(--secondary-accent); + color: white; + padding: 5px 10px; + border-radius: var(--border-radius); + font-size: 0.8rem; + z-index: 10; +} + +.locked-overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0,0,0,0.7); + color: white; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + border-radius: var(--border-radius); +} + +.locked-overlay i { + font-size: 3rem; + margin-bottom: 0.5rem; +} + +.btn-warning { + color: var(--text-primary) !important; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..edf4c9b --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,23 @@ +document.addEventListener('DOMContentLoaded', function() { + const contactForm = document.getElementById('contactForm'); + if (contactForm) { + contactForm.addEventListener('submit', function(e) { + const name = document.getElementById('name').value.trim(); + const email = document.getElementById('email').value.trim(); + const message = document.getElementById('message').value.trim(); + const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + + if (name === '' || email === '' || message === '') { + e.preventDefault(); + alert('Please fill out all fields.'); + return; + } + + if (!emailPattern.test(email)) { + e.preventDefault(); + alert('Please enter a valid email address.'); + return; + } + }); + } +}); diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..c15c2f5 --- /dev/null +++ b/contact.php @@ -0,0 +1,44 @@ +prepare($sql); + $stmt->execute([$name, $email, $message]); + + // Send email notification + $to = getenv('MAIL_TO') ?: 'support@sunsills.com'; // Fallback recipient + $subject = "New Contact Form Submission from {$name}"; + $emailBody = "

You have received a new message from your website contact form.

"; + $emailBody .= "

Name: {$name}

"; + $emailBody .= "

Email: {$email}

"; + $emailBody .= "

Message:
{$message}

"; + + MailService::sendMail($to, $subject, $emailBody, strip_tags($emailBody), ['reply_to' => $email]); + + $_SESSION['success_message'] = "Thank you for your message! We will get back to you shortly."; + } catch (PDOException $e) { + // In a real app, you would log this error + $_SESSION['error_message'] = "Sorry, there was an error processing your request. Please try again later."; + } catch (Exception $e) { + $_SESSION['error_message'] = "Could not send email. Please try again later."; + } + } else { + $_SESSION['error_message'] = "Invalid input. Please fill out all fields correctly."; + } +} else { + $_SESSION['error_message'] = "Invalid request method."; +} + +header("Location: index.php#contact"); +exit(); diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..d7d20c0 --- /dev/null +++ b/dashboard.php @@ -0,0 +1,141 @@ +prepare("SELECT * FROM skills WHERE category = ?"); + $stmt->execute([$p_interest]); + $recommended_skills = $stmt->fetchAll(PDO::FETCH_ASSOC); + } catch (PDOException $e) { + error_log("Database error fetching skills: " . $e->getMessage()); + } +} +?> + + + + + + Dashboard - SunSkills + + + + + + + + +
+
+
+

Welcome, !

+

Your subscription status:

+ + + + + + + + + +
+

Here are your recommended skills!

+

Based on your interests in , we think you'll love these:

+
+ +
+
+ +
Premium
+ +
+
+

+
+ + + +
+ +

Upgrade to watch

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

No recommendations found yet

+

We couldn't find any skills matching your interest in "". Please check back later as we add more courses!

+
+ +
+

Let's Personalize Your Journey!

+

To unlock skill recommendations tailored just for you, please take our quick 3-question quiz.

+ Take the Quiz +
+ + +
+
+
+ + + + + + \ No newline at end of file diff --git a/db/config.php b/db/config.php index 89075af..dc39cce 100644 --- a/db/config.php +++ b/db/config.php @@ -6,12 +6,36 @@ define('DB_USER', 'app_30908'); define('DB_PASS', '98b730aa-be6c-479d-a47d-e5e7abc49229'); function db() { - static $pdo; - if (!$pdo) { - $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - ]); - } - return $pdo; + static $pdo; + if ($pdo) { + return $pdo; + } + + try { + $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + } catch (PDOException $e) { + if ($e->getCode() === 1049) { // Database doesn't exist + try { + $tempPdo = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION + ]); + $tempPdo->exec('CREATE DATABASE IF NOT EXISTS `'.DB_NAME.'` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + // Reconnect to the newly created database + $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + } catch (PDOException $creationException) { + // If creation fails, re-throw the original exception + throw $e; + } + } else { + throw $e; + } + } + + return $pdo; } diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..b3a4324 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,15 @@ +exec($sql); + echo "Migration applied successfully.\n"; +} catch (Exception $e) { + echo "Error applying migration: " . $e->getMessage() . "\n"; +} + diff --git a/db/migrate_002.php b/db/migrate_002.php new file mode 100644 index 0000000..dad0f7c --- /dev/null +++ b/db/migrate_002.php @@ -0,0 +1,13 @@ +exec($sql); + echo "Migration 002_create_users_table executed successfully.\n"; +} catch (PDOException $e) { + die("Migration failed: " . $e->getMessage() . "\n"); +} + diff --git a/db/migrate_003_004.php b/db/migrate_003_004.php new file mode 100644 index 0000000..b2c6c55 --- /dev/null +++ b/db/migrate_003_004.php @@ -0,0 +1,20 @@ +exec($sql); + echo "Successfully executed migration: $file\n"; + } catch (PDOException $e) { + die("Migration failed: " . $e->getMessage() . "\n"); + } +} + +run_migration(__DIR__ . '/migrations/003_create_skills_table.sql'); +run_migration(__DIR__ . '/migrations/004_insert_sample_skills.sql'); + diff --git a/db/migrate_005.php b/db/migrate_005.php new file mode 100644 index 0000000..fff2240 --- /dev/null +++ b/db/migrate_005.php @@ -0,0 +1,36 @@ +exec($query); + echo "Successfully executed query from $file:\n$query\n\n"; + } catch (PDOException $e) { + die("Error executing query from $file: " . $e->getMessage() . "\nQuery:\n$query\n"); + } + } + } +} + +$migration_files = [ + __DIR__ . '/migrations/005_add_premium_features.sql', +]; + +foreach ($migration_files as $file) { + run_migration($file); +} + +echo "Migrations completed successfully!\n"; + diff --git a/db/migrations/001_create_contact_submissions.sql b/db/migrations/001_create_contact_submissions.sql new file mode 100644 index 0000000..076a3d9 --- /dev/null +++ b/db/migrations/001_create_contact_submissions.sql @@ -0,0 +1,11 @@ +-- 001_create_contact_submissions.sql +-- Creates the table for storing contact form submissions. + +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; diff --git a/db/migrations/002_create_users_table.sql b/db/migrations/002_create_users_table.sql new file mode 100644 index 0000000..ec91e88 --- /dev/null +++ b/db/migrations/002_create_users_table.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS `users` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(255) NOT NULL, + `email` VARCHAR(255) NOT NULL UNIQUE, + `phone` VARCHAR(50) NULL UNIQUE, + `password` VARCHAR(255) NOT NULL, + `profile` TEXT NULL, -- For storing quiz answers/preferences as JSON + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/db/migrations/003_create_skills_table.sql b/db/migrations/003_create_skills_table.sql new file mode 100644 index 0000000..f46a084 --- /dev/null +++ b/db/migrations/003_create_skills_table.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS skills ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + description TEXT, + category VARCHAR(100), + video_url VARCHAR(255), + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/db/migrations/004_insert_sample_skills.sql b/db/migrations/004_insert_sample_skills.sql new file mode 100644 index 0000000..f840d6c --- /dev/null +++ b/db/migrations/004_insert_sample_skills.sql @@ -0,0 +1,7 @@ +INSERT INTO skills (title, description, category, video_url) VALUES +('Basic Motorcycle Repair', 'Learn to fix common issues with your motorcycle.', 'Auto', 'https://www.youtube.com/embed/example1'), +('Introduction to Soldering', 'A beginner\'s guide to soldering electronics.', 'Electronics', 'https://www.youtube.com/embed/example2'), +('Cooking for Beginners', 'Learn to cook simple and delicious meals.', 'Cooking', 'https://www.youtube.com/embed/example3'), +('Advanced Car Maintenance', 'Go beyond the basics of car maintenance.', 'Auto', 'https://www.youtube.com/embed/example4'), +('Building a Simple Robot', 'Create your first robot from scratch.', 'Electronics', 'https://www.youtube.com/embed/example5'), +('Baking Artisan Bread', 'Master the art of baking bread at home.', 'Cooking', 'https://www.youtube.com/embed/example6'); diff --git a/db/migrations/005_add_premium_features.sql b/db/migrations/005_add_premium_features.sql new file mode 100644 index 0000000..ebaca93 --- /dev/null +++ b/db/migrations/005_add_premium_features.sql @@ -0,0 +1,16 @@ +ALTER TABLE `users` ADD COLUMN `subscription_status` VARCHAR(50) NOT NULL DEFAULT 'free'; + +CREATE TABLE IF NOT EXISTS `subscriptions` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `user_id` INT NOT NULL, + `plan` VARCHAR(50) NOT NULL, + `start_date` DATETIME NOT NULL, + `end_date` DATETIME NOT NULL, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (user_id) REFERENCES users(id) +); + +ALTER TABLE `skills` ADD COLUMN `is_premium` BOOLEAN NOT NULL DEFAULT FALSE; + +-- Mark some existing skills as premium for demonstration +UPDATE `skills` SET `is_premium` = TRUE WHERE `id` IN (2, 4, 5); diff --git a/index.php b/index.php index 7205f3d..0b295dd 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,182 @@ - - + + - - - New Style - - - - - - - - - - - - - - - - - - - + + + SunSkills - Learn Practical Skills for a Brighter Future + + + + + + + + + + -
-
-

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

-
-
- + + + +
+
+
+
+

Learn Real Skills, Build Your Future

+

Affordable, practical courses from local experts to help you earn more and live better.

+ Explore Skills +
+
+
+
+ +
+
+
+
+

About SunSkills

+

We believe everyone deserves a chance to build a better future. SunSkills connects you with trusted local experts who teach practical, real-world skills. Whether you want to start a business, save money on repairs, or find a better job, our micro-learning courses are designed for your success.

+
+
+ A close-up of hands working on a detailed craft, representing practical skills. +
+
+
+
+ +
+
+

Featured Skills

+
+ +
+
+ A sample skill being taught, for example, bicycle repair. +
+
Basic Bicycle Repair
+

Learn to fix common bike problems and save money on repairs.

+
+
+
+ +
+
+ Smartphone photography skill. +
+
Smartphone Photography
+

Take stunning photos with the camera in your pocket.

+
+
+
+ +
+
+ Home electrical basics skill. +
+
Home Electrical Basics
+

Safely handle minor electrical tasks around the house.

+
+
+
+
+
+
+ +
+
+

What Our Learners Say

+
+
+
+
+

"I learned how to fix my own motorcycle! SunSkills saved me so much money. The instructor was a local mechanic and explained everything so clearly."

+
Ravi, Tier 2 City
+
+
+
+
+
+
+

"The photography course was amazing. I started a small side-business taking photos for local shops. It's a great way to earn extra income."

+
Priya, Small Town
+
+
+
+
+
+
+

"Finally, a platform for skills that matter in my daily life. The subscription is so affordable. Highly recommended!"

+ +
+
+
+
+
+
+ +
+
+

Get In Touch

+
+
+ + + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + + + + - + \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..d165c9b --- /dev/null +++ b/login.php @@ -0,0 +1,128 @@ +prepare("SELECT * FROM users WHERE email = ?"); + $stmt->execute([$email]); + $user = $stmt->fetch(); + + if ($user && password_verify($password, $user['password'])) { + // Password is correct, start session + $_SESSION['user_id'] = $user['id']; + $_SESSION['user_name'] = $user['name']; + $_SESSION['subscription_status'] = $user['subscription_status']; + header("Location: dashboard.php"); + exit; + } else { + $errors[] = "Invalid email or password."; + } + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} +?> + + + + + + Login - SunSkills + + + + + + + +
+
+
+
+
+

Log In to Your Account

+ + +
+ +
+ + + +
+ +

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

+ Don't have an account? Sign Up +

+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..5fbaa1f --- /dev/null +++ b/logout.php @@ -0,0 +1,22 @@ + + + + + + + Pricing - SunSkills + + + + + + + +
+
+
+

Unlock Your Potential

+

Join 10,000+ skilled professionals who are building their future with SunSkills.

+
+ +
+ +
+
+
+
Monthly
+
₹99/month
+
    +
  • Unlock 100+ skills
  • +
  • Offline downloads
  • +
  • Earn Certificates
  • +
  • Ask Instructors Questions
  • +
+ Start Learning + Cancel anytime +
+
+
+ + +
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/privacy.php b/privacy.php new file mode 100644 index 0000000..f22fe35 --- /dev/null +++ b/privacy.php @@ -0,0 +1,13 @@ + + +
+
+
+

Privacy Policy

+

This is a placeholder for the Privacy Policy page. Content will be added here soon.

+ Go back to Home +
+
+
+ + diff --git a/quiz.php b/quiz.php new file mode 100644 index 0000000..0754a22 --- /dev/null +++ b/quiz.php @@ -0,0 +1,151 @@ + $goal, + 'skill_level' => $skill_level, + 'interests' => $interests + ]; + $profile_json = json_encode($profile_data); + + try { + $pdo = db(); + $stmt = $pdo->prepare("UPDATE users SET profile = ? WHERE id = ?"); + if ($stmt->execute([$profile_json, $user_id])) { + $_SESSION['success_message'] = "Thank you! Your personalized recommendations are ready."; + header("Location: dashboard.php"); + exit; + } else { + $errors[] = "Failed to save your preferences. Please try again."; + } + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} + +?> + + + + + + Personalization Quiz - SunSkills + + + + + + + +
+
+
+
+
+

Tell Us About Yourself

+

Help us tailor your learning experience.

+ + +
+ +

+ +
+ + +
+ +
+

1. What is your primary goal?

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

2. What is your current skill level in your area of interest?

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

3. Which topics are you most interested in?

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/register.php b/register.php new file mode 100644 index 0000000..0acdcb4 --- /dev/null +++ b/register.php @@ -0,0 +1,131 @@ +prepare("SELECT id FROM users WHERE email = ?"); + $stmt->execute([$email]); + if ($stmt->fetch()) { + $errors[] = 'An account with this email already exists.'; + } else { + // Insert new user + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + $stmt = $pdo->prepare("INSERT INTO users (name, email, password) VALUES (?, ?, ?)"); + + if ($stmt->execute([$name, $email, $hashed_password])) { + $_SESSION['success_message'] = "Registration successful! Please log in."; + header("Location: login.php"); + exit; + } else { + $errors[] = "Registration failed. Please try again."; + } + } + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} +?> + + + + + + Register - SunSkills + + + + + + + +
+
+
+
+
+

Create Your Account

+ + +
+ +

+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
Password must be at least 8 characters long.
+
+
+ +
+
+

+ Already have an account? Log In +

+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/subscribe.php b/subscribe.php new file mode 100644 index 0000000..82de5ef --- /dev/null +++ b/subscribe.php @@ -0,0 +1,53 @@ +modify('+1 month'); +} elseif ($plan === 'yearly') { + $end_date->modify('+1 year'); +} + +$db = db(); + +// 3. Update user's subscription status +$stmt_user = $db->prepare("UPDATE users SET subscription_status = 'premium' WHERE id = ?"); +$user_updated = $stmt_user->execute([$user_id]); + +// 4. Create a record in the subscriptions table +$stmt_sub = $db->prepare("INSERT INTO subscriptions (user_id, plan, start_date, end_date) VALUES (?, ?, ?, ?)"); +$subscription_created = $stmt_sub->execute([ + $user_id, + $plan, + $start_date->format('Y-m-d H:i:s'), + $end_date->format('Y-m-d H:i:s') +]); + +if ($user_updated && $subscription_created) { + // 5. Update session and redirect with success message + $_SESSION['subscription_status'] = 'premium'; + $_SESSION['success_message'] = 'Welcome to Premium! You now have access to all courses.'; +} else { + $_SESSION['error_message'] = 'There was an error processing your subscription. Please try again.'; +} + +header('Location: dashboard.php'); +exit();