-
Notifications
You must be signed in to change notification settings - Fork 8
index.php
- The
index.phpfile serves as the entry point for the website. - It handles routing incoming HTTP requests to the appropriate controller functions and views.
- This document provides an overview of the file's structure and functionality.
- Routing
-
Functions
handleHomeRquest()handleAboutUsRequest()handleLoginRequest()handleRegisterRequest()handleLogoutRequest()handleContactPageRequest()handle404Request()handleProductPageRequest()handleProductsPageRequest()handleAddToBasketRequest()handleUpdateBasketRequest()handleBasketPageRequest()handleCheckoutPageRequest()handleCheckoutProcessRequest()handleCustomerPageRequest()handleChangePasswordRequest()
- The index.php file employs a simple routing mechanism to direct incoming requests to specific controller functions.
- It utilizes the
$_SERVER['REQUEST_URI']variable to determine the requested URL path and then switches on it to invoke the appropriate handler function.
Displays the home page
Displays the about us page
Handles user login requests
-
GETwill display the login page -
POSTwill attempt to log the user in- Requires
usernameOrEmailandpasswordto be supplied
- Requires
Handles user registration requests
-
GETwill display the registration page -
POSTwill attempt to register the user
Logs out the user
Displays the contact page
Displays the basket page
Displays individual product page
- Requires
productID=xto be added where x is the ID of a product
Displays products page and optionally filters by category
- Optional
category=xto be added where x is the category of products to be displayed
Adds a product to the basket
-
POSTwill add a product to the basket- Requires
productIDandquantityto be supplied
- Requires
Updates the a product in the basket
-
POSTwill update a product in the basket- Requires
productIDandquantityto be supplied
- Requires
Displays the checkout page
Handles the checkout process
Displays the order success page
Displays the order failed page
Displays the customer page
Handles the change password process
-
POSTwill change the user's password- Requires
current_password,new_passwordandconfirm_passwordto be supplied
- Requires
Displays a 404 error page
- The
index.phpfile contains a number of functions that are used to handle the routing and rendering of views.
Handles home page requests
Return void
Handles about us page requests
Return void
Handles about us page requests
Return void
Handles login page requests
Return void
Handles register page requests
Return void
Handles logout requests
Return void
Handles contact page requests
Return void
Handles 404 requests
Return void
Handles product page requests
Return void
Handles products page requests
Return void
Handles add to basket requests
Return void
Handles update basket requests
Return void
Handles basket page requests
Return void
Handles checkout page requests
Return void
Handles checkout process requests
Return void
Handles customer page requests
Return void
Handles change password requests
Return void