# VR Global Holidays — PHP website

A white-and-blue responsive travel website using the supplied VR Global Holidays logo. PHP 8.2+ with PDO SQLite; no Composer or front-end build step is required. The Nika Holidays website was used as a structural reference only. None of its company contacts, licences or customer reviews have been reused.

## Run locally

For a quick visual look, open `preview.html` directly in your browser. This offline homepage preview includes the design and local imagery; accounts and bookings require the PHP server below.

1. Install PHP 8.2+ (XAMPP, Laragon or a standard PHP installation).
2. Enable `pdo_sqlite`, `sqlite3` and `curl` in your PHP configuration. cURL is required only for Stripe checkout.
3. From this folder, run:

   ```sh
   php -S localhost:8080 -t public
   ```

4. Open http://localhost:8080. The database and six sample products are created automatically in `storage/travel.sqlite`.

Only `public/` must be served by the web server. Never expose the project root or `storage/` to the internet. The PHP server above is for local development; use a managed PHP host or PHP-FPM/Apache with HTTPS for production.

## Create an administrator

There are no default accounts or public administrator registration routes. Set a temporary password in your local environment and run the CLI command:

```powershell
$env:VR_ADMIN_PASSWORD = 'choose-a-unique-long-password'
php app/create-admin.php admin@yourcompany.com 'VR Global Admin'
Remove-Item Env:VR_ADMIN_PASSWORD
```

Sign in using the standard account login. The dashboard adapts to the authenticated role. Customer and agent registration are available separately; agents require administrator approval.

## Included functionality

- Responsive home, searchable tours/van/coach catalogue, package detail, about, gallery with image lightbox, contact inquiry form and role-based accounts.
- Date and group-size validation, inclusive multi-day rental pricing, database transactions for capacity checks, date closures, booking requests and approval/decline.
- Customer booking history, upcoming trips, unpaid future cancellation, printable statements that can be saved as PDF, and payment entry for approved bookings.
- Admin booking management, package creation, daily fleet/package availability closures, agent approvals, stored inquiry inbox and CSV booking reports.
- Affiliate approval, unique referral codes, attributed bookings, a sample 10% net agent discount and a sample 10% commission on paid referred retail bookings. Net bookings do not receive a second commission. Payouts are manual.
- Indicative MYR/SGD/USD price display. All booking totals and payments settle in MYR. Display rates are fixed sample conversions, not live foreign-exchange rates.
- Stripe hosted Checkout integration and signed webhook handler. Card details never pass through this application. Payment status is updated only by a verified webhook with a matching session, amount and currency.
- Password hashing, session regeneration, role and ownership checks, CSRF tokens, prepared database queries, escaped output, request throttling and response security headers. Storage and secrets stay outside the public directory.

## Configure before launch

Copy `app/config.example.php` to `app/config.php`. Enter the real HTTPS `base_url`, company email, phone, WhatsApp number (country code and digits), office address and business hours. The WhatsApp link and office map appear only when configured. Inquiries currently persist to the admin inbox; they do not send email.

The logo is used exactly as supplied. If its checkerboard is part of the PNG rather than transparency, provide a clean transparent production export for the best header appearance.

Replace the sample packages, pricing, daily inventory, commission rules, imagery and itinerary/policy text with business-approved content. Tours use daily seat capacity; van/coach classes use a count of available vehicles and a fixed maximum group size. This starter does not allocate individual vehicle registrations or specific drivers. Agent registration stores a contact/agency name and requires manual verification; add formal agency verification and client manifests for production group operations.

Company history, credentials, office details, approved testimonials and original video assets have not been provided. These sections show honest placeholders. The gallery uses illustrative stock photos and includes a video placeholder, not an uploaded video system. The website makes no licensing claims.

Review privacy, cancellation/refund terms, operational availability, accessibility and applicable travel/payment requirements before launch. Configure TLS, secure file permissions, backups, monitoring and log rotation. A production-scale rollout should include account recovery/email verification, notifications, proper tax invoices, richer fleet assignment, refunds and an operations audit trail. This is a working starter application, not a claim of completed production certification or security audit.

## Activate Stripe

1. Set `stripe_secret` and `stripe_webhook_secret` with Stripe test credentials first. Keep `config.php` private and out of version control.
2. Register `https://YOUR-DOMAIN/?action=webhook` for `checkout.session.completed` events.
3. Set `live_bookings` to `true` only after pricing, terms and the payment flow have been reviewed. Despite the setting name, requests remain available when false; this setting gates payment initiation.
4. Test completed payments, retries, invalid signatures, cancellations, network failures and receipt reconciliation in Stripe test mode. Then switch to live keys.

Stripe currently takes payment in MYR only. PayPal and charging in multiple currencies are not implemented. Existing checkout sessions require team reconciliation if they expire or a customer needs a new session; the application intentionally blocks automatic retries with another session. Refunds and commission payouts are handled manually in this version. Do not enable delayed/asynchronous payment methods without adding the matching webhook event handlers.

## Deployment

Upload to a PHP-capable host. Point its document root at `public/`, grant the PHP user write access to `storage/`, and keep `app/` private. Ensure the PDO SQLite driver is available. For multiple app servers or substantially larger traffic, migrate to a shared database and reassess transaction/locking behavior. The Sites plugin's Worker hosting does not execute PHP, so this project has not been published there.

## Validation performed

PHP lint and JavaScript syntax checks passed. HTTP integration checks passed for public pages, customer registration, booking creation, over-capacity rejection, past-date rejection, cancellation, agent approval guards, CSRF protection, contact inquiries, invoice ownership and admin report isolation. Admin checks passed for all dashboard sections, CSV export, partner approval, date closures/reopening and package creation. QA accounts and data have been removed from the delivered project. Live Stripe settlement was not tested because no credentials were supplied. Browser-based visual and mobile interaction QA could not run because the desktop browser-control tool returned an access-denied error. Responsive layouts are implemented in CSS but still need final device QA before launch.

## Photography

Illustrative images are bundled locally from Unsplash. Keep a record of asset permissions and substitute your own approved portfolio before publishing:

- Hero: https://images.unsplash.com/photo-1596422846543-75c6fc197f07
- Kuala Lumpur: https://images.unsplash.com/photo-1508062878650-88b52897f298
- Cameron Highlands, Tony Shi Hou Tang: https://unsplash.com/photos/a-lush-green-hillside-covered-in-lots-of-bushes-Y8U0OqbSmg0
- Singapore: https://images.unsplash.com/photo-1525625293386-3f8f99389edd
- Island: https://images.unsplash.com/photo-1510414842594-a61c69b5ae57
- Landscape: https://images.unsplash.com/photo-1464822759023-fed622ff2c3b
- Transport: https://images.unsplash.com/photo-1464219789935-c2d9d9aba644
- Coach: https://images.unsplash.com/photo-1570125909232-eb263c188f7e

Reference layout: https://nikaholidays.my/
