Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

Mini Project Report

Flower Shop Management System

Department of Computer Science &


Engineering

XCS504–Software Engineering

Submitted by
RANJITHPARTHIBAN M 121011063230

DIVYA PRASANA E V 120012012676

MOHAMED SALMAN K M 120012012700

SETHUPATHY U 120012012707

Under the supervision and guidance of

Dr.T.Kavitha

Assistance Professor(S.S) ,Department of CS


ACKNOWLEDGEMENT
We extend our heartfelt and sincere thanks to the
Management of Periyar Maniammai Institute of Science and Technology For
providing us with all sorts of support for the completion of this Mini Project. We
record obligations to Ms.T.Kavitha, Assistant Professor, Periyar Maniammai Institute
of Science and Technology for their Guidance and sustaineden couragement to
complete this Mini Project. We are highly grateful and whole heartedly express our
gratitude to Dr.M.Sharmila Begum, Professor, and Head of, the Department of
Computer Science and Engineering, for her expert guidance, suggestions, And active
encouragement for the fulfillment of the Mini Project. We record our deep sense of
indebtedness to our Mini Project Guide Ms.T.Kavitha, for her unstinted support and
guidance throughout this Mini Project. We extend our deep sense of gratitude to our
Mini project Coordinator, Assistant Professor, Department of Computer Science and
Technology for her significant guidance and her persistent help in all our endeavours.
We also take pleasure in expressing our humble note of gratitude to other Faculty
members, Non-Teaching Staff members, Parents, Friends, and our seniors for
providing their moral support in the Successful completion of this Mini Project.
RUBRICS

1. Software Specification Requirements


2. UML Diagrams
3. Implementation
4. Software Testing
5. Conclusion
6. References
1. Software Specification Requirements
Table of Contents
1. Introduction
1.1 Purpose of Document
1.2 Scope of the Product
1.3 Define, Acronyms and Abbreviations
1.4 Overview of the Document

2. General Description
2.1 Product Perspective
2.2 Product Function
2.3 User Characteristics
2.4 General Constraints
2.5 Assumption and Dependencies

3. Specific Requirements
3.1 Functional Requirement
3.2 Non-Functional Requirement

4. Appendices
1. INTORDUCTION

The project titled “FLOWER SHOP MANAGEMENT


SYSTEM” is a comprehensive system which co-ordinates various
operations in flower shop. This includes a variety of collections of
flowers and flower made products such as flower arrangements, flower
bouquets etc .This project deals with the booking of various flower
products to the various customers, updating and editing of flower
products rates and searching for employees, customers and calculation
of bills.

1.1 PURPOSE OF DOCUMENT

The project titled “FLOWER SHOP


MANAGEMENT SYSTEM” is a comprehensive system which co-
ordinates various operations in flower shop. This includes a variety
of collections of flowers and flower made products such as flower
arrangements, flower bouquets etc .This project deals with the
booking of various flower products to the various customers,
updating and editing of flower products rates and searching for
employees, customers and calculation of bills.

We first check the availability of the particular flower. Then


if available sale it to the particular customer. The objective of the
project is to make good software with an overall performance. The
software should be easy to work. The software should be able to
extract information from databases and make the reports very
easily. The software and its operations should be safe and
unauthorized access should not be allowed.
.

1.2 SCOPE OF THE DOCUMENT

The aim of developing and implementing the software


titled “FLOWER SHOP MANAGEMENT SYSTEM” is to
automate the complete system of FLOWER SHOP through
computer with maximum user interactions.The system is designed
using VB6.0 as front end & MS SQL as backend in

WINDOWS XP operating system.

The developed software is easier and flexible to handle.


Computerization can give fast services to the customers. The system
because more efficient and cost effective and manual errors
lessened. The software is user friendly and completely based on
menu driven.

1.3 DEFINITION AND ABBREVATION

SRS - Software Requirement Specification


GUI - Graphical user Interface
FR - Functional Requirements
NFR - Non-functional requirements
SSL – Secured Socket Layer

1.4 OVERVIEW OF THE DOCUMENT

This system provides an easy solution to customers to buy the


product without go to the shop and also the shop owner to sale the
product.
2. GENERAL DESCRIPTION

The main objective of the proposed system is to overcome


the drawbacks of the existing manual system. The need for computerized
system arises as the manual maintenance and handling of process becomes
more and more tedious and complex .The computerization of the system
helps to save a lot of time. It is very difficult to maintain all the details of
each of the record manually. Also reference to a particular record leads to
consume more time whereas the computerized system rectifies most of these
drawbacks. The calculations are done in a few seconds and with the help of
various reports generated several conclusions can be drawn easily. The wide
use of computers as they offer valuable facilities is difficult to stimulate in
any other way.

2.1 PRODUCT PERSPECTIVE

The Product has been developed for the improvement in the sale
and to make the customer and admin to communicate easily. From any
where and anytime.

2.2 PRODUCT FUNCTIONS

Product overview gives an initial understanding of the functions


and the outlines the essential product structure. They also identified the
login type and restricted access to the modules as the validation given by
the admin to the user. To improve the security to the next level.

2.3 USER CHARACTERISTICS

 User Login: User (or) Customer they can login


using their id and can do the check their product availability, Purchase,
and do a transaction etc…
 Manager(or) Admin Login: This login in as like the
admin login has the full rights to the portal.

2.4 GENERAL CONSTRAINS

The system has many validations to make sure that the


user is the genuine user and process is performing correctly to
make the system more secure.

3. SPECIFIC REQUIREMENTS

3.1 Functional Requirements

The Details of the Stock availability, Delivery date


and time of the product to the desired location are need to be
known to make the system run.

3.2 Non Functional Requirements

Hardware:
Processor – Any processor
Processor speed – more than 1.2 Ghz
Ram – Minimum 2Gb

Software
OS – Any OS
Browser – Safari, Chrome, Edge, etc…

4. APPENDICES

The system Display the information clearly to the user and


make to get detail more and more about the Instock and Purschase
etc..
2. UML DIAGRAM

USE CASE DIAGRAM


CLASS DIAGRAM
SEQUENCE DIAGRAME
DATA FLOW DAIAGRAM
ACTIVITY DIAGRAME

\
COMPONET DIAGRAM
Implementation:

Login Module:
<?php

@include 'config.php';

session_start();

if(isset($_POST['submit'])){

$filter_email = filter_var($_POST['email'], FILTER_SANITIZE_STRING);


$email = mysqli_real_escape_string($conn, $filter_email);
$filter_pass = filter_var($_POST['pass'], FILTER_SANITIZE_STRING);
$pass = mysqli_real_escape_string($conn, md5($filter_pass));

$select_users = mysqli_query($conn, "SELECT * FROM `users` WHERE email =


'$email' AND password = '$pass'") or die('query failed');

if(mysqli_num_rows($select_users) > 0){

$row = mysqli_fetch_assoc($select_users);

if($row['user_type'] == 'admin'){

$_SESSION['admin_name'] = $row['name'];
$_SESSION['admin_email'] = $row['email'];
$_SESSION['admin_id'] = $row['id'];
header('location:admin_page.php');

}elseif($row['user_type'] == 'user'){

$_SESSION['user_name'] = $row['name'];
$_SESSION['user_email'] = $row['email'];
$_SESSION['user_id'] = $row['id'];
header('location:home.php');

}else{
$message[] = 'no user found!';
}

}else{
$message[] = 'incorrect email or password!';
}

}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>

<section class="form-container">

<form action="" method="post">


<h3>login now</h3>
<input type="email" name="email" class="box" placeholder="enter your
email" required>
<input type="password" name="pass" class="box" placeholder="enter your
password" required>
<input type="submit" class="btn" name="submit" value="login now">
<p>don't have an account? <a href="register.php">register now</a></p>
</form>

</section>

</body>
</html>
Home Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
}

if(isset($_POST['add_to_wishlist'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM `wishlist`


WHERE name = '$product_name' AND user_id = '$user_id'") or die('query
failed');

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


$message[] = 'already added to wishlist';
}elseif(mysqli_num_rows($check_cart_numbers) > 0){
$message[] = 'already added to cart';
}else{
mysqli_query($conn, "INSERT INTO `wishlist`(user_id, pid, name, price,
image) VALUES('$user_id', '$product_id', '$product_name', '$product_price',
'$product_image')") or die('query failed');
$message[] = 'product added to wishlist';
}

if(isset($_POST['add_to_cart'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];
$product_quantity = $_POST['product_quantity'];
$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name
= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_cart_numbers) > 0){


$message[] = 'already added to cart';
}else{

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM `wishlist`


WHERE name = '$product_name' AND user_id = '$user_id'") or die('query
failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


mysqli_query($conn, "DELETE FROM `wishlist` WHERE name =
'$product_name' AND user_id = '$user_id'") or die('query failed');
}

mysqli_query($conn, "INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES('$user_id', '$product_id', '$product_name',
'$product_price', '$product_quantity', '$product_image')") or die('query
failed');
$message[] = 'product added to cart';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>home</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="home">

<div class="content">
<h3>new collections</h3>
<p>There are many new collection of new imported flower to make our
coustomer happy and satisfied with our works</p>
<a href="about.php" class="btn">discover more</a>
</div>

</section>

<section class="products">

<h1 class="title">latest products</h1>

<div class="box-container">

<?php
$select_products = mysqli_query($conn, "SELECT * FROM `products`
LIMIT 6") or die('query failed');
if(mysqli_num_rows($select_products) > 0){
while($fetch_products = mysqli_fetch_assoc($select_products)){
?>
<form action="" method="POST" class="box">
<a href="view_page.php?pid=<?php echo $fetch_products['id']; ?>"
class="fas fa-eye"></a>
<div class="price">Rs.<?php echo $fetch_products['price']; ?>/-</div>
<img src="uploaded_img/<?php echo $fetch_products['image']; ?>"
alt="" class="image">
<div class="name"><?php echo $fetch_products['name']; ?></div>
<input type="number" name="product_quantity" value="1" min="0"
class="qty">
<input type="hidden" name="product_id" value="<?php echo
$fetch_products['id']; ?>">
<input type="hidden" name="product_name" value="<?php echo
$fetch_products['name']; ?>">
<input type="hidden" name="product_price" value="<?php echo
$fetch_products['price']; ?>">
<input type="hidden" name="product_image" value="<?php echo
$fetch_products['image']; ?>">
<input type="submit" value="add to wishlist" name="add_to_wishlist"
class="option-btn">
<input type="submit" value="add to cart" name="add_to_cart"
class="btn">
</form>
<?php
}
}else{
echo '<p class="empty">no products added yet!</p>';
}
?>

</div>

<div class="more-btn">
<a href="shop.php" class="option-btn">load more</a>
</div>

</section>

<section class="home-contact">

<div class="content">
<h3>have any questions?</h3>
<p>Please feel free to contact us we will avalilable 24/7 to help you to
the what you need</p>
<a href="contact.php" class="btn">contact us</a>
</div>

</section>

<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Header Module
<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>

<header class="header">

<div class="flex">

<a href="home.php" class="logo">flowers.</a>

<nav class="navbar">
<ul>
<li><a href="home.php">home</a></li>
<li><a href="#">pages +</a>
<ul>
<li><a href="about.php">about</a></li>
<li><a href="contact.php">contact</a></li>
</ul>
</li>
<li><a href="shop.php">shop</a></li>
<li><a href="orders.php">orders</a></li>
<li><a href="#">account +</a>
<ul>
<li><a href="login.php">login</a></li>
<li><a href="register.php">register</a></li>
</ul>
</li>
</ul>
</nav>

<div class="icons">
<div id="menu-btn" class="fas fa-bars"></div>
<a href="search_page.php" class="fas fa-search"></a>
<div id="user-btn" class="fas fa-user"></div>
<?php
$select_wishlist_count = mysqli_query($conn, "SELECT * FROM
`wishlist` WHERE user_id = '$user_id'") or die('query failed');
$wishlist_num_rows = mysqli_num_rows($select_wishlist_count);
?>
<a href="wishlist.php"><i class="fas fa-heart"></i><span>(<?php
echo $wishlist_num_rows; ?>)</span></a>
<?php
$select_cart_count = mysqli_query($conn, "SELECT * FROM `cart`
WHERE user_id = '$user_id'") or die('query failed');
$cart_num_rows = mysqli_num_rows($select_cart_count);
?>
<a href="cart.php"><i class="fas fa-shopping-
cart"></i><span>(<?php echo $cart_num_rows; ?>)</span></a>
</div>

<div class="account-box">
<p>username : <span><?php echo $_SESSION['user_name'];
?></span></p>
<p>email : <span><?php echo $_SESSION['user_email']; ?></span></p>
<a href="logout.php" class="delete-btn">logout</a>
</div>

</div>

</header>
Footer Module
<section class="footer">

<div class="box-container">

<div class="box">
<h3>quick links</h3>
<a href="home.php">home</a>
<a href="about.php">about</a>
<a href="contact.php">contact</a>
<a href="shop.php">shop</a>
</div>

<div class="box">
<h3>extra links</h3>
<a href="login.php">login</a>
<a href="register.php">register</a>
<a href="orders.php">my orders</a>
<a href="cart.php">my cart</a>
</div>

<div class="box">
<h3>contact info</h3>
<p> <i class="fas fa-phone"></i> +91 9159489894 </p>
<p> <i class="fas fa-phone"></i> +91 7904072598 </p>
<p> <i class="fas fa-envelope"></i> ranjithparthibanmail@gmail.com
</p>
<p> <i class="fas fa-map-marker-alt"></i>Thanjavur, Tamilnadu,
India-613-001 </p>
</div>

<div class="box">
<h3>follow us</h3>
<a href="#"><i class="fab fa-facebook-f"></i>facebook</a>
<a href="#"><i class="fab fa-twitter"></i>twitter</a>
<a href="#"><i class="fab fa-instagram"></i>instagram</a>
<a href="#"><i class="fab fa-linkedin"></i>linkedin</a>
</div>

</div>

<div class="credit">&copy; copyright @ <?php echo date('Y'); ?> by


<span>Ranjithparthiban</span> </div>

</section>
Shop Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_wishlist'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM `wishlist`


WHERE name = '$product_name' AND user_id = '$user_id'") or die('query
failed');

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


$message[] = 'already added to wishlist';
}elseif(mysqli_num_rows($check_cart_numbers) > 0){
$message[] = 'already added to cart';
}else{
mysqli_query($conn, "INSERT INTO `wishlist`(user_id, pid, name, price,
image) VALUES('$user_id', '$product_id', '$product_name', '$product_price',
'$product_image')") or die('query failed');
$message[] = 'product added to wishlist';
}

if(isset($_POST['add_to_cart'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];
$product_quantity = $_POST['product_quantity'];

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');
if(mysqli_num_rows($check_cart_numbers) > 0){
$message[] = 'already added to cart';
}else{

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM


`wishlist` WHERE name = '$product_name' AND user_id = '$user_id'") or
die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


mysqli_query($conn, "DELETE FROM `wishlist` WHERE name =
'$product_name' AND user_id = '$user_id'") or die('query failed');
}

mysqli_query($conn, "INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES('$user_id', '$product_id', '$product_name',
'$product_price', '$product_quantity', '$product_image')") or die('query
failed');
$message[] = 'product added to cart';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>shop</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>our shop</h3>
<p> <a href="home.php">home</a> / shop </p>
</section>

<section class="products">
<h1 class="title">latest products</h1>

<div class="box-container">

<?php
$select_products = mysqli_query($conn, "SELECT * FROM `products`") or
die('query failed');
if(mysqli_num_rows($select_products) > 0){
while($fetch_products = mysqli_fetch_assoc($select_products)){
?>
<form action="" method="POST" class="box">
<a href="view_page.php?pid=<?php echo $fetch_products['id']; ?>"
class="fas fa-eye"></a>
<div class="price">$<?php echo $fetch_products['price']; ?>/-</div>
<img src="uploaded_img/<?php echo $fetch_products['image']; ?>"
alt="" class="image">
<div class="name"><?php echo $fetch_products['name']; ?></div>
<input type="number" name="product_quantity" value="1" min="0"
class="qty">
<input type="hidden" name="product_id" value="<?php echo
$fetch_products['id']; ?>">
<input type="hidden" name="product_name" value="<?php echo
$fetch_products['name']; ?>">
<input type="hidden" name="product_price" value="<?php echo
$fetch_products['price']; ?>">
<input type="hidden" name="product_image" value="<?php echo
$fetch_products['image']; ?>">
<input type="submit" value="add to wishlist" name="add_to_wishlist"
class="option-btn">
<input type="submit" value="add to cart" name="add_to_cart"
class="btn">
</form>
<?php
}
}else{
echo '<p class="empty">no products added yet!</p>';
}
?>

</div>

</section>

<?php @include 'footer.php'; ?>


<script src="js/script.js"></script>

</body>
</html>

Viewpage Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_wishlist'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM `wishlist`


WHERE name = '$product_name' AND user_id = '$user_id'") or die('query
failed');

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


$message[] = 'already added to wishlist';
}elseif(mysqli_num_rows($check_cart_numbers) > 0){
$message[] = 'already added to cart';
}else{
mysqli_query($conn, "INSERT INTO `wishlist`(user_id, pid, name, price,
image) VALUES('$user_id', '$product_id', '$product_name', '$product_price',
'$product_image')") or die('query failed');
$message[] = 'product added to wishlist';
}

if(isset($_POST['add_to_cart'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];
$product_quantity = $_POST['product_quantity'];

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_cart_numbers) > 0){


$message[] = 'already added to cart';
}else{

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM


`wishlist` WHERE name = '$product_name' AND user_id = '$user_id'") or
die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


mysqli_query($conn, "DELETE FROM `wishlist` WHERE name =
'$product_name' AND user_id = '$user_id'") or die('query failed');
}

mysqli_query($conn, "INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES('$user_id', '$product_id', '$product_name',
'$product_price', '$product_quantity', '$product_image')") or die('query
failed');
$message[] = 'product added to cart';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>quick view</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>


<section class="quick-view">

<h1 class="title">product details</h1>

<?php
if(isset($_GET['pid'])){
$pid = $_GET['pid'];
$select_products = mysqli_query($conn, "SELECT * FROM `products`
WHERE id = '$pid'") or die('query failed');
if(mysqli_num_rows($select_products) > 0){
while($fetch_products = mysqli_fetch_assoc($select_products)){
?>
<form action="" method="POST">
<img src="uploaded_img/<?php echo $fetch_products['image']; ?>"
alt="" class="image">
<div class="name"><?php echo $fetch_products['name']; ?></div>
<div class="price">$<?php echo $fetch_products['price']; ?>/-</div>
<div class="details"><?php echo $fetch_products['details']; ?></div>
<input type="number" name="product_quantity" value="1" min="0"
class="qty">
<input type="hidden" name="product_id" value="<?php echo
$fetch_products['id']; ?>">
<input type="hidden" name="product_name" value="<?php echo
$fetch_products['name']; ?>">
<input type="hidden" name="product_price" value="<?php echo
$fetch_products['price']; ?>">
<input type="hidden" name="product_image" value="<?php echo
$fetch_products['image']; ?>">
<input type="submit" value="add to wishlist" name="add_to_wishlist"
class="option-btn">
<input type="submit" value="add to cart" name="add_to_cart"
class="btn">
</form>
<?php
}
}else{
echo '<p class="empty">no products details available!</p>';
}
}
?>

<div class="more-btn">
<a href="home.php" class="option-btn">go to home page</a>
</div>

</section>
<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Wish list Module


<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
}

if(isset($_POST['add_to_cart'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];
$product_quantity = 1;

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_cart_numbers) > 0){


$message[] = 'already added to cart';
}else{

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM


`wishlist` WHERE name = '$product_name' AND user_id = '$user_id'") or
die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


mysqli_query($conn, "DELETE FROM `wishlist` WHERE name =
'$product_name' AND user_id = '$user_id'") or die('query failed');
}

mysqli_query($conn, "INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES('$user_id', '$product_id', '$product_name',
'$product_price', '$product_quantity', '$product_image')") or die('query
failed');
$message[] = 'product added to cart';
}

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `wishlist` WHERE id = '$delete_id'") or
die('query failed');
header('location:wishlist.php');
}

if(isset($_GET['delete_all'])){
mysqli_query($conn, "DELETE FROM `wishlist` WHERE user_id = '$user_id'")
or die('query failed');
header('location:wishlist.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>wishlist</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>your wishlist</h3>
<p> <a href="home.php">home</a> / wishlist </p>
</section>

<section class="wishlist">

<h1 class="title">products added</h1>

<div class="box-container">

<?php
$grand_total = 0;
$select_wishlist = mysqli_query($conn, "SELECT * FROM `wishlist` WHERE
user_id = '$user_id'") or die('query failed');
if(mysqli_num_rows($select_wishlist) > 0){
while($fetch_wishlist = mysqli_fetch_assoc($select_wishlist)){
?>
<form action="" method="POST" class="box">
<a href="wishlist.php?delete=<?php echo $fetch_wishlist['id']; ?>"
class="fas fa-times" onclick="return confirm('delete this from
wishlist?');"></a>
<a href="view_page.php?pid=<?php echo $fetch_wishlist['pid']; ?>"
class="fas fa-eye"></a>
<img src="uploaded_img/<?php echo $fetch_wishlist['image']; ?>" alt=""
class="image">
<div class="name"><?php echo $fetch_wishlist['name']; ?></div>
<div class="price">$<?php echo $fetch_wishlist['price']; ?>/-</div>
<input type="hidden" name="product_id" value="<?php echo
$fetch_wishlist['pid']; ?>">
<input type="hidden" name="product_name" value="<?php echo
$fetch_wishlist['name']; ?>">
<input type="hidden" name="product_price" value="<?php echo
$fetch_wishlist['price']; ?>">
<input type="hidden" name="product_image" value="<?php echo
$fetch_wishlist['image']; ?>">
<input type="submit" value="add to cart" name="add_to_cart"
class="btn">

</form>
<?php
$grand_total += $fetch_wishlist['price'];
}
}else{
echo '<p class="empty">your wishlist is empty</p>';
}
?>
</div>

<div class="wishlist-total">
<p>grand total : <span>$<?php echo $grand_total; ?>/-</span></p>
<a href="shop.php" class="option-btn">continue shopping</a>
<a href="wishlist.php?delete_all" class="delete-btn <?php echo
($grand_total > 1)?'':'disabled' ?>" onclick="return confirm('delete all from
wishlist?');">delete all</a>
</div>

</section>
<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Register Module
<?php

@include 'config.php';

if(isset($_POST['submit'])){

$filter_name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);


$name = mysqli_real_escape_string($conn, $filter_name);
$filter_email = filter_var($_POST['email'], FILTER_SANITIZE_STRING);
$email = mysqli_real_escape_string($conn, $filter_email);
$filter_pass = filter_var($_POST['pass'], FILTER_SANITIZE_STRING);
$pass = mysqli_real_escape_string($conn, md5($filter_pass));
$filter_cpass = filter_var($_POST['cpass'], FILTER_SANITIZE_STRING);
$cpass = mysqli_real_escape_string($conn, md5($filter_cpass));

$select_users = mysqli_query($conn, "SELECT * FROM `users` WHERE email =


'$email'") or die('query failed');

if(mysqli_num_rows($select_users) > 0){


$message[] = 'user already exist!';
}else{
if($pass != $cpass){
$message[] = 'confirm password not matched!';
}else{
mysqli_query($conn, "INSERT INTO `users`(name, email, password)
VALUES('$name', '$email', '$pass')") or die('query failed');
$message[] = 'registered successfully!';
header('location:login.php');
}
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>register</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>

<section class="form-container">

<form action="" method="post">


<h3>register now</h3>
<input type="text" name="name" class="box" placeholder="enter your
username" required>
<input type="email" name="email" class="box" placeholder="enter your
email" required>
<input type="password" name="pass" class="box" placeholder="enter your
password" required>
<input type="password" name="cpass" class="box" placeholder="confirm
your password" required>
<input type="submit" class="btn" name="submit" value="register now">
<p>already have an account? <a href="login.php">login now</a></p>
</form>

</section>

</body>
</html>

Order Module
<?php
@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>orders</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>your orders</h3>
<p> <a href="home.php">home</a> / order </p>
</section>

<section class="placed-orders">

<h1 class="title">placed orders</h1>

<div class="box-container">

<?php
$select_orders = mysqli_query($conn, "SELECT * FROM `orders` WHERE
user_id = '$user_id'") or die('query failed');
if(mysqli_num_rows($select_orders) > 0){
while($fetch_orders = mysqli_fetch_assoc($select_orders)){
?>
<div class="box">
<p> placed on : <span><?php echo $fetch_orders['placed_on']; ?></span>
</p>
<p> name : <span><?php echo $fetch_orders['name']; ?></span> </p>
<p> number : <span><?php echo $fetch_orders['number']; ?></span> </p>
<p> email : <span><?php echo $fetch_orders['email']; ?></span> </p>
<p> address : <span><?php echo $fetch_orders['address']; ?></span>
</p>
<p> payment method : <span><?php echo $fetch_orders['method'];
?></span> </p>
<p> your orders : <span><?php echo $fetch_orders['total_products'];
?></span> </p>
<p> total price : <span>Rs.<?php echo $fetch_orders['total_price'];
?>/-</span> </p>
<p> payment status : <span style="color:<?php
if($fetch_orders['payment_status'] == 'pending'){echo 'tomato'; }else{echo
'green';} ?>"><?php echo $fetch_orders['payment_status']; ?></span> </p>
</div>
<?php
}
}else{
echo '<p class="empty">no orders placed yet!</p>';
}
?>
</div>

</section>

<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Search Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];
if(!isset($user_id)){
header('location:login.php');
}

if(isset($_POST['add_to_wishlist'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM `wishlist`


WHERE name = '$product_name' AND user_id = '$user_id'") or die('query
failed');

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


$message[] = 'already added to wishlist';
}elseif(mysqli_num_rows($check_cart_numbers) > 0){
$message[] = 'already added to cart';
}else{
mysqli_query($conn, "INSERT INTO `wishlist`(user_id, pid, name, price,
image) VALUES('$user_id', '$product_id', '$product_name', '$product_price',
'$product_image')") or die('query failed');
$message[] = 'product added to wishlist';
}

if(isset($_POST['add_to_cart'])){

$product_id = $_POST['product_id'];
$product_name = $_POST['product_name'];
$product_price = $_POST['product_price'];
$product_image = $_POST['product_image'];
$product_quantity = $_POST['product_quantity'];

$check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name


= '$product_name' AND user_id = '$user_id'") or die('query failed');

if(mysqli_num_rows($check_cart_numbers) > 0){


$message[] = 'already added to cart';
}else{

$check_wishlist_numbers = mysqli_query($conn, "SELECT * FROM


`wishlist` WHERE name = '$product_name' AND user_id = '$user_id'") or
die('query failed');

if(mysqli_num_rows($check_wishlist_numbers) > 0){


mysqli_query($conn, "DELETE FROM `wishlist` WHERE name =
'$product_name' AND user_id = '$user_id'") or die('query failed');
}

mysqli_query($conn, "INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES('$user_id', '$product_id', '$product_name',
'$product_price', '$product_quantity', '$product_image')") or die('query
failed');
$message[] = 'product added to cart';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>search page</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>search page</h3>
<p> <a href="home.php">home</a> / search </p>
</section>

<section class="search-form">
<form action="" method="POST">
<input type="text" class="box" placeholder="search products..."
name="search_box">
<input type="submit" class="btn" value="search" name="search_btn">
</form>
</section>

<section class="products" style="padding-top: 0;">

<div class="box-container">
<?php
if(isset($_POST['search_btn'])){
$search_box = mysqli_real_escape_string($conn, $_POST['search_box']);
$select_products = mysqli_query($conn, "SELECT * FROM `products`
WHERE name LIKE '%{$search_box}%'") or die('query failed');
if(mysqli_num_rows($select_products) > 0){
while($fetch_products = mysqli_fetch_assoc($select_products)){
?>
<form action="" method="POST" class="box">
<a href="view_page.php?pid=<?php echo $fetch_products['id']; ?>"
class="fas fa-eye"></a>
<div class="price">$<?php echo $fetch_products['price']; ?>/-</div>
<img src="uploaded_img/<?php echo $fetch_products['image']; ?>"
alt="" class="image">
<div class="name"><?php echo $fetch_products['name']; ?></div>
<input type="number" name="product_quantity" value="1" min="0"
class="qty">
<input type="hidden" name="product_id" value="<?php echo
$fetch_products['id']; ?>">
<input type="hidden" name="product_name" value="<?php echo
$fetch_products['name']; ?>">
<input type="hidden" name="product_price" value="<?php echo
$fetch_products['price']; ?>">
<input type="hidden" name="product_image" value="<?php echo
$fetch_products['image']; ?>">
<input type="submit" value="add to wishlist" name="add_to_wishlist"
class="option-btn">
<input type="submit" value="add to cart" name="add_to_cart"
class="btn">
</form>
<?php
}
}else{
echo '<p class="empty">no result found!</p>';
}
}else{
echo '<p class="empty">search something!</p>';
}
?>

</div>

</section>

<?php @include 'footer.php'; ?>


<script src="js/script.js"></script>

</body>
</html>

Cart Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `cart` WHERE id = '$delete_id'") or
die('query failed');
header('location:cart.php');
}

if(isset($_GET['delete_all'])){
mysqli_query($conn, "DELETE FROM `cart` WHERE user_id = '$user_id'") or
die('query failed');
header('location:cart.php');
};

if(isset($_POST['update_quantity'])){
$cart_id = $_POST['cart_id'];
$cart_quantity = $_POST['cart_quantity'];
mysqli_query($conn, "UPDATE `cart` SET quantity = '$cart_quantity' WHERE
id = '$cart_id'") or die('query failed');
$message[] = 'cart quantity updated!';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>shopping cart</title>
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>shopping cart</h3>
<p> <a href="home.php">home</a> / cart </p>
</section>

<section class="shopping-cart">

<h1 class="title">products added</h1>

<div class="box-container">

<?php
$grand_total = 0;
$select_cart = mysqli_query($conn, "SELECT * FROM `cart` WHERE user_id
= '$user_id'") or die('query failed');
if(mysqli_num_rows($select_cart) > 0){
while($fetch_cart = mysqli_fetch_assoc($select_cart)){
?>
<div class="box">
<a href="cart.php?delete=<?php echo $fetch_cart['id']; ?>" class="fas
fa-times" onclick="return confirm('delete this from cart?');"></a>
<a href="view_page.php?pid=<?php echo $fetch_cart['pid']; ?>"
class="fas fa-eye"></a>
<img src="uploaded_img/<?php echo $fetch_cart['image']; ?>" alt=""
class="image">
<div class="name"><?php echo $fetch_cart['name']; ?></div>
<div class="price">Rs.<?php echo $fetch_cart['price']; ?>/-</div>
<form action="" method="post">
<input type="hidden" value="<?php echo $fetch_cart['id']; ?>"
name="cart_id">
<input type="number" min="1" value="<?php echo
$fetch_cart['quantity']; ?>" name="cart_quantity" class="qty">
<input type="submit" value="update" class="option-btn"
name="update_quantity">
</form>
<div class="sub-total"> sub-total : <span>Rs.<?php echo $sub_total =
($fetch_cart['price'] * $fetch_cart['quantity']); ?>/-</span> </div>
</div>
<?php
$grand_total += $sub_total;
}
}else{
echo '<p class="empty">your cart is empty</p>';
}
?>
</div>

<div class="more-btn">
<a href="cart.php?delete_all" class="delete-btn <?php echo
($grand_total > 1)?'':'disabled' ?>" onclick="return confirm('delete all from
cart?');">delete all</a>
</div>

<div class="cart-total">
<p>grand total : <span>Rs.<?php echo $grand_total; ?>/-</span></p>
<a href="shop.php" class="option-btn">continue shopping</a>
<a href="checkout.php" class="btn <?php echo ($grand_total >
1)?'':'disabled' ?>">proceed to checkout</a>
</div>

</section>

<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Checkout Module
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['order'])){
$name = mysqli_real_escape_string($conn, $_POST['name']);
$number = mysqli_real_escape_string($conn, $_POST['number']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
$method = mysqli_real_escape_string($conn, $_POST['method']);
$address = mysqli_real_escape_string($conn, 'flat no. '. $_POST['flat'].',
'. $_POST['street'].', '. $_POST['city'].', '. $_POST['country'].' - '.
$_POST['pin_code']);
$placed_on = date('d-M-Y');

$cart_total = 0;
$cart_products[] = '';

$cart_query = mysqli_query($conn, "SELECT * FROM `cart` WHERE user_id =


'$user_id'") or die('query failed');
if(mysqli_num_rows($cart_query) > 0){
while($cart_item = mysqli_fetch_assoc($cart_query)){
$cart_products[] = $cart_item['name'].'
('.$cart_item['quantity'].') ';
$sub_total = ($cart_item['price'] * $cart_item['quantity']);
$cart_total += $sub_total;
}
}

$total_products = implode(', ',$cart_products);

$order_query = mysqli_query($conn, "SELECT * FROM `orders` WHERE name =


'$name' AND number = '$number' AND email = '$email' AND method = '$method' AND
address = '$address' AND total_products = '$total_products' AND total_price =
'$cart_total'") or die('query failed');

if($cart_total == 0){
$message[] = 'your cart is empty!';
}elseif(mysqli_num_rows($order_query) > 0){
$message[] = 'order placed already!';
}else{
mysqli_query($conn, "INSERT INTO `orders`(user_id, name, number,
email, method, address, total_products, total_price, placed_on)
VALUES('$user_id', '$name', '$number', '$email', '$method', '$address',
'$total_products', '$cart_total', '$placed_on')") or die('query failed');
mysqli_query($conn, "DELETE FROM `cart` WHERE user_id = '$user_id'")
or die('query failed');
$message[] = 'order placed successfully!';
}
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>checkout</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php @include 'header.php'; ?>

<section class="heading">
<h3>checkout order</h3>
<p> <a href="home.php">home</a> / checkout </p>
</section>

<section class="display-order">
<?php
$grand_total = 0;
$select_cart = mysqli_query($conn, "SELECT * FROM `cart` WHERE user_id
= '$user_id'") or die('query failed');
if(mysqli_num_rows($select_cart) > 0){
while($fetch_cart = mysqli_fetch_assoc($select_cart)){
$total_price = ($fetch_cart['price'] * $fetch_cart['quantity']);
$grand_total += $total_price;
?>
<p> <?php echo $fetch_cart['name'] ?> <span>(<?php echo
'Rs.'.$fetch_cart['price'].'/-'.' x '.$fetch_cart['quantity'] ?>)</span> </p>
<?php
}
}else{
echo '<p class="empty">your cart is empty</p>';
}
?>
<div class="grand-total">grand total : <span>Rs.<?php echo $grand_total;
?>/-</span></div>
</section>

<section class="checkout">

<form action="" method="POST">

<h3>place your order</h3>

<div class="flex">
<div class="inputBox">
<span>your name :</span>
<input type="text" name="name" placeholder="enter your name">
</div>
<div class="inputBox">
<span>your number :</span>
<input type="number" name="number" min="0" placeholder="enter
your number">
</div>
<div class="inputBox">
<span>your email :</span>
<input type="email" name="email" placeholder="enter your
email">
</div>
<div class="inputBox">
<span>payment method :</span>
<select name="method">
<option value="cash on delivery">cash on delivery</option>
<option value="credit card">credit card</option>
<option value="paypal">paypal</option>
<option value="paytm">paytm</option>
</select>
</div>
<div class="inputBox">
<span>address line 01 :</span>
<input type="text" name="flat" placeholder="e.g. flat no.">
</div>
<div class="inputBox">
<span>address line 02 :</span>
<input type="text" name="street" placeholder="e.g. streen
name">
</div>
<div class="inputBox">
<span>city :</span>
<input type="text" name="city" placeholder="e.g. mumbai">
</div>
<div class="inputBox">
<span>state :</span>
<input type="text" name="state" placeholder="e.g.
maharashtra">
</div>
<div class="inputBox">
<span>country :</span>
<input type="text" name="country" placeholder="e.g. india">
</div>
<div class="inputBox">
<span>pin code :</span>
<input type="number" min="0" name="pin_code" placeholder="e.g.
123456">
</div>
</div>
<input type="submit" name="order" value="order now" class="btn">

</form>

</section>

<?php @include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Admin Module’s
Contact
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `message` WHERE id = '$delete_id'") or
die('query failed');
header('location:admin_contacts.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dashboard</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="messages">

<h1 class="title">messages</h1>

<div class="box-container">

<?php
$select_message = mysqli_query($conn, "SELECT * FROM `message`") or
die('query failed');
if(mysqli_num_rows($select_message) > 0){
while($fetch_message = mysqli_fetch_assoc($select_message)){
?>
<div class="box">
<p>user id : <span><?php echo $fetch_message['user_id']; ?></span>
</p>
<p>name : <span><?php echo $fetch_message['name']; ?></span> </p>
<p>number : <span><?php echo $fetch_message['number']; ?></span> </p>
<p>email : <span><?php echo $fetch_message['email']; ?></span> </p>
<p>message : <span><?php echo $fetch_message['message']; ?></span>
</p>
<a href="admin_contacts.php?delete=<?php echo $fetch_message['id'];
?>" onclick="return confirm('delete this message?');" class="delete-
btn">delete</a>
</div>
<?php
}
}else{
echo '<p class="empty">you have no messages!</p>';
}
?>
</div>

</section>
<script src="js/admin_script.js"></script>

</body>
</html>

Header
<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>

<header class="header">

<div class="flex">

<a href="admin_page.php" class="logo">Admin<span>Panel</span></a>

<nav class="navbar">
<a href="admin_page.php">home</a>
<a href="admin_products.php">products</a>
<a href="admin_orders.php">orders</a>
<a href="admin_users.php">users</a>
<a href="admin_contacts.php">messages</a>
</nav>

<div class="icons">
<div id="menu-btn" class="fas fa-bars"></div>
<div id="user-btn" class="fas fa-user"></div>
</div>

<div class="account-box">
<p>username : <span><?php echo $_SESSION['admin_name']; ?></span></p>
<p>email : <span><?php echo $_SESSION['admin_email']; ?></span></p>
<a href="logout.php" class="delete-btn">logout</a>
<div>new <a href="login.php">login</a> | <a
href="register.php">register</a> </div>
</div>

</div>

</header>

Order
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_POST['update_order'])){
$order_id = $_POST['order_id'];
$update_payment = $_POST['update_payment'];
mysqli_query($conn, "UPDATE `orders` SET payment_status = '$update_payment'
WHERE id = '$order_id'") or die('query failed');
$message[] = 'payment status has been updated!';
}

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `orders` WHERE id = '$delete_id'") or
die('query failed');
header('location:admin_orders.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dashboard</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="placed-orders">

<h1 class="title">placed orders</h1>

<div class="box-container">

<?php

$select_orders = mysqli_query($conn, "SELECT * FROM `orders`") or


die('query failed');
if(mysqli_num_rows($select_orders) > 0){
while($fetch_orders = mysqli_fetch_assoc($select_orders)){
?>
<div class="box">
<p> user id : <span><?php echo $fetch_orders['user_id']; ?></span>
</p>
<p> placed on : <span><?php echo $fetch_orders['placed_on'];
?></span> </p>
<p> name : <span><?php echo $fetch_orders['name']; ?></span> </p>
<p> number : <span><?php echo $fetch_orders['number']; ?></span> </p>
<p> email : <span><?php echo $fetch_orders['email']; ?></span> </p>
<p> address : <span><?php echo $fetch_orders['address']; ?></span>
</p>
<p> total products : <span><?php echo
$fetch_orders['total_products']; ?></span> </p>
<p> total price : <span>Rs.<?php echo $fetch_orders['total_price'];
?>/-</span> </p>
<p> payment method : <span><?php echo $fetch_orders['method'];
?></span> </p>
<form action="" method="post">
<input type="hidden" name="order_id" value="<?php echo
$fetch_orders['id']; ?>">
<select name="update_payment">
<option disabled selected><?php echo
$fetch_orders['payment_status']; ?></option>
<option value="pending">pending</option>
<option value="completed">completed</option>
</select>
<input type="submit" name="update_order" value="update"
class="option-btn">
<a href="admin_orders.php?delete=<?php echo $fetch_orders['id'];
?>" class="delete-btn" onclick="return confirm('delete this
order?');">delete</a>
</form>
</div>
<?php
}
}else{
echo '<p class="empty">no orders placed yet!</p>';
}
?>
</div>

</section>

<script src="js/admin_script.js"></script>

</body>
</html>

Home
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_POST['update_order'])){
$order_id = $_POST['order_id'];
$update_payment = $_POST['update_payment'];
mysqli_query($conn, "UPDATE `orders` SET payment_status = '$update_payment'
WHERE id = '$order_id'") or die('query failed');
$message[] = 'payment status has been updated!';
}

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `orders` WHERE id = '$delete_id'") or
die('query failed');
header('location:admin_orders.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dashboard</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="placed-orders">

<h1 class="title">placed orders</h1>

<div class="box-container">

<?php

$select_orders = mysqli_query($conn, "SELECT * FROM `orders`") or


die('query failed');
if(mysqli_num_rows($select_orders) > 0){
while($fetch_orders = mysqli_fetch_assoc($select_orders)){
?>
<div class="box">
<p> user id : <span><?php echo $fetch_orders['user_id']; ?></span>
</p>
<p> placed on : <span><?php echo $fetch_orders['placed_on'];
?></span> </p>
<p> name : <span><?php echo $fetch_orders['name']; ?></span> </p>
<p> number : <span><?php echo $fetch_orders['number']; ?></span> </p>
<p> email : <span><?php echo $fetch_orders['email']; ?></span> </p>
<p> address : <span><?php echo $fetch_orders['address']; ?></span>
</p>
<p> total products : <span><?php echo
$fetch_orders['total_products']; ?></span> </p>
<p> total price : <span>Rs.<?php echo $fetch_orders['total_price'];
?>/-</span> </p>
<p> payment method : <span><?php echo $fetch_orders['method'];
?></span> </p>
<form action="" method="post">
<input type="hidden" name="order_id" value="<?php echo
$fetch_orders['id']; ?>">
<select name="update_payment">
<option disabled selected><?php echo
$fetch_orders['payment_status']; ?></option>
<option value="pending">pending</option>
<option value="completed">completed</option>
</select>
<input type="submit" name="update_order" value="update"
class="option-btn">
<a href="admin_orders.php?delete=<?php echo $fetch_orders['id'];
?>" class="delete-btn" onclick="return confirm('delete this
order?');">delete</a>
</form>
</div>
<?php
}
}else{
echo '<p class="empty">no orders placed yet!</p>';
}
?>
</div>

</section>
<script src="js/admin_script.js"></script>

</body>
</html>

Add Product
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_POST['update_order'])){
$order_id = $_POST['order_id'];
$update_payment = $_POST['update_payment'];
mysqli_query($conn, "UPDATE `orders` SET payment_status = '$update_payment'
WHERE id = '$order_id'") or die('query failed');
$message[] = 'payment status has been updated!';
}

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `orders` WHERE id = '$delete_id'") or
die('query failed');
header('location:admin_orders.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dashboard</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">
</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="placed-orders">

<h1 class="title">placed orders</h1>

<div class="box-container">

<?php

$select_orders = mysqli_query($conn, "SELECT * FROM `orders`") or


die('query failed');
if(mysqli_num_rows($select_orders) > 0){
while($fetch_orders = mysqli_fetch_assoc($select_orders)){
?>
<div class="box">
<p> user id : <span><?php echo $fetch_orders['user_id']; ?></span>
</p>
<p> placed on : <span><?php echo $fetch_orders['placed_on'];
?></span> </p>
<p> name : <span><?php echo $fetch_orders['name']; ?></span> </p>
<p> number : <span><?php echo $fetch_orders['number']; ?></span> </p>
<p> email : <span><?php echo $fetch_orders['email']; ?></span> </p>
<p> address : <span><?php echo $fetch_orders['address']; ?></span>
</p>
<p> total products : <span><?php echo
$fetch_orders['total_products']; ?></span> </p>
<p> total price : <span>Rs.<?php echo $fetch_orders['total_price'];
?>/-</span> </p>
<p> payment method : <span><?php echo $fetch_orders['method'];
?></span> </p>
<form action="" method="post">
<input type="hidden" name="order_id" value="<?php echo
$fetch_orders['id']; ?>">
<select name="update_payment">
<option disabled selected><?php echo
$fetch_orders['payment_status']; ?></option>
<option value="pending">pending</option>
<option value="completed">completed</option>
</select>
<input type="submit" name="update_order" value="update"
class="option-btn">
<a href="admin_orders.php?delete=<?php echo $fetch_orders['id'];
?>" class="delete-btn" onclick="return confirm('delete this
order?');">delete</a>
</form>
</div>
<?php
}
}else{
echo '<p class="empty">no orders placed yet!</p>';
}
?>
</div>

</section>

<script src="js/admin_script.js"></script>

</body>
</html>

Updated product
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_POST['update_product'])){

$update_p_id = $_POST['update_p_id'];
$name = mysqli_real_escape_string($conn, $_POST['name']);
$price = mysqli_real_escape_string($conn, $_POST['price']);
$details = mysqli_real_escape_string($conn, $_POST['details']);
mysqli_query($conn, "UPDATE `products` SET name = '$name', details =
'$details', price = '$price' WHERE id = '$update_p_id'") or die('query
failed');

$image = $_FILES['image']['name'];
$image_size = $_FILES['image']['size'];
$image_tmp_name = $_FILES['image']['tmp_name'];
$image_folter = 'uploaded_img/'.$image;
$old_image = $_POST['update_p_image'];

if(!empty($image)){
if($image_size > 2000000){
$message[] = 'image file size is too large!';
}else{
mysqli_query($conn, "UPDATE `products` SET image = '$image' WHERE id
= '$update_p_id'") or die('query failed');
move_uploaded_file($image_tmp_name, $image_folter);
unlink('uploaded_img/'.$old_image);
$message[] = 'image updated successfully!';
}
}

$message[] = 'product updated successfully!';

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>update product</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="update-product">

<?php
$update_id = $_GET['update'];
$select_products = mysqli_query($conn, "SELECT * FROM `products` WHERE id =
'$update_id'") or die('query failed');
if(mysqli_num_rows($select_products) > 0){
while($fetch_products = mysqli_fetch_assoc($select_products)){
?>

<form action="" method="post" enctype="multipart/form-data">


<img src="uploaded_img/<?php echo $fetch_products['image']; ?>"
class="image" alt="">
<input type="hidden" value="<?php echo $fetch_products['id']; ?>"
name="update_p_id">
<input type="hidden" value="<?php echo $fetch_products['image']; ?>"
name="update_p_image">
<input type="text" class="box" value="<?php echo $fetch_products['name'];
?>" required placeholder="update product name" name="name">
<input type="number" min="0" class="box" value="<?php echo
$fetch_products['price']; ?>" required placeholder="update product price"
name="price">
<textarea name="details" class="box" required placeholder="update product
details" cols="30" rows="10"><?php echo $fetch_products['details'];
?></textarea>
<input type="file" accept="image/jpg, image/jpeg, image/png" class="box"
name="image">
<input type="submit" value="update product" name="update_product"
class="btn">
<a href="admin_products.php" class="option-btn">go back</a>
</form>

<?php
}
}else{
echo '<p class="empty">no update product select</p>';
}
?>

</section>
<script src="js/admin_script.js"></script>

</body>
</html>

Users
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
mysqli_query($conn, "DELETE FROM `users` WHERE id = '$delete_id'") or
die('query failed');
header('location:admin_users.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dashboard</title>

<!-- font awesome cdn link -->


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.0.0/css/all.min.css">

<!-- custom admin css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php @include 'admin_header.php'; ?>

<section class="users">
<h1 class="title">users account</h1>

<div class="box-container">
<?php
$select_users = mysqli_query($conn, "SELECT * FROM `users`") or
die('query failed');
if(mysqli_num_rows($select_users) > 0){
while($fetch_users = mysqli_fetch_assoc($select_users)){
?>
<div class="box">
<p>user id : <span><?php echo $fetch_users['id']; ?></span></p>
<p>username : <span><?php echo $fetch_users['name']; ?></span></p>
<p>email : <span><?php echo $fetch_users['email']; ?></span></p>
<p>user type : <span style="color:<?php if($fetch_users['user_type']
== 'admin'){ echo 'var(--orange)'; }; ?>"><?php echo
$fetch_users['user_type']; ?></span></p>
<a href="admin_users.php?delete=<?php echo $fetch_users['id']; ?>"
onclick="return confirm('delete this user?');" class="delete-btn">delete</a>
</div>
<?php
}
}
?>
</div>

</section>

<script src="js/admin_script.js"></script>

</body>
</html>
Config Module
<?php

$conn = mysqli_connect('localhost','root','','shop_db') or die('connection


failed');

?>

Implementation Snap Short


4.SOFTWARE TESTING

Testing Modules:

Testing has been done with multiple incorrect input to the system in
the all the login pages it has passed all the testing modules and the
transfer module has also conducted a testing to avoid the wrong logins
and it has been cleared successfully all the testing procedures.
5. CONCLUSION

The Project has been successfully implemented and been


Tested for all the aspect and the correction has been made to all the
module as per the government standards and policies.

Reference:
 www.Campcode.com
 www.Geeksforgeeks.com
 www.github.com
 www.codeforge.com

You might also like