Skip to content

mnaimfaizy/movies-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PHP Movies Database 🎬

University Project - Originally developed in 2014 as a university project, enhanced in 2026 with modern features.

A complete full-featured movies catalog web application built with PHP and MySQL. This application allows users to browse movies, view trailers, search for content, and comment on movies. It includes a comprehensive admin panel for managing movies, actors, genres, trailers, and user comments.

πŸ“‹ Table of Contents

✨ Features

User Features

  • Browse Movies: View featured and latest uploaded movies with pagination
  • Search Functionality: Real-time AJAX-based movie search with debouncing
  • Movie Details: View comprehensive movie information including:
    • Plot synopsis
    • Cast and actors
    • Genre, year, and country
    • Movie trailers
    • User comments with validation
  • Trailers Gallery: Browse and watch movie trailers
  • Actor Profiles: View actor details and their filmography
  • Filter Options: Browse movies by genre, year, or country
  • User Comments: Submit and view comments on movies with proper validation
  • Responsive Design: Modern mobile-first interface using Bootstrap 5
  • Modern UI: Netflix-inspired design with smooth animations and hover effects
  • Loading States: Visual feedback with loading spinners and toast notifications

Admin Features

  • Dashboard: AdminLTE-based modern admin interface
  • Movie Management: Add, edit, delete movies with poster uploads
  • External API Integration: Fetch movie details from OMDb API using IMDb ID or search by title
  • Manual Entry: Ability to add movies manually without using the API
  • Trailer Management: Add and manage movie trailers
  • Actor Management: Manage actor database
  • User Management: Add and manage admin users
  • Comment Moderation: View and manage user comments
  • Metadata Management: Manage genres, years, and countries
  • AJAX Operations: Dynamic content loading without page refresh

πŸš€ Recent Enhancements

Security Improvements βœ…

  • SQL Injection Protection: All user inputs are properly escaped using escape_value()
  • Input Validation: Comprehensive server-side validation for all forms
  • Email Validation: Using filter_var() for proper email format checking
  • XSS Protection: Output sanitization with htmlspecialchars()
  • Environment Configuration: Support for .env files to manage credentials securely
  • Error Display Control: Environment-based error reporting (hidden in production)

UI/UX Enhancements βœ…

  • Bootstrap 5 Upgrade: Migrated from Bootstrap 3 to Bootstrap 5.3.2
  • Modern Design System: Complete CSS variable system with Netflix-inspired color palette
  • Hero Slider: Dynamic hero section with featured movies and gradient overlays
  • Modern Movie Cards: Interactive cards with hover effects, rating badges, and smooth animations
  • Enhanced Navigation: Fixed navbar with glass-morphism effect and active page highlighting
  • Font Awesome 6: Updated icon library with 2000+ new icons
  • Inter Font: Modern, clean typography replacing Roboto Condensed
  • Responsive Grid: Mobile-first responsive layout with smooth transitions
  • Loading Components: Spinner overlays and toast notification system

User Experience Improvements βœ…

  • Toast Notifications: Modern toast system for success/error messages (4 types: success, error, info, warning)
  • Loading Spinners: Auto-displaying loading overlay during AJAX requests
  • Smooth Animations: CSS transitions and transforms for card interactions
  • Lazy Loading: IntersectionObserver for efficient image loading
  • Debounced Search: 300ms debouncing to prevent excessive API calls
  • Better Error Handling: User-friendly error messages instead of generic alerts
  • Hover Effects: Movie cards with scale, lift, and overlay effects
  • Statistics Dashboard: Display total movies and actors count with modern cards

πŸš€ Technology Stack

  • Backend: PHP 8.0
  • Database: MySQL/MariaDB
  • Frontend:
    • HTML5, CSS3, JavaScript (ES6+)
    • Bootstrap 5.3.2 (Frontend)
    • AdminLTE 3.x (Admin Panel)
    • jQuery & AJAX
    • Font Awesome 6.5.1
    • Inter Font Family
  • Containerization: Docker & Docker Compose
  • Web Server: Apache
  • External APIs:
    • OMDb API for movie data fetching
  • Additional Libraries:
    • Magnific Popup (Image/Video Lightbox)
    • FlexiSlider (Image Slider)
    • DataTables (Admin Tables)
    • CKEditor (Rich Text Editor)
    • jQuery Validation

πŸƒ Quick Start

Prerequisites

  • Docker and Docker Compose installed
  • OR Apache/Nginx with PHP 8.0+ and MySQL

Using Docker (Recommended)

  1. Clone the repository

    git clone https://github.com/mnaimfaizy/php-movies-db.git
    cd php-movies-db
  2. Start the containers

    docker compose up --build -d
  3. Import the database

    • Access the application at http://localhost:9001
    • Import the SQL file from admin/sql/php_movies_db.sql
    • Use phpMyAdmin at http://localhost:8080 or import via command line:
    docker exec -i php_movies_db mysql -uadmin -pKabul@123 php_movies_db < admin/sql/php_movies_db.sql
  4. Access the application

Default Credentials

Database:
- Host: localhost (or php_movies_db for container)
- Port: 33067 (external) / 3306 (internal)
- Database: php_movies_db
- Username: admin
- Password: Kabul@123

⚠️ Security Note: Change default credentials before deploying to production!

Optional: Environment Variables

Create a .env file in the root directory to configure environment-specific settings:

DB_HOST=php_movies_db
DB_USERNAME=admin
DB_PASSWORD=Kabul@123
DB_DATABASE=php_movies_db
DB_PORT=3306
APP_ENV=production
APP_DEBUG=false

πŸ”Œ External API Integration

This application integrates with the OMDb API (Open Movie Database) to fetch comprehensive movie information automatically.

Features

  • Auto-Fetch Movie Data: Enter an IMDb ID and automatically retrieve:

    • Movie title, year, genre, country
    • Plot synopsis
    • Poster image
    • Ratings (IMDb, Rotten Tomatoes, Metacritic)
    • Director, writer, actors
    • Runtime, release date
  • Search by Title: Search for movies by title and select from results

  • Manual Entry: All fields can be manually entered/edited if you prefer not to use the API or if the API doesn't have the movie

How to Use

  1. In Admin Panel β†’ Go to "Add Movie"

  2. Option 1 - Fetch by IMDb ID:

    • Enter IMDb ID (e.g., tt0111161 for The Shawshank Redemption)
    • Click "Fetch Details" button
    • Movie data will auto-populate
  3. Option 2 - Search by Title:

    • Enter movie title in search field
    • Click "Search" button
    • Select the correct movie from search results
    • Movie data will auto-populate
  4. Option 3 - Manual Entry:

    • Fill in all fields manually without using the API
    • Upload poster image
    • Save the movie

API Configuration

The OMDb API key is currently hardcoded in:

  • admin/add_movie.php (Line 60, 264)
  • admin/view_details.php (Line 31)

API Endpoint: http://omdbapi.com/?apikey=2db3e567

Note: The current API key is for development purposes. For production, obtain your own free API key from OMDb API and update the files accordingly.

πŸ“ Project Structure

php-movies-db/
β”œβ”€β”€ admin/                      # Admin panel
β”‚   β”œβ”€β”€ assets/                 # AdminLTE assets (CSS, JS, plugins)
β”‚   β”œβ”€β”€ includes/               # Admin PHP includes
β”‚   β”œβ”€β”€ operation/              # Backend operations
β”‚   β”œβ”€β”€ sql/                    # Database files
β”‚   └── *.php                   # Admin pages
β”œβ”€β”€ ajax/                       # AJAX endpoints for frontend
β”œβ”€β”€ assets/                     # Frontend assets
β”‚   β”œβ”€β”€ css/                    # Stylesheets
β”‚   β”‚   β”œβ”€β”€ modern-ui.css       # Modern UI design system (NEW)
β”‚   β”‚   β”œβ”€β”€ style.css           # Main styles
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ js/                     # JavaScript files
β”‚   β”‚   β”œβ”€β”€ modern-ui.js        # Modern UI functionality (NEW)
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ images/                 # Images and movie posters
β”‚   β”œβ”€β”€ font-awesome/           # Icon library
β”‚   └── favicon/                # Favicon files
β”œβ”€β”€ includes/                   # Frontend PHP includes
β”‚   β”œβ”€β”€ loading_toast.inc.php   # Loading spinner & toast system (NEW)
β”‚   β”œβ”€β”€ header.inc.php          # Enhanced with Bootstrap 5 (UPDATED)
β”‚   β”œβ”€β”€ footer.inc.php          # Enhanced with modern scripts (UPDATED)
β”‚   └── ...
β”œβ”€β”€ docker-compose.yml          # Docker composition
β”œβ”€β”€ Dockerfile                  # Docker image definition
└── *.php                       # Main application pages

πŸ“š Documentation

For detailed documentation, please refer to:

🌐 Demo

You can see a live demo of the application at: https://php-movies-db.mnfprofile.com

πŸ“Έ Screenshots

Frontend

Home Page

Front Page Modern Netflix-inspired homepage with hero slider and featured movies

Search Functionality

Search Page Real-time AJAX search with responsive movie cards

Admin Panel

Admin Dashboard

Dashboard Page Clean AdminLTE-based dashboard for managing content

Add Movie Page

Add Movie Page Movie management with OMDb API integration for auto-fetching movie details

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the terms included in the LICENSE file.

πŸ‘¨β€πŸ’» Author

Created with ❀️ by Mohammad Naim Faizy


🎨 Design Philosophy

The 2026 enhancements focused on creating a modern, Netflix-inspired interface while maintaining the core functionality:

  • Color Scheme: Netflix red (#e50914) with dark backgrounds for a cinematic feel
  • Typography: Inter font family for clean, modern readability
  • Animations: Smooth transitions (0.3s) for professional feel
  • Mobile-First: Responsive design ensuring great experience on all devices
  • User Feedback: Loading states and toast notifications keep users informed

Note: This is an educational project. Make sure to follow security best practices if deploying to production, including:

  • Changing default database credentials
  • Obtaining your own OMDb API key
  • Enabling HTTPS
  • Setting up proper error logging
  • Implementing rate limiting
  • Regular security updates

About

A full-featured movie catalog web application with admin panel. Built with PHP, MySQL, and Bootstrap 5, featuring AJAX search, OMDb API integration, trailer gallery, and modern Netflix-inspired UI. Originally a 2014 university project, enhanced in 2026 with security improvements and modern design.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors