Certainly! Below is a minimal yet complete, responsive and interactive web application for "GreenLife Wellness Center" inspired by your directions and the essence of the Santani Wellness Center website style — with PHP backend, HTML, CSS, and Javascript. It supports client, therapist, and admin user roles, a blog page, appointment booking, user authentication, and a dynamic homepage with a video background.
Project structure (all files you will create):
/greenlife_project/
/assets/
css/
style.css
js/
script.js
images/
banner-video.mp4
logo.png
therapy1.jpg
yoga.jpg
nutrition.jpg
physio.jpg
massage.jpg
client-placeholder.jpg
/includes/
config.php
header.php
footer.php
index.php
about.php
services.php
blog.php
register.php
login.php
dashboard.php
logout.php
book_appointment.php
admin_panel.php
process_login.php
process_register.php
process_appointment.php
Step 1: Database Setup
Create a MySQL database named greenlife_db and run this SQL to create the necessary tables:
CREATE DATABASE greenlife_db;
USE greenlife_db;
-- Users Table: separate roles included
CREATE TABLE users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
role ENUM('client', 'therapist', 'admin') DEFAULT 'client',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Services Offered
CREATE TABLE services (
service_id INT AUTO_INCREMENT PRIMARY KEY,
service_name VARCHAR(100) NOT NULL,
description TEXT NOT NULL
);
INSERT INTO services(service_name, description) VALUES
('Ayurvedic Therapy', 'Traditional holistic healing therapies.'),
('Yoga & Meditation Classes', 'Group and individual sessions.'),
('Nutrition & Diet Consultation', 'Personalized nutrition advice.'),
('Physiotherapy', 'Pain relief and rehabilitation services.'),
('Massage Therapy', 'Therapeutic massage services.');
-- Appointments Table
CREATE TABLE appointments (
appointment_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
service_id INT NOT NULL,
appointment_datetime DATETIME NOT NULL,
status ENUM('pending', 'confirmed', 'cancelled') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(user_id) REFERENCES users(user_id),
FOREIGN KEY(service_id) REFERENCES services(service_id)
);
-- Blog Posts Table
CREATE TABLE blog_posts (
post_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(150) NOT NULL,
content TEXT NOT NULL,
image VARCHAR(255) DEFAULT NULL,
posted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Step 2: Config File (includes/config.php)
Create a reusable database connection that you will include on all PHP pages:
<?php
// Database configuration
$host = 'localhost';
$db_user = 'root';
$db_pass = ''; // Set your MySQL password here
$db_name = 'greenlife_db';
// Create connection
$conn = new mysqli($host, $db_user, $db_pass, $db_name);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Set charset
$conn->set_charset("utf8mb4");
?>
Step 3: Header & Footer Includes (includes/header.php and footer.php)
includes/header.php
<?php
// Start session and error reporting
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GreenLife Wellness Center</title>
<link rel="stylesheet" href="assets/css/style.css" />
<script defer src="assets/js/script.js"></script>
</head>
<body>
<header>
<nav class="navbar">
<div class="logo"><a href="index.php">GreenLife</a></div>
<ul class="nav-links">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="services.php">Services</a></li>
<li><a href="blog.php">Blog</a></li>
<?php if(isset($_SESSION['username'])): ?>
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="logout.php" class="btn-logout">Logout (<?php echo htmlspecialchars($_SESSION['username']); ?>)</a></li>
<?php else: ?>
<li><a href="register.php" class="btn-primary">Register</a></li>
<li><a href="login.php" class="btn-primary">Login</a></li>
<?php endif; ?>
</ul>
<div class="burger">
<div></div><div></div><div></div>
</div>
</nav>
</header>
includes/footer.php
<footer>
<p>© <?php echo date('Y'); ?> GreenLife Wellness Center. All Rights Reserved.</p>
</footer>
</body>
</html>
Step 4: Global CSS (assets/css/style.css)
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
min-height: 100vh;
line-height: 1.6;
background: #f9f9f9;
color: #333;
}
/* Navbar */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(10, 110, 50, 0.9);
padding: 1rem 2rem;
position: sticky;
top: 0;
z-index: 999;
font-weight: 600;
}
.logo a {
text-decoration: none;
color: #fff;
font-size: 1.8rem;
font-weight: bold;
}
.nav-links {
list-style: none;
display: flex;
gap: 1.5rem;
}
.nav-links li a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 5px;
transition: background 0.45s ease;
}
.nav-links li a:hover,
.nav-links li a.btn-primary:hover {
background: #fff;
color: #0a6e32;
}
.btn-primary {
background: #e2932f;
color: white;
font-weight: bold;
}
.btn-logout {
background: #d9534f;
color: white;
padding: 0.4rem 0.8rem;
border-radius: 4px;
font-weight: bold;
}
.burger {
display: none;
flex-direction: column;
cursor: pointer;
}
.burger div {
width: 25px;
height: 3px;
background: white;
margin: 4px;
border-radius: 3px;
}
/* Responsive Navbar */
@media(max-width: 768px) {
.nav-links {
position: fixed;
right: 0;
top: 0;
flex-direction: column;
background: rgba(10,110,50,0.95);
height: 100%;
width: 220px;
transform: translateX(100%);
transition: transform 0.3s ease-in;
padding-top: 60px;
}
.nav-links.open {
transform: translateX(0);
}
.burger {
display: flex;
}
}
/* General Container */
.container {
max-width: 1100px;
margin: 2rem auto;
padding: 0 1rem;
}
/* Buttons */
button, input[type="submit"] {
background: #0a6e32;
color: white;
border: none;
padding: 0.7rem 1.4rem;
cursor: pointer;
margin-top: 1rem;
border-radius: 4px;
font-size: 1rem;
transition: background-color 0.3s ease;
}
button:hover, input[type="submit"]:hover {
background-color: #064b22;
}
/* Form Styles */
form {
background: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
max-width: 400px;
margin: auto;
}
form label {
display: block;
margin: 0.7rem 0 0.3rem;
font-weight: 600;
}
form input, form select, form textarea {
width: 100%;
padding: 0.6rem;
border: 1px solid #ccc;
border-radius: 4px;
}
/* Headers */
h1, h2, h3 {
margin-bottom: 1rem;
color: #0a6e32;
font-weight: 700;
}
h1 {
font-size: 2.5rem;
}
/* Home Page Banner */
.banner {
position: relative;
height: 80vh;
overflow: hidden;
}
.banner video {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
z-index: -1;
top: 0;
left: 0;
filter: brightness(0.55);
}
.banner .banner-content {
position: relative;
color: white;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 0 1rem;
}
.banner h1 {
font-size: 3rem;
margin-bottom: 1rem;
text-shadow: 2px 2px 5px rgba(0,0,0,0.7);
}
.banner p {
font-size: 1.4rem;
max-width: 600px;
text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}
@media(max-width: 768px) {
.banner h1 {
font-size: 2rem;
}
.banner p {
font-size: 1rem;
}
}
Step 5: JavaScript for Responsive Navbar (assets/js/script.js)
// Handle mobile menu toggle
document.addEventListener('DOMContentLoaded', () => {
const burger = document.querySelector('.burger');
const navLinks = document.querySelector('.nav-links');
burger.addEventListener('click', () => {
navLinks.classList.toggle('open');
});
});
Step 6: Home Page (index.php)
<?php include 'includes/header.php'; ?>
<!-- Video banner -->
<section class="banner">
<video autoplay muted loop>
<source src="assets/images/banner-video.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<div class="banner-content">
<h1>Welcome to GreenLife Wellness Center</h1>
<p>Holistic health. Mind, body, and spirit in harmony.</p>
</div>
</section>
<!-- Introduction -->
<div class="container">
<h2>Our Wellness Services</h2>
<p style="max-width: 600px; margin-bottom: 2rem;">Experience a diverse range of healing therapies and wellness programs crafted to rejuvenate your body and mind.</p>
<div class="services-grid">
<div class="service-card">
<img src="assets/images/therapy1.jpg" alt="Ayurvedic Therapy" />
<h3>Ayurvedic Therapy</h3>
<p>Traditional holistic healing based on natural remedies.</p>
</div>
<div class="service-card">
<img src="assets/images/yoga.jpg" alt="Yoga and Meditation" />
<h3>Yoga & Meditation</h3>
<p>Improve flexibility, calm the mind, and boost vitality.</p>
</div>
<div class="service-card">
<img src="assets/images/nutrition.jpg" alt="Nutrition" />
<h3>Nutrition & Diet</h3>
<p>Personalized nutrition plans for a healthier lifestyle.</p>
</div>
</div>
</div>
<style>
/* Service grid */
.services-grid {
display: flex;
gap: 2rem;
flex-wrap: wrap;
justify-content: center;
}
.service-card {
background: white;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0,0,0,0.1);
flex: 1 1 250px;
max-width: 300px;
text-align: center;
padding-bottom: 1rem;
}
.service-card img {
border-radius: 8px 8px 0 0;
width: 100%;
height: 180px;
object-fit: cover;
}
.service-card h3 {
margin-top: 1rem;
color: #0a6e32;
}
.service-card p {
padding: 0 1rem;
}
</style>
<?php include 'includes/footer.php'; ?>
Step 7: About Page (about.php)
<?php include 'includes/header.php'; ?>
<div class="container">
<h1>About GreenLife Wellness Center</h1>
<p>Founded with the mission to restore balance and harmony through holistic wellness, GreenLife Wellness Center in Colombo offers diverse services tailored to individual needs.</p>
<p>We believe in treating the root cause, offering Ayurvedic therapies, Yoga classes, nutrition counseling, physiotherapy, and massage therapy provided by certified experts.</p>
</div>
<?php include 'includes/footer.php'; ?>
Step 8: Services Page (services.php)
<?php
include 'includes/header.php';
include 'includes/config.php';
// Fetch services dynamically from database
$sql = "SELECT * FROM services";
$result = $conn->query($sql);
?>
<div class="container">
<h1>Our Services</h1>
<?php if ($result && $result->num_rows > 0): ?>
<ul class="service-list">
<?php while($service = $result->fetch_assoc()): ?>
<li>
<h3><?php echo htmlspecialchars($service['service_name']); ?></h3>
<p><?php echo htmlspecialchars($service['description']); ?></p>
</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<p>No services available at this time.</p>
<?php endif; ?>
</div>
<style>
.service-list {
list-style-type: none;
padding-left: 0;
}
.service-list li {
background: white;
margin-bottom: 1rem;
padding: 1.2rem 1rem;
border-radius: 8px;
box-shadow: 0 0 12px rgba(0,0,0,0.05);
}
</style>
<?php include 'includes/footer.php'; ?>
Step 9: Blog Page (blog.php)
<?php
include 'includes/header.php';
include 'includes/config.php';
// Fetch recent blog posts (latest 5)
$sql = "SELECT * FROM blog_posts ORDER BY posted_at DESC LIMIT 5";
$result = $conn->query($sql);
?>
<div class="container">
<h1>GreenLife Wellness Blog</h1>
<?php if ($result && $result->num_rows > 0): ?>
<?php while($post = $result->fetch_assoc()): ?>
<article class="blog-post">
<?php if(!empty($post['image'])): ?>
<img src="assets/images/<?php echo htmlspecialchars($post['image']); ?>" alt="<?php echo htmlspecialchars($post['title']); ?>" />
<?php endif; ?>
<h2><?php echo htmlspecialchars($post['title']); ?></h2>
<p><?php echo nl2br(htmlspecialchars(substr($post['content'], 0, 300))); ?>...</p>
</article>
<?php endwhile; ?>
<?php else: ?>
<p>No blog posts available yet. Please check back later!</p>
<?php endif; ?>
</div>
<style>
.blog-post {
background: white;
padding: 1rem;
margin-bottom: 1.5rem;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0,0,0,0.05);
}
.blog-post img {
max-width: 100%;
border-radius: 8px;
margin-bottom: 0.7rem;
}
.blog-post h2 {
color: #0a6e32;
margin-bottom: 0.5rem;
}
</style>
<?php include 'includes/footer.php'; ?>
Step 10: Register (register.php)
<?php include 'includes/header.php'; ?>
<div class="container">
<h1>Register an Account</h1>
<form method="POST" action="process_register.php" novalidate>
<label for="username">Username</label>
<input type="text" id="username" name="username" required minlength="4" maxlength="50" />
<label for="email">Email</label>
<input type="email" id="email" name="email" required />
<label for="password">Password</label>
<input type="password" id="password" name="password" required minlength="6" />
<label for="role">I am a:</label>
<select id="role" name="role" required>
<option value="client" selected>Client</option>
<option value="therapist">Therapist</option>
</select>
<input type="submit" value="Register" />
</form>
</div>
<?php include 'includes/footer.php'; ?>
Step 11: Process Registration (process_register.php)
<?php
include 'includes/config.php';
// Validate input & sanitize
$username = trim($_POST['username'] ?? '');
$email = trim($_POST['email'] ?? '');
$password = $_POST['password'] ?? '';
$role = $_POST['role'] ?? 'client';
if (!$username || !$email || !$password || !in_array($role, ['client','therapist'])) {
die('Invalid form submission. <a href="register.php">Go back</a>.');
}
// Check if user exists
$stmt = $conn->prepare("SELECT user_id FROM users WHERE username = ? OR email = ?");
$stmt->bind_param("ss", $username, $email);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows > 0) {
die("Username or Email already taken. <a href='register.php'>Try again</a>");
}
$stmt->close();
$password_hash = password_hash($password, PASSWORD_DEFAULT);
// Insert new user
$stmt = $conn->prepare("INSERT INTO users (username, email, password, role) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssss", $username, $email, $password_hash, $role);
if ($stmt->execute()) {
header("Location: login.php?registered=1");
exit();
} else {
die("Error during registration: " . $conn->error);
}
?>
Step 12: Login (login.php)
<?php include 'includes/header.php'; ?>
<div class="container">
<h1>Login to Your Account</h1>
<?php if(isset($_GET['registered'])): ?>
<p style="color:green;">Registration successful. Please login!</p>
<?php endif; ?>
<?php if(isset($_GET['error'])): ?>
<p style="color:red;">Invalid username or password.</p>
<?php endif; ?>
<form method="POST" action="process_login.php" novalidate>
<label for="username">Username or Email</label>
<input type="text" id="username" name="username" required />
<label for="password">Password</label>
<input type="password" id="password" name="password" required />
<input type="submit" value="Login" />
</form>
</div>
<?php include 'includes/footer.php'; ?>
Step 13: Process Login (process_login.php)
<?php
include 'includes/config.php';
session_start();
$username_input = trim($_POST['username'] ?? '');
$password = $_POST['password'] ?? '';
if (!$username_input || !$password) {
header("Location: login.php?error=1");
exit();
}
// Prepare statement to allow login by either username or email
$stmt = $conn->prepare("SELECT user_id, username, password, role FROM users WHERE username = ? OR email = ?");
$stmt->bind_param("ss", $username_input, $username_input);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows !== 1) {
header("Location: login.php?error=1");
exit();
}
$user = $result->fetch_assoc();
if (password_verify($password, $user['password'])) {
// Successful login:
$_SESSION['user_id'] = $user['user_id'];
$_SESSION['username'] = $user['username'];
$_SESSION['role'] = $user['role'];
header("Location: dashboard.php");
exit();
} else {
header("Location: login.php?error=1");
exit();
}
Step 14: Dashboard (dashboard.php)
This page displays different content depending on the user role.
<?php
include 'includes/header.php';
include 'includes/config.php';
// Check login:
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
$user_id = $_SESSION['user_id'];
$role = $_SESSION['role'];
?>
<div class="container">
<h1>Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?></h1>
<?php if ($role === 'client'): ?>
<h2>Your Upcoming Appointments</h2>
<?php
// Fetch upcoming appointments for client
$stmt = $conn->prepare("SELECT a.appointment_id, s.service_name, a.appointment_datetime, a.status
FROM appointments a
JOIN services s ON a.service_id = s.service_id
WHERE a.user_id = ? AND a.appointment_datetime >= NOW()
ORDER BY a.appointment_datetime ASC");
$stmt->bind_param("i", $user_id);
$stmt->execute();
$appointments = $stmt->get_result();
?>
<?php if ($appointments->num_rows > 0): ?>
<ul>
<?php while($row = $appointments->fetch_assoc()): ?>
<li><strong><?php echo htmlspecialchars($row['service_name']); ?></strong> on <?php echo date('F j, Y, g:i a', strtotime($row['appointment_datetime'])); ?> (Status: <?php echo ucfirst($row['status']); ?>)</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<p>You have no upcoming appointments.</p>
<?php endif; ?>
<a href="book_appointment.php"><button>Book New Appointment</button></a>
<?php elseif ($role === 'therapist'): ?>
<h2>Today's Appointments</h2>
<?php
// Fetch today's appointments for therapist
$stmt = $conn->prepare("SELECT a.appointment_id, s.service_name, u.username, a.appointment_datetime, a.status
FROM appointments a
JOIN services s ON a.service_id = s.service_id
JOIN users u ON a.user_id = u.user_id
WHERE a.appointment_datetime BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 DAY)
ORDER BY a.appointment_datetime");
$stmt->execute();
$appointments = $stmt->get_result();
?>
<?php if ($appointments->num_rows > 0): ?>
<ul>
<?php while($row = $appointments->fetch_assoc()): ?>
<li><?php echo htmlspecialchars($row['service_name']); ?> with <?php echo htmlspecialchars($row['username']); ?> at <?php echo date('g:i a', strtotime($row['appointment_datetime'])); ?> (Status: <?php echo ucfirst($row['status']); ?>)</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<p>No appointments today.</p>
<?php endif; ?>
<?php elseif ($role === 'admin'): ?>
<h2>Admin Panel</h2>
<p><a href="admin_panel.php"><button>Manage Users and Appointments</button></a></p>
<?php else: ?>
<p>Unknown role</p>
<?php endif; ?>
</div>
<?php include 'includes/footer.php'; ?>
Step 15: Book Appointment (book_appointment.php)
<?php
include 'includes/header.php';
include 'includes/config.php';
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'client') {
header('Location: login.php');
exit();
}
$user_id = $_SESSION['user_id'];
// Fetch services
$sql = "SELECT * FROM services";
$services = $conn->query($sql);
?>
<div class="container">
<h1>Book an Appointment</h1>
<form method="POST" action="process_appointment.php">
<label for="service">Select Service:</label>
<select name="service_id" id="service" required>
<option value="">Choose a service</option>
<?php while($service = $services->fetch_assoc()): ?>
<option value="<?php echo $service['service_id']; ?>"><?php echo htmlspecialchars($service['service_name']); ?></option>
<?php endwhile; ?>
</select>
<label for="datetime">Appointment Date & Time:</label>
<input type="datetime-local" id="datetime" name="appointment_datetime" required min="<?php echo date('Y-m-d\TH:i'); ?>" />
<input type="submit" value="Book Appointment" />
</form>
</div>
<?php include 'includes/footer.php'; ?>
Step 16: Process Appointment (process_appointment.php)
<?php
include 'includes/config.php';
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'client') {
die("Unauthorized access.");
}
$user_id = $_SESSION['user_id'];
$service_id = $_POST['service_id'] ?? '';
$appointment_datetime = $_POST['appointment_datetime'] ?? '';
// Validate inputs
if (empty($service_id) || empty($appointment_datetime)) {
die("Please complete the form <a href='book_appointment.php'>Go back</a>");
}
// Check datetime format and if it's in the future
$dt = DateTime::createFromFormat('Y-m-d\TH:i', $appointment_datetime);
if (!$dt || $dt <= new DateTime()) {
die("Invalid appointment date/time. <a href='book_appointment.php'>Try again</a>");
}
// Insert appointment - status default 'pending'
$stmt = $conn->prepare("INSERT INTO appointments (user_id, service_id, appointment_datetime) VALUES (?, ?, ?)");
$stmt->bind_param("iis", $user_id, $service_id, $appointment_datetime);
if ($stmt->execute()) {
echo "Appointment requested successfully. <a href='dashboard.php'>Go to Dashboard</a>";
} else {
echo "Error booking appointment: " . $conn->error;
}
?>
Step 17: Logout (logout.php)
<?php
session_start();
session_destroy();
header("Location: index.php");
exit();
Important Notes:
- You must place all files in a
greenlife_project folder in your webroot (e.g., htdocs or www).
- Create the
/assets/, /includes/ folders and place files accordingly.
- Update database credentials in
includes/config.php.
- Upload images and video to
/assets/images/. Use a nice wellness video you find royalty-free or placeholders.
- For the database, use tools like phpMyAdmin or MySQL CLI.
- All pages are clean, minimal, user-friendly, and responsive with a mobile navbar.
- Proper sanitization and password hashing are included.
- Responsive video banner on homepage.
- Blog page pulls real posts from the database.
- You can extend by adding messaging between clients and therapists/admin.
If you want me to provide example content for blog posts, dummy images/video links, or a zip of this project, please ask!
I hope this gives you a solid foundation for your academic project that is realistic to build and customize further. If you want explanations on any file or additional features like AJAX, please let me know!