E-Commerce Website With PHP and Mysql
E-Commerce Website With PHP and Mysql
PROJECT REPORT
ON
E-Commerce Website
ACADEMIC YEAR
(2017 - 2018)
UNIVERSITY OF MUMBAI
M.V.M. DEGREE COLLEGE OF COMMERCE &
SCIENCE
ANDHERI (W), MUMBAI- 400 058.
M.V.M. EDUCATIONAL CAMPUS
CERTIFICATE
I take this opportunity to express my gratitude to our Co-ordinator Mr. Divyesh Nagrecha
for giving me this opportunity to accomplish my project work.
I am very thankful to our Principal Dr.Gopal Kalkoti, for his kind co-operation during the
completion of the project.
I would like to thank Ms. Trupti Narvankar of our department who assisted us in our project.
A special thanks to our project guide Ms. Soma Bera for her most sincere efforts, support
and encouraging contribution throughout the project.
I take this opportunity to express our profound gratitude to the management of M.V.M.
College of Commerce & Science for giving me this opportunity to accomplish this project
Last but not the least, I would like to thank all our friends & our family for their support,
motivation and encouragement.
Index
Sr. Contents Pg. No
No
5 CODES 50-60
6 CONCLUSION 61
7 ANNEXURE 62
7.1 Reference 62
According to the surveyed literature, our findings were that customers personally visit the shop
for their needs and buy stuff according to their wish and shopkeepers generate bill according to
the items purchased with order number and other details
The main objective behind making this website is increase the business, smarter
and better.
The website meets the following objective that Raj Electronics needs:
Scope of Project
At presently this website is support for just placing order and and bill register.
Further enhancement of the software will have the following features:
• Alerts to customers of Raj Electronics when order is generated via e-mail.
• A website will allow customer to pay the bill through online payment.
E-Commerce Website 2| P a g e
1.1.4 Problem-Existing System
Currently the shopkeeper is generating bills on paper. The main problem shopkeeper is facing
is that more time is consumed for writing the bill. In case of physical bill there is always
possibility of bill getting misplaced or being damaged which leaves the shopkeeper
and customer with no records/ history.
E-Commerce Website 3| P a g e
1.2 FEASIBILITY STUDY
1.2.1 Operational Feasibility
Operational feasibility is to gain an understanding of whether the proposed system will
likely solve the business problems, or take advantage of the opportunities or not. It is
important to understand how the new system will fit the current day-to-day operations
of the organization.
• The other major requirement was to develop website for growth of business. This
requirement was also satisfied.
• The next thing was to make a solution to get the product details
• The next thing we needed was a system that is easy to use. So we designed an interface
which is extremely easy to use and also we have given attention to website wherein
customer can access the website from computer.
In case of technical feasibility we have made a system that match accord to the
requirements of the accountant.
We have made the project in a language in which we are familiar. The entire project
and website is made in PHP and MySQL Server. We have chosen these to as the project is
small and also we are familiar with the technologies.
E-Commerce Website 4| P a g e
• The next area where have concentrated is the operating system architecture.
We are currently using Windows 10, we have made the website, operating
system and architecture friendly.
Economic evaluation is a vital part of investment appraisal, dealing with factors that
can be quantified, measured, and compared in monetary terms (Chen 1996). The results
of an economic evaluation are considered with other aspects to make the project
investment decision as the proper investment appraisal helps to ensure that the right
project is undertaken in a manner that gives it the best chances of success.
• The system according to us is cost effective as this a small group which is containing
little members and only two members are working on this project.
E-Commerce Website 5| P a g e
1.2.4 Gantt Chart:
E-Commerce Website 6| P a g e
1.3 REQUIREMENT SPECIFICATION
• For running website there are some specification and only if it satisfies the specified
requirement it will get installed and works as it is designed for.
• A technical requirement pertains to the technical aspects that your system must fulfil,
such as performance-related issues, reliability issues, and availability issues. These
types of requirements are often called quality of service (QoS) requirements, service-
level requirements or non-functional requirements.
• For our software also there are some specification there are as follows:
Minimum space required in HDD is 50GB.
• The system will have a login that keeps track of different customers and also Admin and
customer have different rights.
• Admin Functionality:
Add, edit and remove Product.
Add, edit and remove Users.
View bill .
Backup and Restore data.
User Functionality:
View Order Details
As per the requirement and guidelines that were given we have formulated this document
and by signing this document we accept that all the requirements are met.
E-Commerce Website 8|Page
1.4 TOOLS AND TECHNOLOGY:
The tools that we are using for this software are:
• XAMPP:
XAMPP is a free and open source cross-platform webserver solution stack package
developed by Apache Friends, consisting mainly of the Apache HTTP Server,
MariaDB database, and interpreters for scripts written in the PHP and Perl
programming languages, for now we require Apache and MySql only.
• Apache Server:
The Apache HTTP Server Project is an effort to develop and maintain an open-
source HTTP server for modern operating systems including UNIX and
Windows. The goal of this project is to provide a secure, efficient and
extensible server that provides HTTP services in sync with the current HTTP
standards.
The Apache HTTP Server ("httpd") was launched in 1995 and it has been the
most popular web server on the Internet since April 1996. It has celebrated its
20th birthday as a project in February 2015.
• MySQL:
MySQL is an open-source relational database management system (RDBMS).
Its name is a combination of "My", the name of co-founder Michael Widenius's
daughter, and "SQL", the abbreviation for Structured Query Language. The
MySQL development project has made its source code available under the terms
of the GNU General Public License, as well as under a variety of proprietary
agreements. MySQL was owned and sponsored by a single for-profit firm, the
Swedish company MySQL AB, now owned by Oracle Corporation
• MySQL
• PHP
• HTML
• CSS
E-Commerce Website 9| P a g e
• Back End
• SQL:
MySQL is a database system used on the web
MySQL is a database system that runs on a server
MySQL is ideal for both small and large applications
MySQL is very fast, reliable, and easy to use
MySQL uses standard SQL.
• PHP:
PHP is a server scripting language, and a powerful tool for making dynamic and
interactive Web pages.
• Front End
HTML:
HyperText Markup Language, commonly referred to as HTML, is the standard
markup language used to create web pages. It is written in the form of HTML
elements consisting of tags enclosed in angle brackets.
For creating any website or web application we have the basic thing required
is HTML.
CSS:
CSS classes using which one can develop more interactive websites and
web application.
We have used css classes to make out website look more user attractive, better
component stabilization and using this our web application can be viewed in
any mobiles or tab.
Constraints are used to limit the type of data that can go into a table. This ensures
the accuracy and reliability of the data in the table. If there is any violation between
the constraint and the data action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a
column, and table level constraints apply to the whole table.
Admin
Brand
E-Commerce Website 13 | P a g e
Cart
Categories
Orders
Products
E-Commerce Website 20 | P a g e
2.1.8 State Machine Diagram (Admin):
E-Commerce Website 23 | P a g e
2.1.10 Deployment Chart:
START
LOGIN
N0
If
Valid
Add/remove
customer
Remove/Upda
te Products
Management
END
START
LOGIN
NO
If Valid
Browse for
Products
Add to cart
Order Placed
END
fig. Homepage
fig. Homepage
E-Commerce Website 28 | P a g e
Login page
Customer:
Admin Login
fig. Contact Us
fig. Contact Us
E-Commerce Website 34 | P a g e
Checkout
fig. Checkout
fig. Payment
E-Commerce Website 35 | P a g e
All Products
Details
E-Commerce Website 37 | P a g e
Insert Product
Insert Category
View Customers
View Payments
Test Cases:1
Identifier: T1
Purpose: Test functionality of login form.
Pre-requisite: Appropriate database with sample record should be ready.
Test Input/data:
Test Data/Action Condition Excepted Result Actual Result Remark
Description
T02. Empty (Null 1.Enter null value It should display It displays Pass
value) fields for first name. error message error message
validation “Please fill out “Please fill
this field”. out this field”.
E-Commerce Website 46 | P a g e
Test Cases:3
Identifier: 3
Purpose: Check whether different hyperlinks are working properly or not.
Test Condition Excepted Result Actual Result Remark
Data/Action Description
Test Cases:4
Identifier: T04 Purpose:
Check whether the product purchase transaction by the Customer/shopkeeper takes place
smoothly.
Pre-requisite: Appropriate database with sample record should be ready.
Test Condition Description Excepted Result Actual Result Remark
Data/Action
T01.Add to Click add to cart button. It should open It opens cart page Pass
cart cart page & add & add product to
product to cart. cart.
E-Commerce Website 47 | P a g e
4. MAINTENANCE AND EVALUATION
4.1 System maintenance and future enhancement
System Maintenance:
Once the website is delivered and deployed, then maintenance phase starts. Website
requires maintenance because there are some residual errors remaining in the system that
must be removed as they are discovered.
In Maintenance we will be doing the following:
E-Commerce Website 48 | P a g e
4.2 USER MANUAL
Since this a customized software it is designed as per the user requirement and suggestions
most of the stuff are known to user.
Admin side:
How to add/remove customers?
1. Go to the admin page and login with the name and password.
2. Click on edit, update, delete button as per admin needs.
E-Commerce Website 49 | P a g e
5. Codes
5.1.1 Customer_login.php
<?php
include("includes/db.php");
?><div>
<form method="post" action="">
<table width="500" align="center" bgcolor="skyblue">
<tr align="center">
<td colspan="3"><h2>Login or Register to Buy!</h2></td>
</tr><tr>
<td align="right"><b>Email:</b></td>
<td><input type="text" name="email" placeholder="enter email" required/></td>
</tr><tr>
<td align="right"><b>Password:</b></td>
<td><input type="password" name="pass" placeholder="enter password" required/></td>
</tr>
<tr align="center">
<td colspan="3"><a href="checkout.php?forgot_pass">Forgot Password?</a></td>
</tr>
<tr align="center">
<td colspan="3"><input type="submit" name="login" value="Login" /></td></tr>
</table> <h2 style="float:right; padding-right:20px;"><a href="customer_register.php"
style="text-decoration:none;">New? Register Here</a></h2>
</form>
<?php
if(isset($_POST['login'])){
$c_email = $_POST['email'];
$c_pass = $_POST['pass'];
$sel_c = "select * from customers where customer_pass='$c_pass' AND
customer_email='$c_email'";
$run_c = mysqli_query($con, $sel_c);
$check_customer = mysqli_num_rows($run_c);
if($check_customer==0){
echo "<script>alert('Password or email is incorrect, plz try again!')</script>";
exit();}
$ip = getIp();
$sel_cart = "select * from cart where ip_add='$ip'";
$run_cart = mysqli_query($con, $sel_cart);
$check_cart = mysqli_num_rows($run_cart);
if($check_customer>0 AND $check_cart==0){
$_SESSION['customer_email']=$c_email;
echo "<script>alert('You logged in successfully, Thanks!')</script>";
echo "<script>window.open('customer/my_account.php','_self')</script>";
}else {
$_SESSION['customer_email']=$c_email;
}}
?>
</div>
<!DOCTYPE>
<?php
session_start();
include("functions/functions.php");
include("includes/db.php");
?>
<html>
<head>
<title>Raj Electronics</title>
<link rel="stylesheet" href="styles/style.css" media="all" />
</head>
<body>
<ul id="menu">
<li><a href="index.php">Home</a></li>
<li><a href="all_products.php">All Products</a></li>
<li><a href="customer/my_account.php">My Account</a></li>
<li><a href="customer_register.php">Sign Up</a></li>
<li><a href="cart.php">Shopping Cart</a></li>
<li><a href="contact_us.php">Contact Us</a></li>
</ul>
<div id="form">
<form method="get" action="results.php" enctype="multipart/
form-data">
<input type="text" name="user_query" placeholder="Search
a Product"/ >
<input type="submit" name="search" value="Search" />
</form>
</div>
</div>
<!--Navigation Bar ends-->
E-Commerce Website 52 | P a g e
5.2.2 Cart.php
E-Commerce Website 53 | P a g e
5.2.3 Cart.php
<?php
$new=null;
$total = 0;
global $con;
$ip = getIp();
$sel_price = "select * from cart where ip_add='$ip'";
$run_price = mysqli_query($con, $sel_price);
while($p_price=mysqli_fetch_array($run_price)){
$pro_id = $p_price['p_id'];
$pro_price = "select * from products where product_id='$pro_id'";
$run_pro_price = mysqli_query($con,$pro_price);
while ($pp_price = mysqli_fetch_array($run_pro_price)){
$product_price = array($pp_price['product_price']);
$product_title = $pp_price['product_title'];
$product_image = $pp_price['product_image'];
$single_price = $pp_price['product_price'];
$values = array_sum($product_price);
$total += $values; ?>
<tr align="center">
<td><input type="checkbox" name="remove[]" value="<?php
echo $pro_id;?>"/></td>
<td><?php echo $product_title; ?><br />
<img src="admin_area/product_images/<?php echo
$product_image;?>" width="60" height="60"/></td>
<td><input type="number" size="4" name="qty" min="1" max="10"
value="<?php echo $_SESSION['qty'] ?>"/></td>
<?php
if(isset($_POST['update_cart'])){
$qty = $_POST['qty'];
$update_qty = "update cart set qty='$qty' where
ip_add='$ip'";
$run_qty = mysqli_query($con, $update_qty);
$_SESSION['qty']=$qty;
$total = $total*$qty;
}?>
<td><?php echo "₹" . $single_price; ?></td>
</tr>
<?php } } ?>
<tr><td colspan="4" align="right"><b>Sub Total:</b></td>
<td><?php echo "₹" . $total;?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="update_cart"
value="Update Cart"/></td>
<td><input type="submit" name="continue" value="Continue
Shopping" /></td>
<td><button><a href="checkout.php" style="text-
decoration:none;
color:black;">Checkout</a></button></td>
</tr></table>
</form>
<?php
function updatecart(){
global $con;
$ip = getIp();
if(isset($_POST['update_cart'])){
foreach($_POST['remove'] as $remove_id){
$delete_product = "delete from cart where p_id='$remove_id'
AND ip_add='$ip'";
$run_delete = mysqli_query($con, $delete_product);
if($run_delete){
echo "<script>window.open('cart.php','_self')</script>";
}}}
if(isset($_POST['continue'])){
echo "<script>window.open('index.php','_self')</script>";
}}
echo @$up_cart = updatecart();
?></div>
</div>
</div>
<!--Content wrapper ends-->
<div id="footer">
<h2 style="text-align:center; padding-top:30px;">©
TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->
</body>
</html>
<!DOCTYPE>
<?php
session_start();
include("functions/functions.php");
include("includes/db.php");
?>
<html>
<head>
<title>Raj Electronics</title>
<link rel="stylesheet" href="styles/style.css" media="all" />
</head>
<body>
<!--Main Container starts here-->
<div class="main_wrapper">
<!--Header starts here-->
<div class="header_wrapper">
<a href="index.php"><img id="logo" src="images/logo.gif" /> </a>
<img id="banner" src="images/ad_banner.gif" />
</div>
<!--Header ends here-->
<ul id="menu">
<li><a href="index.php">Home</a></li>
<li><a href="all_products.php">All Products</a></li>
<li><a href="customer/my_account.php">My Account</a></li>
<li><a href="#">Sign Up</a></li>
<li><a href="cart.php">Shopping Cart</a></li>
<li><a href="contact_us.php">Contact Us</a></li>
</ul>
<div id="form">
<form method="get" action="results.php" enctype="multipart/form-data">
<input type="text" name="user_query" placeholder="Search a Product"/ >
<input type="submit" name="search" value="Search" />
</form>
</div>
</div>
<!--Navigation Bar ends-->
</tr>
<tr>
<td align="right">Customer Image:</td>
<td><input type="file" name="c_image" required/></td>
</tr>
<tr>
<td align="right">Customer Country:</td>
<td>
<select name="c_country">
<option>Select a Country</option>
<option>Afghanistan</option>
<option>India</option>
<option>Japan</option>
<option>Pakistan</option>
<option>Israel</option>
<option>Nepal</option>
<option>United Arab Emirates</option>
<option>United States</option>
<option>United Kingdom</option>
</select>
</td></tr><tr>
<td align="right">Customer City:</td>
<td><input type="text" name="c_city" placeholder="Mumbai" required/></td>
</tr><tr>
<td align="right">Customer Contact:</td>
<td><input type="tel" name="c_contact" placeholder="Phone Number"
pattern='^\+?\d{10,13}' title='Minimum 10 Digits'
required/></td></tr> <tr>
<td align="right">Customer Address</td>
<td><input type="text" name="c_address" placeholder="307 Sea Breeze Apt." required/></td>
</tr>
<tr align="center">
<td colspan="6"><input type="submit" name="register" value="Create Account" /></td>
</tr>
</table></form>
</div></div>
<!--Content wrapper ends-->
<div id="footer">
<h2 style="text-align:center; padding-top:30px;">© TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->
</tr><tr>
<td align="right">Customer Image:</td>
<td><input type="file" name="c_image" required/></td>
</tr> <tr>
<td align="right">Customer Country:</td>
<td>
<select name="c_country">
<option>Select a Country</option>
<option>Afghanistan</option>
<option>India</option>
<option>Japan</option>
<option>Pakistan</option>
<option>Israel</option>
<option>Nepal</option>
<option>United Arab Emirates</option>
<option>United States</option>
<option>United Kingdom</option>
</select>
</td></tr><tr>
<td align="right">Customer City:</td>
<td><input type="text" name="c_city" placeholder="Mumbai" required/></td>
</tr><tr>
<td align="right">Customer Contact:</td>
<td><input type="tel" name="c_contact" placeholder="Phone Number"
pattern='^\+?\d{10,13}' title='Minimum 10 Digits'
required/></td>
</tr><tr>
<td align="right">Customer Address</td>
<td><input type="text" name="c_address" placeholder="307 Sea Breeze Apt." required/></td>
</tr>
<tr align="center">
<td colspan="6"><input type="submit" name="register" value="Create Account" /></td>
</tr>
</table></form>
</div></div>
<!--Content wrapper ends-->
<div id="footer">
<h2 style="text-align:center; padding-top:30px;">© TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->
<?php
session_start();
session_destroy();
echo "<script>window.open('index.php','_self')</script>";
?>
In this new age as the nation progresses and use of paper is minimal that's when the
technology hops in and saves the day, as more and more people come online need of online
businesses rises.
Therefore it is safe to conclude that there is a need for such sites helping local businesses
come online and do business and provide quality service to their customers.
7.1 Refernce:
www.w3schools.com/html
www.w3schools.com/css
www.wikipedia.org/wiki/PHP
www.youtube.com
Murach's PHP and MySQL