Documente Academic
Documente Profesional
Documente Cultură
Chapter 4
Implementation
4.1 Component Modules
The Login Window has two buttons, which will redirect to the required pages.
They are:
1. Login
2. Signup
index.php:
Consists of definition of login page objects.
Contains links to different redirect to different pages.
Contains html code for the user interface used in login page.
This window consists of the home page, which displays all the categories of food
available and also the best sellers. Information about the website is accessed by clicking on
the about us button , the contact information can be viewed by clicking on contact us button
and logout button is clicked to end session.
Quickbites.php,MainsandSides.php,beverages.php,desserts.php,Aboutus.php,Conatctus.
php, Logout.php, myaccount.php
Contains form based user interface for user home page
Contains member functions defined in php code.
The member functions used are:
Session_start (): This function is used to start a session and store session
variables.
Mysqli_connect (): This function is used to connect to the database
server, it takes 4 inputs ‘hostname’,’username’,’password’,’dbname’.
Isset (): This checks if the variable contains a value or not.
Mysqli_query (): this method is used to execute a query, it takes two
parameters ‘query’ and ‘connection’.
Mysqli_fetch_array(): this method is used to fetch the result set of the
executed query.
Mainmenu.php:
Contains html code for the button based interface.
Consists of header with links to the respective food categories and add to cart
buttons.
Contains the php code to select the items from the database and add to cart.
Consists of POST and SESSION variables to get the input from the form and
from the previous pages respectively.
Consists of member functions defined in php.
Quickbites.php:
Contains html code for the button based interface.
Consists of header with links to the respective food categories and add to cart
buttons.
Contains the php code to select the items from the database and add to cart.
Consists of POST and SESSION variables to get the input from the form and
from the previous pages respectively.
Consists of member functions defined in php.
beverages.php:
Contains html code for the button based interface.
Consists of header with links to the respective food categories and add to cart
buttons.
Contains the php code to select the items from the database and add to cart.
Consists of POST and SESSION variables to get the input from the form and
from the previous pages respectively.
Consists of member functions defined in php.
desserts.php:
Contains html code for the button based interface.
Consists of header with links to the respective food categories and add to cart
buttons.
Contains the php code to select the items from the database and add to cart.
Consists of POST and SESSION variables to get the input from the form and
from the previous pages respectively.
Consists of member functions defined in php.
Myaccount.php:
Contains html code for the buttons used in the interface.
Consists of member functions defined in php.
It allows the user to create their own profile and make changes.
Profile.inc.php
Contains html code for the buttons used in the interface.
Consists of member functions defined in php.
Action for the “save” button is directed here.
It contains a form which takes the input from the user to create the profile.
profile.php
Contains html code to view the details provided by the user.
Consists of member functions defined in php.
Only the required contents from the database are displayed.
cart.php:
Contains html code for the buttons used in the interface.
Consists of member functions defined in php.
It allows the user to view the selected food items and place the order.
checkout.php:
Contains html code for the buttons used in the interface.
Consists of member functions defined in php.
It is a form based interface where the user has to enter the necessary details to
place the order.
payment.php:
Contains html code for the buttons used in the interface.
It is a radio button interface which allows the user to select the payment mode
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "login";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
Table 1: User
The User table consists of the main details of the user; it is shown in the diagram below,
User:
Table 2: Menu
The menu table consists of the food items available.
The table is shown below
Menu:
Table 3: Useracc
Useracc table refers to the details of the user.
The table is shown below:
Useracc:
Table 4: CHECKOUT
checkout table consists of the details required for delivery.
It is shown in the diagram below
checkout:
Table 5: ORDER
Order:
Table 6: Trigger_time
Trigger_time:
id exec_time
Stored procedure:
A procedure (often called a stored procedure) is a subroutine like a subprogram
in a regular computing language, stored in database. There are many useful applications
of SQL procedures within a database or database application architecture. SQL
procedures can be used to create simple scripts for quickly querying transforming,
updating data, generating basic reports, improve application performance, modularizing
applications, and improve overall database design, and database security.
The procedure used in this project is called disp1, which returns the all the
bookings done by all the users.
Code:
DELIMITER $$
CREATE DEFINER=`'root' `@` 'localhost'` PROCEDURE `disp1`()
NO SQL
BEGIN
SELECT * FROM order;
END$$
DELIMITER ;
Trigger:
Triggers are stored programs, which are automatically executed or fired when
some event occurs. Triggers are written to be executed in response to any of the
following events. A database manipulation (DML) statement (DELETE, INSERT, or
UPDATE). A database definition (DDL) statement (CREATE, ALTER, or DROP).
The trigger named time1 used in this project enters the time at which a user made
a new booking.
The code of trigger is give below
Code :