REPORT - On Road Fuel Demand

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 43

INTRODUCTION

OBJECTIVE:
It consume less amount of time when compared to manual paper work through the
automated system. The system will take care of all the servicing activity in a quick manner.
Data storing is easier.
 Providing a smart technology Fuel delivery on demand application system.
 Reducing human time and effort
 This application will help to reduce wasting user time for found a gas station.
 The majority of the population today uses smart phones with active internet
connection, which is the basic requirement for this product to function properly.
 This project falls under the category of embedded systems and android applications

AIM OF THE PROJECT


 The Fuel Delivery on Demand application to develop delivery ondemand fuel
depends on the user order and request. Due to growth of automobiles in market, fuel
consumption became more.
 In existing systm, unfortunately because of some reason if vehicle stops due to lack
of petrol, it will be very hard for the owner to push the vehicle to the nearest petrol
pump.
 In some cases people go to new location and sometimes they won’t be having any
idea of the gas stations to refuel their vehicles. The proposed system to develop
application to deliver the fuel to those who need to refuel vehicles at any location and
time.
 In this application three modules using user, fuel station, admin. Admin can verify
Fuel Station details, then it will see user modules. Fuel Station can add their branch
information like address and google map geo location and kind of fuel provide.
 User can search by locality or station name and book the fuel on online app. Our
objective develop using angular java script and MySQL as our backend database with
responsive applicaion.

1
SYSTEM ANALYSIS
1. EXISTING SYSTEM
DISADVANTAGES:
1. Lack of privacy
2. Risk in the management of the data.
3. Less Security
4. Low co-ordination between
5. Less User-friendly
6. Accuracy not guaranteed
7. Not in reach of distant users.

2. PROPOSED SYSTEM
 Mobile application technology is beneficial for fuel delivery on demand application .
 We bring a new solution for refueling automobiles and power backup supply. To
develop an application to deliver fuel on demand. To make sure that quality and
quantity is good. In this application provides a door to door supply.
ADVANTAGES OF PROPOSED SYSTEM
1. The System is user friendly.
2. Cost effective.
3. Back up support.
4. Secured Data.

MODULE LIST

USER
 Register
 Login
 Search Fuel Station
 Place order
 Make Payment
 Get Delivery
ADMIN
 Login
 Approve/Reject Fuel Station

2
SYSTEM SPECIFICATIONS
Hardware Requirements:

 Dual Core(Processor).

 256 MB Ram

 512 KB Cache Memory

 Hard disk 10 GB

 Microsoft Compatible 101 or more Key Board

Software Requirements:

Technology Implemented : Apache Server

Language Used : PHP 5.62 (Developed in Core PHP)

Database : My SQL

User Interface Design : HTML, AJAX,JQUERY,JAVASCRIPT

Web Browser : Mozilla, Google Chrome, IE8,OPERA

Software : XAMPP Server

3
DESIGN

INTRODUCTION:
Design is the first step in the development phase for any techniques and principles for the
purpose of defining a device, a process or system in sufficient detail to permit its physical
realization.
Once the software requirements have been analyzed and specified the software design
involves three technical activities - design, coding, implementation and testing that are
required to build and verify the software.
The design activities are of main importance in this phase, because in this activity,
decisions ultimately affecting the success of the software implementation and its ease of
maintenance are made. These decisions have the final bearing upon reliability and
maintainability of the system. Design is the only way to accurately translate the customer’s
requirements into finished software or a system.
Design is the place where quality is fostered in development. Software design is a
process through which requirements are translated into a representation of software. Software
design is conducted in two steps. Preliminary design is concerned with the transformation of
requirements into data.
3.1 UML Diagrams:
Actor:
A coherent set of roles that users of use cases play when interacting with the use
`cases.

Use case:
A description of sequence of actions, including variants, that a system performs that yields an
observable result of value of an actor.

4
UML stands for Unified Modeling Language. UML is a language for specifying, visualizing
and documenting the system. This is the step while developing any product after analysis.
The goal from this is to produce a model of the entities involved in the project which later
need to be built. The representation of the entities that are to be used in the product being
developed need to be designed.
There are various kinds of methods in software design:
They are as follows:
 Use case Diagram
 Sequence Diagram
 Activity Diagram
 State chat Diagram

USECASE DIAGRAMS:
Use case diagrams model behavior within a system and helps the developers
understand of what the user require. The stick man represents what’s called an actor.
Use case diagram can be useful for getting an overall view of the system and clarifying who
can do and more importantly what they can’t do.
Use case diagram consists of use cases and actors and shows the interaction between the use
case and actors.

 The purpose is to show the interactions between the use case and actor.
 To represent the system requirements from user’s perspective.
 An actor could be the end-user of the system or an external system.

USECASE DIAGRAM:

A Use case is a description of set of sequence of actions. Graphically it is rendered as


an ellipse with solid line including only its name. Use case diagram is a behavioral diagram
that shows a set of use cases and actors and their relationship. It is an association between
the use cases and actors. An actor represents a real-world object. Primary Actor – Sender,
Secondary Actor Receiver.

5
User/ Public

Register

Login

Search Fue lStation

USER
Place order

Make Payment

Get Delivery

Admin

Admin Login

ADMIN Approve/Reject Fuel Station

SEQUENCE DIAGRAM:

Sequence diagram and collaboration diagram are called INTERACTION


DIAGRAMS. An interaction diagram shows an interaction, consisting of set of objects and
their relationship including the messages that may be dispatched among them.
A sequence diagram is an introduction that empathizes the time ordering of messages.
Graphically a sequence diagram is a table that shows objects arranged along the X-axis and
messages ordered in increasing time along the Y-axis

6
Activity Diagram

7
CLASS DIAGRAM:

Class is nothing but a structure that contains both variables and methods. The Class Diagram
shows a set of classes, interfaces, and collaborations and their relating ships. There is most
common diagram in modeling the object oriented systems and are used to give the static view
of a system. It shows the dependency between the classes that can be used in our system.
The interactions between the modules or classes of our projects are shown below. Each
block contains Class Name, Variables and Methods.
CLASS:
A description of set of objects that share the same attributes, operations, relationships, and
semantics

DATA FLOW DIAGRAMS:

8
The DFD takes an input-process-output view of a system i.e. data objects flow into
the software, are transformed by processing elements, and resultant data objects flow out of
the software.

Data objects represented by labeled arrows and transformation are represented by


circles also called as bubbles. DFD is presented in a hierarchical fashion i.e. the first data
flow model represents the system as a whole. Subsequent DFD refine the context diagram
(level 0 DFD), providing increasing details with each subsequent level.

The DFD enables the software engineer to develop models of the information domain
& functional domain at the same time. As the DFD is refined into greater levels of details, the
analyst perform an implicit functional decomposition of the system. At the same time, the
DFD refinement results in a corresponding refinement of the data as it moves through the
process that embody the applications.

A context-level DFD for the system the primary external entities produce information
for use by the system and consume information generated by the system. The labeled arrow
represents data objects or object hierarchy.

RULES FOR DFD:

 Fix the scope of the system by means of context diagrams.

 Organize the DFD so that the main sequence of the actions

 Reads left to right and top to bottom.

 Identify all inputs and outputs.

 Identify and label each process internal to the system with Rounded circles.

 A process is required for all the data transformation and Transfers. Therefore,
never connect a data store to a data Source or the destinations or another data store
with just a Data flow arrow.

 Do not indicate hardware and ignore control information.

 Make sure the names of the processes accurately convey everything the process is
done.
9
 There must not be unnamed process.

 Indicate external sources and destinations of the data, with Squares.

 Number each occurrence of repeated external entities.

 Identify all data flows for each process step, except simple Record retrievals.

 Label data flow on each arrow.

 Use details flow on each arrow.

 Use the details flow arrow to indicate data movements.

3.8 DATAFLOW DIAGRAMS:

E-R Diagrams:

The Entity-Relationship (ER) model was originally proposed by Peter in 1976 [Chen76] as a
way to unify the network and relational database views. Simply stated the ER model is a
conceptual data model that views the real world as entities and relationships. A basic
component of the model is the Entity-Relationship diagram which is used to visually
represents data objects. Since Chen wrote his paper the model has been extended and today it

10
is commonly used for database design For the database designer, the utility of the ER model
is:

 it maps well to the relational model. The constructs used in the ER model can easily
be transformed into relational tables.
 it is simple and easy to understand with a minimum of training. Therefore, the model
can be used by the database designer to communicate the design to the end user.
 In addition, the model can be used as a design plan by the database developer to
implement a data model in a specific database management software.

Connectivity and Cardinality

The basic types of connectivity for relations are: one-to-one, one-to-many, and many-to-
many. A one-to-one (1:1) relationship is when at most one instance of a entity A is associated
with one instance of entity B. For example, "employees in the company are each assigned
their own office. For each employee there exists a unique office and for each office there
exists a unique employee.

A one-to-many (1:N) relationships is when for one instance of entity A, there are zero, one, or
many instances of entity B, but for one instance of entity B, there is only one instance of
entity A. An example of a 1:N relationships is a department has many employees each
employee is assigned to one department A many-to-many (M:N) relationship, sometimes
called non-specific, is when for one instance of entity A, there are zero, one, or many
instances of entity B and for one instance of entity B there are zero, one, or many instances of
entity A. The connectivity of a relationship describes the mapping of associated

ER Notation

There is no standard for representing data objects in ER diagrams. Each modeling


methodology uses its own notation. The original notation used by Chen is widely used in
academics texts and journals but rarely seen in either CASE tools or publications by non-
academics. Today, there are a number of notations used, among the more common are
Bachman, crow's foot, and IDEFIX.

All notational styles represent entities as rectangular boxes and relationships as lines
connecting boxes. Each style uses a special set of symbols to represent the cardinality of a
connection. The notation used in this document is from Martin. The symbols used for the
basic ER constructs are:

11
 entities are represented by labeled rectangles. The label is the name of the entity.

Entity names should be singular nouns.

 relationships are represented by a solid line connecting two entities. The name of the

relationship is written above the line. Relationship names should be verbs.

 attributes, when included, are listed inside the entity rectangle. Attributes which are

identifiers are underlined. Attribute names should be singular nouns.

 cardinality of many is represented by a line ending in a crow's foot. If the crow's foot

is omitted, the cardinality is one.

 existence is represented by placing a circle or a perpendicular bar on the line.

Mandatory existence is shown by the bar (looks like a 1) next to the entity for an

instance is required. Optional existence is shown by placing a circle next to the entity

that is optional

ER DIAGRAM

12
SYSTEM IMPLEMENTATION
Sample Coding
Index.php
<?php
require "config/constants.php";
session_start();
if(isset($_SESSION["uid"])){
header("location:profile.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Khan Store</title>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<script src="js/jquery2.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<style></style>
</head>
<body>
<div class="wait overlay">
<div class="loader"></div>
</div>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-
toggle="collapse" data-target="#collapse" aria-expanded="false">
<span class="sr-only">navigation</span>
<span class="icon-bar"></span>

13
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Khan Store</a>
</div>
<div class="collapse navbar-collapse" id="collapse">
<ul class="nav navbar-nav">
<li><a href="index.php"><span class="glyphicon glyphicon-
home"></span>Home</a></li>
<li><a href="index.php"><span class="glyphicon glyphicon-
modal-window"></span>Product</a></li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search"
id="search">
</div>
<button type="submit" class="btn btn-primary" id="search_btn"><span
class="glyphicon glyphicon-search"></span></button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#" class="dropdown-toggle" data-
toggle="dropdown"><span class="glyphicon glyphicon-shopping-cart"></span>Cart<span
class="badge">0</span></a>
<div class="dropdown-menu" style="width:400px;">
<div class="panel panel-success">
<div class="panel-heading">
<div class="row">
<div class="col-md-
3">Sl.No</div>
<div class="col-md-
3">Product Image</div>
<div class="col-md-
3">Product Name</div>
14
<div class="col-md-
3">Price in <?php echo CURRENCY; ?></div>
</div>
</div>
<div class="panel-body">
<div id="cart_product">
<!--<div class="row">
<div class="col-md-
3">Sl.No</div>
<div class="col-md-
3">Product Image</div>
<div class="col-md-
3">Product Name</div>
<div class="col-md-
3">Price in $.</div>
</div>-->
</div>
</div>
<div class="panel-footer"></div>
</div>
</div>
</li>
<li><a href="#" class="dropdown-toggle" data-
toggle="dropdown"><span class="glyphicon glyphicon-user"></span>SignIn</a>
<ul class="dropdown-menu">
<div style="width:300px;">
<div class="panel panel-primary">
<div class="panel-
heading">Login</div>
<div class="panel-heading">
<form onsubmit="return
false" id="login">
<label
for="email">Email</label>
15
<input
type="email" class="form-control" name="email" id="email" required/>
<label
for="email">Password</label>
<input
type="password" class="form-control" name="password" id="password" required/>
<p><br/></p>
<a href="#"
style="color:white; list-style:none;">Forgotten Password</a><input type="submit"
class="btn btn-success" style="float:right;">
</form>
</div>
<div class="panel-footer"
id="e_msg"></div>
</div>
</div>
</ul>
</li>
</ul>
</div>
</div>
</div>
<p><br/></p>
<p><br/></p>
<p><br/></p>
<div class="container-fluid">
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-2 col-xs-12">
<div id="get_category">
</div>
<!--<div class="nav nav-pills nav-stacked">
<li class="active"><a
href="#"><h4>Categories</h4></a></li>
16
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
</div> -->
<div id="get_brand">
</div>
<!--<div class="nav nav-pills nav-stacked">
<li class="active"><a
href="#"><h4>Brand</h4></a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Categories</a></li>
</div> -->
</div>
<div class="col-md-8 col-xs-12">
<div class="row">
<div class="col-md-12 col-xs-12" id="product_msg">
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">Products</div>
<div class="panel-body">
<div id="get_product">
<!--Here we get product jquery Ajax
Request-->
</div>
<!--<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-
heading">Samsung Galaxy</div>
<div class="panel-body">

17
<img
src="product_images/images.JPG"/>
</div>
<div class="panel-
heading">$.500.00
<button
style="float:right;" class="btn btn-danger btn-xs">AddToCart</button>
</div>
</div>
</div> -->
</div>
<div class="panel-footer">&copy; 2016</div>
</div>
</div>
<div class="col-md-1"></div>
</div>
</div>
</body>
</html>

Action.php
<?php
session_start();
$ip_add = getenv("REMOTE_ADDR");
include "db.php";
if(isset($_POST["category"])){
$category_query = "SELECT * FROM categories";
$run_query = mysqli_query($con,$category_query) or die(mysqli_error($con));
echo "
<div class='nav nav-pills nav-stacked'>
<li class='active'><a href='#'><h4>Categories</h4></a></li>
";
if(mysqli_num_rows($run_query) > 0){
while($row = mysqli_fetch_array($run_query)){
18
$cid = $row["cat_id"];
$cat_name = $row["cat_title"];
echo "
<li><a href='#' class='category'
cid='$cid'>$cat_name</a></li>
";
}
echo "</div>";
}
}
if(isset($_POST["brand"])){
$brand_query = "SELECT * FROM brands";
$run_query = mysqli_query($con,$brand_query);
echo "
<div class='nav nav-pills nav-stacked'>
<li class='active'><a href='#'><h4>Brands</h4></a></li>
";
if(mysqli_num_rows($run_query) > 0){
while($row = mysqli_fetch_array($run_query)){
$bid = $row["brand_id"];
$brand_name = $row["brand_title"];
echo "
<li><a href='#' class='selectBrand'
bid='$bid'>$brand_name</a></li>
";
}
echo "</div>";
}
}
if(isset($_POST["page"])){
$sql = "SELECT * FROM products";
$run_query = mysqli_query($con,$sql);
$count = mysqli_num_rows($run_query);
$pageno = ceil($count/9);
19
for($i=1;$i<=$pageno;$i++){
echo "
<li><a href='#' page='$i' id='page'>$i</a></li>
";
}
}
if(isset($_POST["getProduct"])){
$limit = 9;
if(isset($_POST["setPage"])){
$pageno = $_POST["pageNumber"];
$start = ($pageno * $limit) - $limit;
}else{
$start = 0;
}
$product_query = "SELECT * FROM products LIMIT $start,$limit";
$run_query = mysqli_query($con,$product_query);
if(mysqli_num_rows($run_query) > 0){
while($row = mysqli_fetch_array($run_query)){
$pro_id = $row['product_id'];
$pro_cat = $row['product_cat'];
$pro_brand = $row['product_brand'];
$pro_title = $row['product_title'];
$pro_price = $row['product_price'];
$pro_image = $row['product_image'];
echo "
<div class='col-md-4'>
<div class='panel panel-info'>
<div class='panel-
heading'>$pro_title</div>
<div class='panel-body'>
<img
src='product_images/$pro_image' style='width:160px; height:250px;'/>
</div>

20
<div class='panel-
heading'>".CURRENCY." $pro_price.00
<button pid='$pro_id'
style='float:right;' id='product' class='btn btn-danger btn-xs'>AddToCart</button>
</div>
</div>
</div>
";
}
}
}
if(isset($_POST["get_seleted_Category"]) || isset($_POST["selectBrand"]) ||
isset($_POST["search"])){
if(isset($_POST["get_seleted_Category"])){
$id = $_POST["cat_id"];
$sql = "SELECT * FROM products WHERE product_cat = '$id'";
}else if(isset($_POST["selectBrand"])){
$id = $_POST["brand_id"];
$sql = "SELECT * FROM products WHERE product_brand = '$id'";
}else {
$keyword = $_POST["keyword"];
$sql = "SELECT * FROM products WHERE product_keywords LIKE '%
$keyword%'";
}

$run_query = mysqli_query($con,$sql);
while($row=mysqli_fetch_array($run_query)){
$pro_id = $row['product_id'];
$pro_cat = $row['product_cat'];
$pro_brand = $row['product_brand'];
$pro_title = $row['product_title'];
$pro_price = $row['product_price'];
$pro_image = $row['product_image'];
echo "
21
<div class='col-md-4'>
<div class='panel panel-info'>
<div class='panel-
heading'>$pro_title</div>
<div class='panel-body'>
<img
src='product_images/$pro_image' style='width:160px; height:250px;'/>
</div>
<div class='panel-heading'>$.
$pro_price.00
<button pid='$pro_id'
style='float:right;' id='product' class='btn btn-danger btn-xs'>AddToCart</button>
</div>
</div>
</div>
";
}
}

if(isset($_POST["addToCart"])){

$p_id = $_POST["proId"];

if(isset($_SESSION["uid"])){

$user_id = $_SESSION["uid"];

$sql = "SELECT * FROM cart WHERE p_id = '$p_id' AND user_id =


'$user_id'";
$run_query = mysqli_query($con,$sql);
22
$count = mysqli_num_rows($run_query);
if($count > 0){
echo "
<div class='alert alert-warning'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>&times;</a>
<b>Product is already added into the cart
Continue Shopping..!</b>
</div>
";//not in video
} else {
$sql = "INSERT INTO `cart`
(`p_id`, `ip_add`, `user_id`, `qty`)
VALUES ('$p_id','$ip_add','$user_id','1')";
if(mysqli_query($con,$sql)){
echo "
<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>&times;</a>
<b>Product is Added..!</b>
</div>
";
}
}
}else{
$sql = "SELECT id FROM cart WHERE ip_add = '$ip_add' AND p_id
= '$p_id' AND user_id = -1";
$query = mysqli_query($con,$sql);
if (mysqli_num_rows($query) > 0) {
echo "
<div class='alert alert-warning'>
<a href='#' class='close' data-
dismiss='alert' aria-label='close'>&times;</a>

23
<b>Product is already added into the cart
Continue Shopping..!</b>
</div>";
exit();
}
$sql = "INSERT INTO `cart`
(`p_id`, `ip_add`, `user_id`, `qty`)
VALUES ('$p_id','$ip_add','-1','1')";
if (mysqli_query($con,$sql)) {
echo "
<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>&times;</a>
<b>Your product is Added Successfully..!</b>
</div>
";
exit();
}

//Count User cart item


if (isset($_POST["count_item"])) {
//When user is logged in then we will count number of item in cart by using user
session id
if (isset($_SESSION["uid"])) {
$sql = "SELECT COUNT(*) AS count_item FROM cart WHERE user_id =
$_SESSION[uid]";
}else{
24
//When user is not logged in then we will count number of item in cart by
using users unique ip address
$sql = "SELECT COUNT(*) AS count_item FROM cart WHERE ip_add =
'$ip_add' AND user_id < 0";
}

$query = mysqli_query($con,$sql);
$row = mysqli_fetch_array($query);
echo $row["count_item"];
exit();
}
//Count User cart item

//Get Cart Item From Database to Dropdown menu


if (isset($_POST["Common"])) {

if (isset($_SESSION["uid"])) {
//When user is logged in this query will execute
$sql = "SELECT
a.product_id,a.product_title,a.product_price,a.product_image,b.id,b.qty FROM products
a,cart b WHERE a.product_id=b.p_id AND b.user_id='$_SESSION[uid]'";
}else{
//When user is not logged in this query will execute
$sql = "SELECT
a.product_id,a.product_title,a.product_price,a.product_image,b.id,b.qty FROM products
a,cart b WHERE a.product_id=b.p_id AND b.ip_add='$ip_add' AND b.user_id < 0";
}
$query = mysqli_query($con,$sql);
if (isset($_POST["getCartItem"])) {
//display cart item in dropdown menu
if (mysqli_num_rows($query) > 0) {
$n=0;
while ($row=mysqli_fetch_array($query)) {
$n++;
25
$product_id = $row["product_id"];
$product_title = $row["product_title"];
$product_price = $row["product_price"];
$product_image = $row["product_image"];
$cart_item_id = $row["id"];
$qty = $row["qty"];
echo '
<div class="row">
<div class="col-md-3">'.$n.'</div>
<div class="col-md-3"><img class="img-
responsive" src="product_images/'.$product_image.'" /></div>
<div class="col-md-3">'.$product_title.'</div>
<div class="col-md-3">'.CURRENCY.''.
$product_price.'</div>
</div>';

}
?>
<a style="float:right;" href="cart.php" class="btn btn-
warning">Edit&nbsp;&nbsp;<span class="glyphicon glyphicon-edit"></span></a>
<?php
exit();
}
}
if (isset($_POST["checkOutDetails"])) {
if (mysqli_num_rows($query) > 0) {
//display user cart item with "Ready to checkout" button if user is not
login
echo "<form method='post' action='login_form.php'>";
$n=0;
while ($row=mysqli_fetch_array($query)) {
$n++;
$product_id = $row["product_id"];
$product_title = $row["product_title"];
26
$product_price = $row["product_price"];
$product_image = $row["product_image"];
$cart_item_id = $row["id"];
$qty = $row["qty"];

echo
'<div class="row">
<div class="col-md-2">
<div class="btn-group">
<a href="#"
remove_id="'.$product_id.'" class="btn btn-danger remove"><span class="glyphicon
glyphicon-trash"></span></a>
<a href="#"
update_id="'.$product_id.'" class="btn btn-primary update"><span class="glyphicon
glyphicon-ok-sign"></span></a>
</div>
</div>
<input type="hidden"
name="product_id[]" value="'.$product_id.'"/>
<input type="hidden" name=""
value="'.$cart_item_id.'"/>
<div class="col-md-2"><img
class="img-responsive" src="product_images/'.$product_image.'"></div>
<div class="col-md-2">'.
$product_title.'</div>
<div class="col-md-2"><input
type="text" class="form-control qty" value="'.$qty.'" ></div>
<div class="col-md-2"><input
type="text" class="form-control price" value="'.$product_price.'"
readonly="readonly"></div>
<div class="col-md-2"><input
type="text" class="form-control total" value="'.$product_price.'"
readonly="readonly"></div>
</div>';
27
}

echo '<div class="row">


<div class="col-md-8"></div>
<div class="col-md-4">
<b class="net_total" style="font-
size:20px;"> </b>
</div>';
if (!isset($_SESSION["uid"])) {
echo '<input type="submit" style="float:right;"
name="login_user_with_product" class="btn btn-info btn-lg" value="Ready to Checkout" >
</form>';

}else if(isset($_SESSION["uid"])){
//Paypal checkout form
echo '
</form>
<form
action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd"
value="_cart">
<input type="hidden" name="business"
value="shoppingcart@khanstore.com">
<input type="hidden" name="upload"
value="1">';

$x=0;
$sql = "SELECT
a.product_id,a.product_title,a.product_price,a.product_image,b.id,b.qty FROM products
a,cart b WHERE a.product_id=b.p_id AND b.user_id='$_SESSION[uid]'";
$query = mysqli_query($con,$sql);

while($row=mysqli_fetch_array($query)){
$x++;
28
echo
'<input type="hidden"
name="item_name_'.$x.'" value="'.$row["product_title"].'">
<input type="hidden"
name="item_number_'.$x.'" value="'.$x.'">
<input type="hidden"
name="amount_'.$x.'" value="'.$row["product_price"].'">
<input type="hidden"
name="quantity_'.$x.'" value="'.$row["qty"].'">';
}

echo
'<input type="hidden"
name="return" value="http://localhost/project1/payment_success.php"/>
<input type="hidden" name="notify_url"
value="http://localhost/KhanStore/payment_success.php">
<input type="hidden"
name="cancel_return" value="http://localhost/KhanStore/cancel.php"/>
<input type="hidden"
name="currency_code" value="USD"/>
<input type="hidden"
name="custom" value="'.$_SESSION["uid"].'"/>
<input
style="float:right;margin-right:80px;" type="image" name="submit"

src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/blue-rect-
paypalcheckout-60px.png" alt="PayPal Checkout"
alt="PayPal - The
safer, easier way to pay online">
</form>';
}
}
}

29
}

//Remove Item From cart


if (isset($_POST["removeItemFromCart"])) {
$remove_id = $_POST["rid"];
if (isset($_SESSION["uid"])) {
$sql = "DELETE FROM cart WHERE p_id = '$remove_id' AND user_id =
'$_SESSION[uid]'";
}else{
$sql = "DELETE FROM cart WHERE p_id = '$remove_id' AND ip_add =
'$ip_add'";
}
if(mysqli_query($con,$sql)){
echo "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>&times;</a>
<b>Product is removed from cart</b>
</div>";
exit();
}
}

//Update Item From cart


if (isset($_POST["updateCartItem"])) {
$update_id = $_POST["update_id"];
$qty = $_POST["qty"];
if (isset($_SESSION["uid"])) {
$sql = "UPDATE cart SET qty='$qty' WHERE p_id = '$update_id' AND
user_id = '$_SESSION[uid]'";
}else{
$sql = "UPDATE cart SET qty='$qty' WHERE p_id = '$update_id' AND
ip_add = '$ip_add'";
30
}
if(mysqli_query($con,$sql)){
echo "<div class='alert alert-info'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>&times;</a>
<b>Product is updated</b>
</div>";
exit();
}
}
?>

Admin Module
Index.php
<?php
session_start();
if (!isset($_SESSION['admin_id'])) {
header("location:login.php");
}

include "./templates/top.php";

?>

<?php include "./templates/navbar.php"; ?>

<div class="container-fluid">
<div class="row">

<?php include "./templates/sidebar.php"; ?>

<!-- <canvas class="my-4 w-100" id="myChart" width="900" height="380"></canvas>


-->

31
<h2>Other Admins</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="admin_list">
<tr>
<td>1,001</td>
<td>Lorem</td>
<td>ipsum</td>
<td>dolor</td>
<td>sit</td>
</tr>
</tbody>
</table>
</div>
</main>
</div>
</div>

<?php include "./templates/footer.php"; ?>

<script type="text/javascript" src="./js/admin.js"></script>


Product.php
<?php session_start(); ?>
<?php include_once("./templates/top.php"); ?>
32
<?php include_once("./templates/navbar.php"); ?>
<div class="container-fluid">
<div class="row">

<?php include "./templates/sidebar.php"; ?>

<div class="row">
<div class="col-10">
<h2>Product List</h2>
</div>
<div class="col-2">
<a href="#" data-toggle="modal" data-target="#add_product_modal"
class="btn btn-primary btn-sm">Add Product</a>
</div>
</div>

<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Image</th>
<th>Price</th>
<th>Quantity</th>
<th>Category</th>
<th>Brand</th>
<th>Action</th>
</tr>
</thead>
<tbody id="product_list">
<!-- <tr>
<td>1</td>
<td>ABC</td>
33
<td>FDGR.JPG</td>
<td>122</td>
<td>eLECTRONCS</td>
<td>aPPLE</td>
<td><a class="btn btn-sm btn-info"></a><a class="btn btn-sm btn-
danger">Delete</a></td>
</tr> -->
</tbody>
</table>
</div>
</main>
</div>
</div>

<!-- Add Product Modal start -->


<div class="modal fade" id="add_product_modal" tabindex="-1" role="dialog" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Product</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="add-product-form" enctype="multipart/form-data">
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Product Name</label>

34
<input type="text" name="product_name" class="form-
control" placeholder="Enter Product Name">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Brand Name</label>
<select class="form-control brand_list" name="brand_id">
<option value="">Select Brand</option>
</select>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Category Name</label>
<select class="form-control category_list"
name="category_id">
<option value="">Select Category</option>
</select>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Description</label>
<textarea class="form-control" name="product_desc"
placeholder="Enter product desc"></textarea>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Qty</label>
<input type="number" name="product_qty" class="form-control"
placeholder="Enter Product Quantity">
</div>
35
</div>
<div class="col-12">
<div class="form-group">
<label>Product Price</label>
<input type="number" name="product_price" class="form-
control" placeholder="Enter Product Price">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Keywords <small>(eg: apple, iphone,
mobile)</small></label>
<input type="text" name="product_keywords" class="form-
control" placeholder="Enter Product Keywords">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Image <small>(format: jpg, jpeg,
png)</small></label>
<input type="file" name="product_image" class="form-
control">
</div>
</div>
<input type="hidden" name="add_product" value="1">
<div class="col-12">
<button type="button" class="btn btn-primary add-product">Add
Product</button>
</div>
</div>

</form>
</div>
</div>
36
</div>
</div>
<!-- Add Product Modal end -->

<!-- Edit Product Modal start -->


<div class="modal fade" id="edit_product_modal" tabindex="-1" role="dialog" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Product</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="edit-product-form" enctype="multipart/form-data">
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Product Name</label>
<input type="text" name="e_product_name" class="form-control"
placeholder="Enter Product Name">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Brand Name</label>
<select class="form-control brand_list" name="e_brand_id">
<option value="">Select Brand</option>
</select>
</div>
</div>
<div class="col-12">
37
<div class="form-group">
<label>Category Name</label>
<select class="form-control category_list" name="e_category_id">
<option value="">Select Category</option>
</select>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Description</label>
<textarea class="form-control" name="e_product_desc" placeholder="Enter
product desc"></textarea>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Qty</label>
<input type="number" name="e_product_qty" class="form-control"
placeholder="Enter Product Quantity">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Price</label>
<input type="number" name="e_product_price" class="form-control"
placeholder="Enter Product Price">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label>Product Keywords <small>(eg: apple, iphone, mobile)</small></label>
<input type="text" name="e_product_keywords" class="form-control"
placeholder="Enter Product Keywords">
</div>
38
</div>
<div class="col-12">
<div class="form-group">
<label>Product Image <small>(format: jpg, jpeg, png)</small></label>
<input type="file" name="e_product_image" class="form-control">
<img src="../product_images/1.0x0.jpg" class="img-fluid" width="50">
</div>
</div>
<input type="hidden" name="pid">
<input type="hidden" name="edit_product" value="1">
<div class="col-12">
<button type="button" class="btn btn-primary submit-edit-product">Add
Product</button>
</div>
</div>

</form>
</div>
</div>
</div>
</div>
<!-- Edit Product Modal end -->

<?php include_once("./templates/footer.php"); ?>

<script type="text/javascript" src="./js/products.js"></script>

39
IMPLEMNTATION AND SYSTEM TESTING
After all phase have been perfectly done, the system will be implemented to the server and
the system can be used.

SYSTEM TESTING
The goal of the system testing process was to determine all faults in our project .The
program was subjected to a set of test inputs and many explanations were made and based
on these explanations it will be decided whether the program behaves as expected or not.
Our Project went through two levels of testing.
1. Unit testing
2. Integration testing

UNIT TESTING

Unit testing is commenced when a unit has been created and effectively reviewed .In order
to test a single module we need to provide a complete environment i.e. besides the section
we would require
• The procedures belonging to other units that the unit under test calls

• Non local data structures that module accesses

• A procedure to call the functions of the unit under test with appropriate
parameters

1. Test for the admin module

• Testing admin login form-This form is used for log in of administrator of the
system. In this form we enter the username and password if both are correct
administration page will open otherwise if any of data is wrong it will get redirected
back to the login page and again ask the details.
• Report Generation: admin can generate report from the main database.

INTEGRATION TESTING

In the Integration testing we test various combination of the project module by


providing the input.

The primary objective is to test the module interfaces in order to confirm that no
errors are occurring when one module invokes the other module.

40
EVALUATION
Project URL: http://localhost/bug

Home Page

41
CONCLUSION:
Problem encountered during development of this project, further learning related to
the system development, critical evaluation of the project and further improvements will be
discussed in this chapter. 6.1. Problems encountered and lessons learned Initial client (Fuel
station owner‟s) requirements were not vague. Therefore manual document was prepared and
met client for discussion. During discussion stage, client‟s requirements were captured and
manual document was changed accordingly. After adjusted the manual document, again met
client for verify the captured requirements and changed the rest of mistakes and finally met
client for getting approval for that document and started development process. Following
difficulties were happen at the time of requirement gathering stage. At the first phrase,
cannot capture the client‟s entire requirements.
 Difficult to meet the client regularly.
 Client‟s trust regarding the software was poor at the beginning.
 Client‟s computer knowledge is little bit of poor and may be never used computers.
 Client‟s corporation for the software development was poor at the beginning.

42
References

For PHP
• https://www.w3schools.com/php/default.asp
• https://www.sitepoint.com/php/
• https://www.php.net/

For MySQL
• https://www.mysql.com/
• http://www.mysqltutorial.org

For XAMPP
• https://www.apachefriends.org/download.html

43

You might also like