Professional Documents
Culture Documents
Flower Shop
Flower Shop
XCS504–Software Engineering
Submitted by
RANJITHPARTHIBAN M 121011063230
SETHUPATHY U 120012012707
Dr.T.Kavitha
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 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.
3. SPECIFIC 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
\
COMPONET DIAGRAM
Implementation:
Login Module:
<?php
@include 'config.php';
session_start();
if(isset($_POST['submit'])){
$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>
</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">
</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'];
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');
?>
<!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>
</head>
<body>
<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">
<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>
<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">
<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>
</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'];
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'];
?>
<!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>
</head>
<body>
<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>
</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'];
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'];
?>
<!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>
</head>
<body>
<?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>
@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;
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>
</head>
<body>
<section class="heading">
<h3>your wishlist</h3>
<p> <a href="home.php">home</a> / wishlist </p>
</section>
<section class="wishlist">
<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'])){
?>
<!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>
</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">
</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>
</head>
<body>
<section class="heading">
<h3>your orders</h3>
<p> <a href="home.php">home</a> / order </p>
</section>
<section class="placed-orders">
<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>
<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'];
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'];
?>
<!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>
</head>
<body>
<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>
<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>
</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">
</head>
<body>
<section class="heading">
<h3>shopping cart</h3>
<p> <a href="home.php">home</a> / cart </p>
</section>
<section class="shopping-cart">
<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>
<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[] = '';
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>
</head>
<body>
<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">
<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>
<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>
</head>
<body>
<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">
<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>
</head>
<body>
<section class="placed-orders">
<div class="box-container">
<?php
</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>
</head>
<body>
<section class="placed-orders">
<div class="box-container">
<?php
</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>
<section class="placed-orders">
<div class="box-container">
<?php
</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!';
}
}
?>
<!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>
</head>
<body>
<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)){
?>
<?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>
</head>
<body>
<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
?>
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
Reference:
www.Campcode.com
www.Geeksforgeeks.com
www.github.com
www.codeforge.com