404.php

Overview

This script renders a custom 404 - Page Not Found error page for the LinuxFront V2 Logistics portal. It checks user authentication to display the appropriate header, shows a friendly error message, and offers a “Go Home” button to navigate back to the homepage .

Dependencies

  • inc/config.php: Boots the application, starts sessions, and defines path constants.
  • TEMPLATE_DIR . "inc/template_meta.php": Injects meta tags and head scripts.
  • inc/panels/header-inner.php: Header shown to authenticated users.
  • inc/panels/header-home.php: Header shown to guests.
  • inc/panels/footer-home.php: Footer for all users.

Header Selection Logic

The script chooses between two headers based on session state.

if ($_SESSION['Customer_email'] != '' && $_SESSION['Customer_email'] != null) {
    include_once("inc/panels/header-inner.php");
} else {
    include_once("inc/panels/header-home.php");
}

This ensures authenticated users see a different navigation bar than guests .

HTML Head

The page declares an XHTML Transitional DOCTYPE and includes all meta information.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
  <? include_once(TEMPLATE_DIR . "inc/template_meta.php"); ?>
</head>

This setup loads responsive and SEO-friendly head tags .

Main Error Section 🚫

The core content sits in a full-width container with custom styling:

<div class="container-fluid scroll-margin min-height1 bg-404">
  <div class="text-center sub-container">
    <h1>Oops!</h1>
    <h2>404 - Page Not Found</h2>
    <div class="text-center my-4 fw-semibold">
      The Requested URL <span class="text-danger">/<?=$currnt_template?>.php</span>
      was not found on this server.
    </div>
    …
  </div>
</div>
  • bg-404: Applies a background image or color specific to 404 pages.
  • scroll-margin, min-height1: Ensure proper vertical spacing and minimal height.
  • Dynamic URL print: The $currnt_template variable shows which page was missing .

Call to Action 🏠

A clear “Go Home” button encourages users to return safely:

<a href="index.php" class="tex">
  <button class="align-items-center btn btn-primary d-flex mt-4 px-4" type="button">
    <svg …>…</svg>
    Go Home
  </button>
</a>
  • SVG icon: Enhances the button visually.
  • btn btn-primary d-flex: Uses Bootstrap for styling and layout .

At the end of the body, the guest footer is included for consistent navigation:

<? include_once("inc/panels/footer-home.php"); ?>

This footer contains site-wide links and contact info .

Styling & Classes

  • Layout: container-fluid, text-center, d-flex
  • Spacing: mt-4, my-4, px-4, min-height1
  • Typography: fw-semibold, text-danger
  • Buttons: btn, btn-primary, align-items-center

Customization Points

  • Background: Modify .bg-404 in CSS to change visuals.
  • Text: Edit <h1>, <h2>, and messaging inside the sub-container.
  • Headers/Footers: Swap panel includes to adjust navigation elements.
  • Commented Legacy Markup: Remove or restore the old static block at the top of the body for alternate styling .

Context & Integration

This file serves as the fallback in the routing logic (e.g., in route.php) when a requested resource does not exist. It relies on the central configuration (inc/config.php) to establish the session and path constants and works seamlessly with the template system defined by TEMPLATE_DIR.