Online Food Ordering System Documentation_v1.0
Online Food Ordering System Documentation_v1.0
by NIKUL RAM
[email protected] - www.nikulram.com
www.github.com/nikulram
LinkedIn: www.linkedin.com/in/nikul-ram/
1
Nikul Ram
Contents
2
Nikul Ram
3
Nikul Ram
1.2 Objective
The primary objective of the Online Food Ordering System is to provide a comprehensive
platform that simplifies the process of ordering food online. Key objectives include:
• Enabling users to browse and order from a digital menu.
• Allowing administrators to manage menu items, user information, and orders.
• Ensuring secure and efficient transactions.
1.4 Inspiration
The inspiration behind this project is to address the growing demand for online food ordering
services (Chavan, Jadhav, Korade, & Teli, 2015). By digitizing the ordering process, this
system aims to enhance customer convenience, streamline vendor operations, and reduce
the errors associated with traditional ordering methods.
4
Nikul Ram
5
Nikul Ram
3. Implementation:
• Goal: Develop the system components.
• Activities: Coding frontend and backend, integrating database operations.
• Outcome: A functional prototype with essential features implemented.
5. Deployment:
• Goal: Prepare the system for deployment.
• Activities: Final testing, preparing documentation.
• Outcome: A ready-to-deploy system with comprehensive documentation.
6
Nikul Ram
2. Database Optimization:
• Challenge: Managing database operations efficiently.
• Solution: Normalized the database schema and optimized queries.
3. Secure Transactions:
• Challenge: Ensuring secure data handling and transactions.
• Solution: Used prepared statements to prevent SQL injection and
implemented HTTPS.
4. User Authentication:
• Challenge: Implementing secure user authentication (Bhanderi, 2021).
• Solution: Used PHP sessions for managing user authentication and hashed
passwords for security (Bhanderi, 2021).
5. Image Handling:
• Challenge: Handling dynamic image uploads and displays.
• Solution: Ensured proper validation of image URLs and provided a default
placeholder image (Implemented in Menu and Admin-Menu).
7
Nikul Ram
2. Add to Cart:
• Description: Users can add menu items to their cart for review before placing
an order.
• Implementation: JavaScript functions handle cart operations and store items
in local storage (Flanagan, 2011).
3. Checkout:
• Description: Users can review their cart and proceed to checkout.
• Implementation: Checkout form validates user input and processes payment
information securely.
4. Order History:
• Description: Users can view their past orders.
• Implementation: Order history is fetched from the database and displayed on
the user's profile.
3. View Orders:
• Description: Admins can view all orders placed by users.
• Implementation: Orders are displayed in a tabular format with details like order
ID, user, and status.
8
Nikul Ram
4. Manage Users:
• Description: Admins can view user information and permissions.
2. Prepared Statements:
• Description: Prevents SQL injection attacks.
• Implementation: Used in all database queries involving user inputs.
3. Session Management:
• Description: Securely manages user sessions.
4. Image Validation:
• Description: Validates image URLs to prevent broken images.
• Implementation: JavaScript functions handle image URL validation and
provide a default placeholder if validation fails.
9
Nikul Ram
5.5 Documentation
Maintaining thorough documentation throughout the project was essential for clarity and future
maintenance. This included in-line code comments, system architecture visuals, and user
manuals.
10
Nikul Ram
11
Nikul Ram
menu.html
• Purpose: Displays the menu items grouped by categories (Hickson, 2014).
• Features: Dynamically loads menu items using JavaScript (Flanagan, 2011).
Users can view different food categories and their respective items, which are
fetched from the database and displayed dynamically.
cart.html
• Purpose: Shows the user's cart with items they intend to purchase.
• Features: Allows users to update item quantities or remove items from the cart.
The page provides real-time updates of the cart contents and total price. It also
ensures users cannot proceed to checkout without being logged in.
checkout.html
• Purpose: The checkout page where users enter payment details.
• Features: Collects card information, CVV, and other details for processing
orders. The form includes client-side validation to ensure the card details are
correct before submission. If the user is not logged in, they are prompted to log
in before they can complete the checkout process.
order-confirmation.html
• Purpose: Displays a confirmation message after an order is placed.
• Features: Simple page showing order success and a link to order history. It
confirms that the order was placed successfully and provides a link to view past
orders.
order.html
• Purpose: Displays the user's order history.
• Features: Dynamically loads past orders for the logged-in user. Users can see
details of their previous orders, including order IDs, statuses, and dates.
12
Nikul Ram
profile.html
• Purpose: Shows the user's profile information.
• Features: Displays username and email. It fetches and shows the current
logged-in user's profile details.
profile.js
• Purpose: Loads user profile data.
• Features: Fetches and displays the logged-in user's profile information. It
ensures that the profile information is displayed correctly and is updated in real-
time if changes occur.
scripts.js
• Purpose: Manages core functionalities like loading menu items, cart
operations, and handling order placements.
• Features: Handles adding to cart, removing from cart, updating cart quantities,
and placing orders. It includes client-side validation for cart and checkout
processes, ensures secure transactions, and provides a seamless user
experience by dynamically updating the UI without page reloads.
13
Nikul Ram
14
Nikul Ram
checkSession.php
• Purpose: Checks if a user is logged in.
• Features: Returns session status in JSON format. It helps in managing
frontend behaviors based on user login status.
db.php
• Purpose: Establishes a database connection.
• Features: Connects to MySQL database using mysqli. It handles connection
errors and sets the character set for the connection (McLaughlin, 2012).
getMenuItems.php
• Purpose: Fetches all menu items from the database.
• Features: Returns menu items in JSON format. It groups items by category
and provides them to the frontend for dynamic display.
getUserProfile.php
• Purpose: Fetches the logged-in user's profile information.
• Features: Returns username and email in JSON format. It ensures secure
access to user profile data.
login_handler.php
• Purpose: Processes user login.
• Features: Validates user credentials and sets session variables. It checks for
correct username and password, sets session variables, and redirects users
based on their role (admin or regular user).
login.php
• Purpose: Provides the login interface.
• Features: Displays a form for username and password input. It includes
feedback for incorrect login attempts.
logout.php
• Purpose: Logs out the user.
• Features: Destroys the session and redirects to the homepage. It ensures a
secure logout by clearing session data.
menu.php
• Purpose: Manages menu operations.
• Features: Handles fetching and adding menu items via AJAX. It validates input
data and manages menu item operations securely.
order.php
• Purpose: Processes orders.
15
Nikul Ram
• Features: Handles order creation and order item insertion. It validates order
data, processes payments, and updates the database with new order
information.
orderHistory.php
• Purpose: Fetches order history for the logged-in user.
• Features: Returns order history in JSON format. It ensures secure access to
user-specific order history.
signup_handler.php
• Purpose: Processes user signup.
• Features: Validates and inserts new user data into the database. It checks for
existing usernames/emails and securely hashes passwords before storing
them.
signup.php
• Purpose: Provides the signup interface.
• Features: Displays a form for username, email, and password input. It includes
feedback for signup errors and ensures all required fields are filled.
16
Nikul Ram
Figure2.0 – This image shows that the XAMPP Control Panel was not starting Apache
correctly, even after changing CONF Files and other methods to fix. The error message
was resolved with reinstalling and making sure no other services was using the same port
as of Apache and had to run as an administrator which fixed the issue (Kumari & Nandal,
2017).
17
Nikul Ram
18
Nikul Ram
Figure2.2 – Creation of database for the project. It is possible to see in the above visual
the database name that was selected for the project known as myprojectdb.
19
Nikul Ram
Figure2.3 – Image showing the early stage of testing the orders and checkout section of
the project in the database. Few errors came across and the issues where the resolved:
where the orders were being processed and sent to the database, but the project system
was not registering the transaction which resulted in showing the status being “pending
orders” rather than “completed orders”. This was then successfully resolved and made the
final version of the project work.
20
Nikul Ram
Figure3.0 – Image shows, error in scripts.js while testing, which is showed as a Syntax
Error.
Figure3.1 – Errors were encountered when trying to import the schema.sql file into the
database. This happened because the schema.sql file was updated as the project
progressed. As a result, MySQL threw a duplication error when it was attempted to import
the updated schema.sql file (Steinhoff, n.d.).
21
Nikul Ram
Figure3.2 – Orders not going through error which led to update cart, checkout and order-
confirmation which fixed the issue. It is possible to see as said in Figure2.3 which is the
part of the error that was encountered.
Figure3.3 – The above screenshot displays the Admin-Menu, where the images were not
showing, and the relative process in order to debug to fix the issue.
22
Nikul Ram
23
Nikul Ram
• Cart Page: Shows items added to the cart with options to update or remove
items.
24
Nikul Ram
25
Nikul Ram
26
Nikul Ram
• Order Confirmation Page: Confirms the order has been placed successfully.
Figure4.8 – Order Confirmation page which comes only after successful checkout.
27
Nikul Ram
28
Nikul Ram
29
Nikul Ram
• Manage Menu: Interface for adding, updating, and deleting menu items.
30
Nikul Ram
31
Nikul Ram
32
Nikul Ram
9. Part 9: References
Bhanderi, Dixita Dinesh. "Enhanced Two Factor Authentication with MD5." PhD diss.,
California State University, Sacramento, 2021.
Chavan, Varsha, Priya Jadhav, Snehal Korade, and Priyanka Teli. "Implementing
Customizable Online Food Ordering System Using Web Based Application." International
Journal of Innovative Science, Engineering & Technology 2, no. 4 (2015): 722-727.
CSS, Cascading Style Sheets. "Cascading Style Sheets." Accessed April 27, 2022.
https://developer.mozilla.org/en-US/docs/Web/CSS.
Flanagan, David. JavaScript: The Definitive Guide: Activate Your Web Pages. Sebastopol, CA:
O'Reilly Media, Inc., 2011.
Kumari, Punam, and Rainu Nandal. "A Research Paper on Website Development Optimization
Using Xampp/PHP." International Journal of Advanced Research in Computer Science 8, no.
5 (2017).
McLaughlin, Brett. PHP & MySQL: The Missing Manual. Sebastopol, CA: O'Reilly Media, Inc.,
2012.
Peterson, Clarissa. Learning Responsive Web Design: A Beginner's Guide. Sebastopol, CA:
O'Reilly Media, Inc., 2014.
Stobart, Simon, and Mike Vassileiou. PHP and MySQL Manual: Simple, Yet Powerful Web
Programming. New York: Springer Science & Business Media, 2004.
Zandstra, Matt. "Testing with PHPUnit." In PHP Objects, Patterns, and Practice, 435-464.
2016.
33