Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 DocumentaryHub

A documentary streaming website inspired by Amazon Prime Video.
Built with PHP, MySQL, Bootstrap 5 β€” a complete BCA-level project.


πŸ“ Folder Structure

documentaryhub/
β”œβ”€β”€ index.php               ← Homepage (hero, trending, new, popular)
β”œβ”€β”€ watch.php               ← Documentary detail + YouTube player
β”œβ”€β”€ search.php              ← Search + filter by category
β”œβ”€β”€ categories.php          ← Browse all categories
β”œβ”€β”€ login.php               ← User login
β”œβ”€β”€ register.php            ← User registration
β”œβ”€β”€ dashboard.php           ← User dashboard (history, watchlist, profile)
β”œβ”€β”€ logout.php              ← Logout
β”œβ”€β”€ ajax.php                ← AJAX: favorites & view tracking
β”œβ”€β”€ cron.php                ← YouTube auto-fetch cron script
β”œβ”€β”€ schema.sql              ← MySQL database schema + sample data
β”‚
β”œβ”€β”€ includes/
β”‚   β”œβ”€β”€ config.php          ← DB config, helpers, session
β”‚   β”œβ”€β”€ header.php          ← Navbar + HTML head
β”‚   β”œβ”€β”€ footer.php          ← Footer + scripts
β”‚   └── card.php            ← Reusable documentary card component
β”‚
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ css/style.css       ← Custom dark theme stylesheet
β”‚   └── js/main.js          ← JavaScript (favorites, toast, lazy load)
β”‚
β”œβ”€β”€ admin/
β”‚   β”œβ”€β”€ login.php           ← Admin login page
β”‚   β”œβ”€β”€ index.php           ← Admin dashboard with statistics
β”‚   β”œβ”€β”€ documentaries.php   ← List / search documentaries
β”‚   β”œβ”€β”€ add-documentary.php ← Add new documentary
β”‚   β”œβ”€β”€ edit-documentary.php← Edit existing documentary
β”‚   β”œβ”€β”€ categories.php      ← Add / edit / delete categories
β”‚   β”œβ”€β”€ users.php           ← View / suspend / delete users
β”‚   β”œβ”€β”€ delete.php          ← Delete handler (docs, categories, users)
β”‚   β”œβ”€β”€ auth.php            ← Admin authentication guard
β”‚   β”œβ”€β”€ header.php          ← Admin layout header + sidebar
β”‚   └── footer.php          ← Admin layout footer
β”‚
└── uploads/
    └── thumbnails/         ← (optional) local thumbnail storage

⚑ Quick Setup

Requirements

  • PHP 7.4+ (PHP 8.x recommended)
  • MySQL 5.7+ or MariaDB 10.3+
  • Apache/Nginx with mod_rewrite (for XAMPP/WAMP/Laragon)
  • A web browser

Step 1 β€” Clone / Copy Project

Place the documentaryhub/ folder inside your web root:

  • XAMPP: C:/xampp/htdocs/documentaryhub/
  • WAMP: C:/wamp64/www/documentaryhub/
  • Linux: /var/www/html/documentaryhub/

Step 2 β€” Create the Database

  1. Open phpMyAdmin β†’ http://localhost/phpmyadmin
  2. Click "New" β†’ name it documentaryhub β†’ Create
  3. Click the database β†’ Import tab
  4. Select schema.sql β†’ Click Go

Or via terminal:

mysql -u root -p -e "CREATE DATABASE documentaryhub;"
mysql -u root -p documentaryhub < schema.sql

Step 3 β€” Configure Database

Open includes/config.php and update:

define('DB_HOST', 'localhost');
define('DB_NAME', 'documentaryhub');
define('DB_USER', 'root');        // ← your MySQL username
define('DB_PASS', '');            // ← your MySQL password
define('SITE_URL', 'http://localhost/documentaryhub');

Step 4 β€” Browse the Site

URL Description
http://localhost/documentaryhub/ Homepage
http://localhost/documentaryhub/login.php User Login
http://localhost/documentaryhub/register.php Register
http://localhost/documentaryhub/admin/ Admin Panel
http://localhost/documentaryhub/admin/login.php Admin Login

πŸ” Default Credentials

⚠️ Change these immediately in a real deployment!

Admin Account

Field Value
Email admin@documentaryhub.com
Password password

Sample User Account

Field Value
Email john@example.com
Password password

πŸ€– YouTube Auto-Fetch (cron.php)

Step 1 β€” Get a YouTube Data API v3 Key

  1. Go to Google Cloud Console
  2. Create a new project β†’ Enable YouTube Data API v3
  3. Create credentials β†’ API Key
  4. Paste it in includes/config.php:
    define('YOUTUBE_API_KEY', 'AIza...');

Step 2 β€” Test Manually

php /var/www/html/documentaryhub/cron.php

Step 3 β€” Schedule via Crontab (Linux)

crontab -e

Add this line to run daily at 6 AM:

0 6 * * * php /var/www/html/documentaryhub/cron.php >> /var/log/dh_cron.log 2>&1

Channels monitored:

  • DW Documentary
  • Free Documentary
  • BBC Earth
  • National Geographic
  • PBS
  • Absolute History

πŸ—„οΈ Database Tables

Table Description
users Registered users (id, username, email, password_hash, role)
categories Documentary categories (id, name, slug, icon)
documentaries All documentaries (id, title, youtube_video_id, views, ...)
favorites User watchlist entries
watch_history User watch events with progress

✨ Features Checklist

Frontend

  • Amazon Prime Video-inspired dark UI (#0F171E)
  • Hero carousel with featured documentaries
  • Trending / New / Popular sections
  • Horizontal scroll rows (Netflix-style)
  • Responsive grid (mobile, tablet, desktop)
  • Category browsing + filtering
  • Full-text search with sort options
  • YouTube iframe embed player
  • Related documentaries sidebar
  • Lazy-loaded thumbnails
  • Dark mode by default

User Features

  • Register / Login / Logout
  • Watch history (auto-tracked after 5s)
  • Continue watching with progress bar
  • Favorites / Watchlist (AJAX toggle)
  • User dashboard with tabs
  • Profile editing

Admin Panel

  • Dashboard statistics (docs, users, views)
  • Add / Edit / Delete documentaries
  • YouTube thumbnail auto-preview
  • Manage categories with icons
  • User management (suspend / delete)
  • Featured & Trending content management

Technical

  • PDO with prepared statements
  • password_hash() for passwords
  • XSS protection (htmlspecialchars)
  • Session-based authentication
  • AJAX for favorite toggling
  • YouTube auto-fetch cron script

πŸ›‘οΈ Security Notes

This is a BCA/learning project, not production-ready. For real deployment:

  1. Change all default passwords
  2. Add CSRF tokens to all forms
  3. Use HTTPS
  4. Set proper file permissions (755 dirs, 644 files)
  5. Add rate limiting on login
  6. Move includes/config.php outside web root
  7. Restrict direct access to includes/ and admin/

🎨 Color Theme

Variable Value Usage
--bg-primary #0F171E Page background
--bg-secondary #1A242F Cards, panels
--bg-tertiary #253345 Hover states
--accent #00A8E1 Buttons, links, highlights
--gold #F5A623 Ratings, featured badge

πŸ“š Tech Stack

Layer Technology
Frontend HTML5, CSS3, Bootstrap 5.3, Bootstrap Icons
Fonts Bebas Neue (headings), Inter (body)
Backend PHP 8.x
Database MySQL / MariaDB
ORM PDO with prepared statements
Video YouTube Data API v3 (iFrame embed)
Auth PHP Sessions + password_hash

Built as a BCA-level project. Not for commercial use.

About

Netflix/Prime Video-inspired documentary streaming platform built with PHP, MySQL, Bootstrap, and JavaScript. Aggregates free documentaries from YouTube and other sources with search, categories, watch history, favorites, admin panel, and automatic updates via YouTube Data API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages