THECAPOFILM - WEBSITE WITH USER ACCOUNTS (PHP + MySQL)
======================================================

WHAT IS THIS?
-------------
The complete thecapofilm website (Home, About, Services, Portfolio, Packages,
Testimonials, Contact, Terms) together with a user account system built with
PHP and MySQL:

  - Sign up and log in / log out
  - A welcome popup with "Sign up" or "Continue as guest"
  - Booking requires an account: every "Book now" button sends visitors to
    sign up (or log in) first
  - A personal dashboard where users submit a booking request, see the
    bookings they have made, and cancel a booking if their plans change

All data is stored in a MySQL database that can be managed in phpMyAdmin.


SETUP (XAMPP)
-------------
1. Install XAMPP from https://www.apachefriends.org (skip if already installed).

2. Copy this whole folder ("capofilm-php") into the XAMPP "htdocs" folder:
     Windows:  C:\xampp\htdocs\
     Mac:      /Applications/XAMPP/htdocs/
   Result:     C:\xampp\htdocs\capofilm-php\index.php

   Make sure the files sit directly inside "capofilm-php" and not in a second
   "capofilm-php" folder inside it.

3. Open the XAMPP Control Panel and click "Start" next to:
     - Apache
     - MySQL

4. Import the database:
     a. Open http://localhost/phpmyadmin in your browser
     b. Click the "Import" tab
     c. Click "Choose File" and select "db.sql" from this folder
     d. Scroll down and click "Go"
   You should now see a database called "capofilm_db" with two tables:
   "users" and "bookings".

5. Open the website:  http://localhost/capofilm-php/


TESTING THE FLOW
----------------
1. Open the website in a new tab. The welcome popup appears.
2. Click "Continue as guest" and browse the website.
3. Go to Packages and click any "Book now" button. You are asked to sign up first.
4. Sign up, then log in. The dashboard opens with your chosen package already
   filled in. Submit the form.
5. In phpMyAdmin, open capofilm_db > bookings to see the new record.
6. Back on the dashboard, click "Cancel" next to the booking and confirm. The
   status changes to "Cancelled". Refresh the bookings table in phpMyAdmin to
   see the same change in the database.


IF YOU ALREADY IMPORTED AN OLDER VERSION OF THE DATABASE
--------------------------------------------------------
This version no longer has admin accounts, so the "users" table is simpler.
The website still works with the old tables, but for a clean database:
  1. In phpMyAdmin, select "capofilm_db" in the left sidebar
  2. Click the "Operations" tab, then "Drop the database (DROP)"
  3. Import "db.sql" again (step 4 above)


TROUBLESHOOTING
---------------
"Database connection failed"
  - Make sure both Apache and MySQL are started (green) in XAMPP.
  - Make sure "db.sql" has been imported.
  - If you set a password for the MySQL "root" user, open config.php and
    change the line  $pass = "";  to your password.


FILE OVERVIEW
-------------
index.php, about.php, services.php, portfolio.php, packages.php,
testimonials.php, contact.php, terms.php   The website pages
welcome_popup.php   The welcome popup (included on every page)
book.php            Gatekeeper for all "Book now" buttons (requires an account)
register.php        Sign up
login.php           Log in
logout.php          Log out
dashboard.php       User dashboard: booking form and booking history
booking_submit.php  Saves a booking to the database
cancel_booking.php  Cancels one of the user's own bookings
config.php          Database connection
db.sql              Database structure (import with phpMyAdmin)
images/             Photos used on the website


SECURITY NOTES
--------------
- Passwords are stored as bcrypt hashes (password_hash), never as plain text.
- All database queries use prepared statements, which protects against SQL injection.
- Everything printed to a page is escaped with htmlspecialchars, which protects
  against cross-site scripting (XSS).
- The session ID is regenerated at login.
- Booking and cancel forms carry a CSRF token, and a user can only cancel
  their own bookings.

This PHP version is meant for XAMPP. Netlify cannot run PHP, so to put it online
you would need a host that supports PHP and MySQL.
