Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php session_start();
include "db.php"; // Add this to access database connection
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ELearner - Learn Languages</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="font-styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body class="bg-gray-100 min-h-screen flex flex-col">
<div class="main-content flex-1">
<div class="container mx-auto px-4 py-4 sm:py-8">
<header class="bg-white rounded-lg shadow-md p-4 sm:p-6 mb-6 sm:mb-8">
<div class="flex flex-wrap items-center justify-between">
<div class="flex items-center">
<a href="homepage.php">
<img src="images/icon-e-learner-blue.png" alt="ELearner Logo" class="h-10 sm:h-12 mr-3 sm:mr-4">
</a>
<div>
<h1 class="text-2xl sm:text-3xl font-bold text-blue-600">Welcome to ELearner</h1>
<p class="text-sm sm:text-base text-gray-600">Your platform for learning English vocabulary</p>
</div>
</div>
<!-- Mobile menu button -->
<button id="mobileMenuBtn" class="md:hidden p-2 rounded text-blue-600 hover:bg-blue-100">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
<nav id="desktopMenu" class="hidden md:block">
<ul class="flex space-x-4 sm:space-x-6">
<li><a href="homepage.php" class="text-blue-500 font-medium hover:underline">Home</a></li>
<?php if(isset($_SESSION['user_id'])): ?>
<li><a href="index.php" class="text-blue-500 font-medium hover:underline">Vocabulary Tool</a></li>
<li><a href="my_lists.php" class="text-blue-500 font-medium hover:underline">My Lists</a></li>
<li><a href="list_hub.php" class="text-blue-500 font-medium hover:underline">List Hub</a></li>
<li><a href="profile.php" class="text-blue-500 font-medium hover:underline">My Profile</a></li>
<?php if(isset($_SESSION['is_admin']) && $_SESSION['is_admin'] == 1): ?>
<li><a href="admin.php" class="text-purple-500 font-medium hover:underline">Admin</a></li>
<?php endif; ?>
<li><a href="logout.php" class="text-red-500 font-medium hover:underline">Logout</a></li>
<?php else: ?>
<li><a href="login.php" class="text-blue-500 font-medium hover:underline">Login</a></li>
<li><a href="register.php" class="text-blue-500 font-medium hover:underline">Register</a></li>
<?php endif; ?>
<li>
<button id="fontToggleBtn" class="bg-purple-500 text-white px-3 py-1 rounded hover:bg-purple-600">
Toggle Font
</button>
</li>
</ul>
</nav>
</div>
<!-- Mobile menu, hidden by default -->
<nav id="mobileMenu" class="md:hidden hidden mt-4 pb-2">
<ul class="flex flex-col space-y-3">
<li><a href="homepage.php" class="block text-blue-500 font-medium hover:underline">Home</a></li>
<?php if(isset($_SESSION['user_id'])): ?>
<li><a href="index.php" class="block text-blue-500 font-medium hover:underline">Vocabulary Tool</a></li>
<li><a href="my_lists.php" class="block text-blue-500 font-medium hover:underline">My Lists</a></li>
<li><a href="list_hub.php" class="block text-blue-500 font-medium hover:underline">List Hub</a></li>
<li><a href="profile.php" class="block text-blue-500 font-medium hover:underline">My Profile</a></li>
<?php if(isset($_SESSION['is_admin']) && $_SESSION['is_admin'] == 1): ?>
<li><a href="admin.php" class="block text-purple-500 font-medium hover:underline">Admin</a></li>
<?php endif; ?>
<li><a href="logout.php" class="block text-red-500 font-medium hover:underline">Logout</a></li>
<?php else: ?>
<li><a href="login.php" class="block text-blue-500 font-medium hover:underline">Login</a></li>
<li><a href="register.php" class="block text-blue-500 font-medium hover:underline">Register</a></li>
<?php endif; ?>
<li>
<button id="mobileFontToggleBtn" class="bg-purple-500 text-white px-3 py-1 rounded hover:bg-purple-600">
Toggle Font
</button>
</li>
</ul>
</nav>
</header>
<!-- Inspirational banner -->
<div class="mb-6 sm:mb-8 rounded-lg overflow-hidden shadow-lg relative">
<div class="absolute inset-0 bg-gradient-to-r from-blue-600 to-indigo-800 opacity-90"></div>
<div class="relative z-10 flex flex-col md:flex-row items-center">
<div class="p-6 sm:p-10 text-white md:w-2/3">
<h2 class="text-2xl sm:text-3xl lg:text-4xl font-bold mb-3">Begin Your Language Journey Today!</h2>
<p class="text-lg sm:text-xl opacity-90 mb-6">Build your vocabulary, track your progress, and master English at your own pace. Join thousands of learners who've improved their language skills with ELearner.</p>
<?php if(!isset($_SESSION['user_id'])): ?>
<div class="flex flex-wrap gap-4">
<a href="register.php" class="inline-block bg-white text-blue-700 font-bold px-6 py-3 rounded-lg hover:bg-blue-50 transition duration-200">
Start Learning For Free
</a>
<a href="login.php" class="inline-block bg-transparent border-2 border-white text-white font-bold px-6 py-3 rounded-lg hover:bg-white hover:bg-opacity-20 transition duration-200">
Sign In
</a>
</div>
<?php endif; ?>
</div>
<div class="md:w-1/3 p-6">
<img src="https://images.unsplash.com/photo-1546521343-4eb2c01aa44b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
alt="Language learning" class="rounded-lg shadow-md w-full object-cover h-48 md:h-64">
</div>
</div>
</div>
<main class="bg-white rounded-lg shadow-md p-4 sm:p-6">
<h2 class="text-xl sm:text-2xl font-bold mb-4">Start Learning Today</h2>
<div class="mb-6">
<h3 class="text-lg sm:text-xl font-semibold mb-3 text-blue-600">ELearner β The Easiest Way to Learn English for Free</h3>
<p class="mb-3">Are you looking for a simple, effective, and completely free way to improve your English vocabulary? ELearner is the perfect tool for you! It's an online platform designed to make learning English words easy, structured, and interactiveβeven if you're just starting out.</p>
<h4 class="font-medium text-blue-600 mt-4 mb-2">What is ELearner?</h4>
<p class="mb-3">ELearner is a free website that helps you organize and learn English vocabulary using a unique method: customizable word lists. Instead of struggling with traditional textbooks or complicated courses, you can create and use vocabulary tables to structure your learning in a way that makes sense to you.</p>
<h4 class="font-medium text-blue-600 mt-4 mb-2">How does it work?</h4>
<div class="mb-3">
<p class="mb-2"><span class="font-medium">Create Word Lists</span> β You can design your own vocabulary tables to organize Dutch and English word pairs that you want to learn.</p>
<p class="mb-2"><span class="font-medium">Save Multiple Lists</span> β Create different lists for various topics or difficulty levels, like travel vocabulary, business terms, or everyday phrases.</p>
<p class="mb-2"><span class="font-medium">Interactive Learning</span> β Practice your vocabulary with our interactive learning tool that tests your knowledge in both directions: Dutch to English and English to Dutch.</p>
<p><span class="font-medium">Track Your Progress</span> β See your scores after each practice session to monitor your improvement over time.</p>
</div>
<div class="border-t border-gray-200 pt-4 mt-4">
<p class="text-blue-600 italic">Ready to improve your English vocabulary? Join ELearner today and start building your personalized learning experience!</p>
</div>
</div>
<!-- Video explanation section -->
<div class="mb-8 border border-blue-200 rounded-lg p-4 bg-blue-50">
<h3 class="text-lg font-semibold mb-3 text-blue-600">Watch How ELearner Works</h3>
<div class="relative w-full overflow-hidden rounded-lg" style="padding-top: 56.25%;">
<!-- 16:9 aspect ratio container using padding-top: 56.25% -->
<video
class="absolute top-0 left-0 w-full h-full rounded-lg object-fill"
src="videos/202504141411 (1).mp4"
controls>
Your browser does not support the video tag.
</video>
</div>
</div>
<?php if(isset($_SESSION['user_id'])): ?>
<p class="mb-4">You're logged in! Start adding and practicing vocabulary in our tool.</p>
<div class="flex flex-wrap gap-4">
<a href="index.php" class="inline-block bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Go to Vocabulary Tool</a>
<a href="my_lists.php" class="inline-block bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">View My Lists</a>
<a href="list_hub.php" class="inline-block bg-purple-500 text-white px-4 py-2 rounded hover:bg-purple-600">Explore List Hub</a>
</div>
<?php else: ?>
<p class="mb-4">Please login or register to start using our vocabulary learning tools.</p>
<div class="flex flex-wrap gap-4">
<a href="login.php" class="inline-block bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Login</a>
<a href="register.php" class="inline-block bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">Register</a>
</div>
<?php endif; ?>
<!-- Reviews Section -->
<section class="mt-8 border-t border-gray-200 pt-6">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-bold">User Reviews</h2>
<?php if(isset($_SESSION['user_id'])): ?>
<?php
// Check if user already has a review
$stmt = $conn->prepare("SELECT id FROM reviews WHERE user_id = ?");
$stmt->execute([$_SESSION['user_id']]);
$userHasReview = $stmt->fetch();
if ($userHasReview):
?>
<a href="review.php" class="inline-block bg-blue-500 text-white px-3 py-1 rounded hover:bg-blue-600 text-sm">Manage Your Review</a>
<?php else: ?>
<a href="review.php" class="inline-block bg-yellow-500 text-white px-3 py-1 rounded hover:bg-yellow-600 text-sm">Leave a Review</a>
<?php endif; ?>
<?php endif; ?>
</div>
<?php
// Get reviews with usernames - limited to 3
try {
$stmt = $conn->prepare("
SELECT r.*, u.username
FROM reviews r
JOIN users u ON r.user_id = u.id
ORDER BY r.created_at DESC
LIMIT 3
");
$stmt->execute();
$reviews = $stmt->fetchAll();
} catch (PDOException $e) {
$reviews = [];
}
if (count($reviews) === 0):
?>
<div class="bg-gray-50 p-3 rounded text-center">
<p class="text-gray-500">No reviews yet. Be the first to leave feedback!</p>
</div>
<?php else: ?>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3">
<?php foreach ($reviews as $review): ?>
<div class="bg-gray-50 p-3 rounded border border-gray-100 flex flex-col h-full">
<div class="flex justify-between items-center mb-1">
<span class="font-medium"><?= htmlspecialchars($review['username']) ?></span>
<span class="text-gray-500 text-xs"><?= date('M j, Y', strtotime($review['created_at'])) ?></span>
</div>
<div class="text-yellow-500 mb-1">
<?php for ($i = 0; $i < 5; $i++): ?>
<?php if ($i < $review['rating']): ?>
<i class="fas fa-star"></i>
<?php else: ?>
<i class="far fa-star"></i>
<?php endif; ?>
<?php endfor; ?>
</div>
<p class="text-gray-700"><?= htmlspecialchars($review['comment']) ?></p>
<?php if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == $review['user_id']): ?>
<div class="mt-auto pt-2">
<a href="review.php" class="text-sm text-blue-500 hover:underline">Edit/Delete</a>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if (count($reviews) > 0): ?>
<div class="text-center mt-4">
<a href="all_reviews.php" class="text-blue-500 hover:underline">View All Reviews</a>
</div>
<?php endif; ?>
</section>
</main>
</div>
</div>
<?php include "footer.php"; ?>
<script>
// Mobile menu toggle
document.getElementById("mobileMenuBtn").addEventListener("click", function() {
const mobileMenu = document.getElementById("mobileMenu");
mobileMenu.classList.toggle("hidden");
});
// Copy font toggle functionality to mobile button
if (document.getElementById("mobileFontToggleBtn")) {
document.getElementById("mobileFontToggleBtn").addEventListener("click", function() {
// Trigger the same behavior as the desktop button
document.getElementById("fontToggleBtn").click();
});
}
</script>
<script src="font-toggle.js"></script>
</body>
</html>