100% found this document useful (3 votes)
3K views

E-Commerce Website With PHP and Mysql

This document summarizes a project report for an e-commerce website designed and developed by Viraj Janardan Narkar and Brijeshkumar Maggharam Gupta. The report includes sections on requirement gathering, feasibility study, requirement specification, design, implementation, maintenance and evaluation, code samples, and a conclusion. It was submitted in partial fulfillment of the requirements for a Bachelor of Science in Information Technology degree from the University of Mumbai.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
3K views

E-Commerce Website With PHP and Mysql

This document summarizes a project report for an e-commerce website designed and developed by Viraj Janardan Narkar and Brijeshkumar Maggharam Gupta. The report includes sections on requirement gathering, feasibility study, requirement specification, design, implementation, maintenance and evaluation, code samples, and a conclusion. It was submitted in partial fulfillment of the requirements for a Bachelor of Science in Information Technology degree from the University of Mumbai.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

A

PROJECT REPORT

ON

E-Commerce Website

DESIGNED AND DEVELOPED


BY

VIRAJ JANARDAN NARKAR


BRIJESHKUMAR MAGGHARAM GUPTA
THIRD YEAR BACHELOR OF SCIENCE
(INFORMATION TECNOLOGY)

UNDER THE GUIDANCE OF


Mrs. Soma Bera

SUBMITTED IN PARTIAL FULLFILMENT OF THE


REQUIREMENT FOR QUALTIFIACTION
BSC(IT) SEMESTER VI EXAMINATION

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

M.V.M’s Degree College of Commerce &


Science
Affiliated to University of Mumbai
Off Veera Desai Road, Andheri (West)
Mumbai – 400058.

A.Y. 2017 – 2018

Seat No:- ___________

CERTIFICATE

This is to certify that Mr.Viraj Janardan Narkar & Mr.BrijeshMaggharam


Gupta has successfully completed their project entitled E-commerce
Website as a part of the requirement for completing Bachelors Degree in
Information Technology (Sem VI) through our department of Information
Technology for University of Mumbai. It is further certified that they have
completed all required phases of the project satisfactorily.

Ms. Soma Bera Mr. Divyesh Nagrecha Dr. Gopal Kalkoti


Project Guide Co-ordinator B.Sc.I.T. Principal

Internal Examiner Seal External Examiner


Date: Date:
DECLARATION

We, Viraj Janardan Narkar & BrijeshKumar Maggharam Gupta, students


of M.V.M's Degree College of Commerce & Science, T.Y.BScIT. SEMESTER -
VI hereby declare that we have completed our project on "E-commerce
Website" in the Academic Year 2017 - 2018. This information is true and
original to the best of my knowledge.

Date: Signature of Students


ACKNOWLEDGEMENT

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

1 ANALYSIS PHASE 1-10

1.1 Requirement Gathering Phase 1-3


1.1.1 Problem Statement 1
1.1.2 Fact Finding Techniques 1
1.1.3 Project Objective and Scope of Project 2
1.1.4 Problems with Existing System 3
1.1.5 Advantages of Proposed System 3

1.2 Feasibility Study 9-11


1.2.1 Operational Feasibility 4
1.2.2 Technical Feasibility 4
1.2.3 Economic Feasibility 5
1.2.4 Gantt Chart 6

1.3 Requirement Specification 12-13


1.3.1 Functional Requirement 7
1.3.2 Technical Requirement 7
1.3.3 Software Requirement Specification 8

1.4 Tools and Technology 9-10

2 DESIGN PHASE 11-27

2.1 Detailed Life Cycle of Project 11-25


2.1.1 Event Table 11
2.1.2 E-R Diagram 12
2.1.3 List of Tables with Constraints 13-16
2.1.4 Use Case Diagram 17
2.1.5 Class Diagram 18
2.1.6 Activity Diagram 19
2.1.7 Sequence Diagram 20
2.1.8 State Machine Diagram 21-22

E-Commerce Website 4|Page


2.1.9 Component Diagram 23
2.1.10 Deployment Chart 24
2.1.11 Site Map 25

2.2 Physical Design 26-27


2.2 System Flow Chart 26-27

3 IMPLEMENTATION PHASE 28-47

3.1 Screen Layout 28-36


3.2 Report Layout 37-41
3.3 Validations 42-43
3.4 Test Cases 44-47

4 MAINTAINENCE AND EVALUATION 48-49

4.1 System Maintenance and Future Enhancement 48


4.2 User Manual 49

5 CODES 50-60

5.1 Customer_Login.php 50-51


5.2 Cart.php 52-55
5.3 Customer_register.php 56-59
5.4 Logout.php 60

6 CONCLUSION 61

7 ANNEXURE 62

7.1 Reference 62

E-Commerce Website 5|Page


1. ANALYSIS PHASE
1.1 REQUIREMENT GATHERING PHASE
1.1.1 Problem Statement

• Currently the customer is visiting the shop to buy the products.


• The main problem for the customer is that it is a time consuming task to visit the
shop to buy the products.
• Therefore cust om er needs to visit the website, browse for the products of his wish list
and place the order accordingly.

 LIMITATION OF CURRENT SYSTEM IN USE:

 Wastage of time in visiting the shop.


 More efforts to carry the products back to there respective places, if lot of
products have to be buyed.
 Difficult to recollect the products needed.
 More human efforts as all calculation is manually done.

1.1.2 Fact Finding Techniques

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

E-Commerce Website 1|Page


1.1.3 Project Objective and Scope of Project
Project: Project Objective

The main objective behind making this website is increase the business, smarter
and better.

The website meets the following objective that Raj Electronics needs:

• Faster bill and receipt generation(Admin side).


• Cutting time in gathering details of product manually.
• Online bills hence optimizing the use of page(Admin Side).

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.

1.1.5 Advantages of the proposed System


This website that is developed by us is solving all the problems of the shopping and
bill generation. We have also kept many options for future enhancement which will benefit the
shopkeeper and make the process faster.

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.

• We have also conducted an operational feasibility of our system to identify whether


our system is able to satisfy the goal of developing the system.

• 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.

1.2.2 Technical Feasibility:


 Assessing technical feasibility is to evaluate whether the new system will perform
adequately and whether an organization has ability to construct a proposed system or
not. The technical assessment help answer the question such as whether the technology
needed for the system exists, how difficult it will be to build, and whether the firm has
enough experience using that technology.

 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.

1.2.3 Economic Feasibility:

 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:

fig. Gantt Chart

fig. Gantt Chart

E-Commerce Website 6| P a g e
1.3 REQUIREMENT SPECIFICATION

1.3.1 Functional Requirements


The software that we are making has the following functional requirement:
• Functions of Website:
 User can search various products by typing only the keyword
 Handling multiple customers and their accounts.
 User profile customization i.e. by adding his/her profile
photo
• Admin Functionality:
 Add, edit and remove Customer
 Add, edit and remove Users.
 Add, view the products.
• User Functionality:
 View Bill.
 View products and shop for them.

1.3.2 Technical Requirements:

• 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.

E-Commerce Website 7|Page



 RAM required is 2GB.
 Screen resolution should be 1024x768 or more.
 Internet Connection.
 Web browser with latest version or any version that is not old than a year.
 Pen drive or external HDD for safe backup.
 Windows 10,8.1,7 or any higher version.
 Works with both 32bit and 64bit Operating System.
 XAMPP Server
The website will work properly as intended and smoothly only if the
requirements are met or else the software will work but it may lag.

1.3.3 Software Requirement Specification:


Queries
The Raj Electronics Stores is designed with the aim of placing an order from anywhere and
anytime.
• The system is capable to handle more than one customer at a same time once it is online.

• 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

Technologies that we have used in our project are as follows:

• 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 an acronym for "PHP: Hypertext Preprocessor"

 PHP is a server scripting language, and a powerful tool for making dynamic and
interactive Web pages.

 PHP is a widely-used, free, and efficient alternative to competitors such as


Microsoft's ASP.
 PHP is free to download and use

• 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.

E-Commerce Website 10| P a g e


2. DESIGN PHASE
2.1 Detailed Life Cycle of Project

2.1.1 Event table


Sr.No. Event Trigger Source Activity Response Destination
1 Admin Login Admin Checks for Opens the Admin
Login valid Admin
username page if
and successful
password

2 Admin Logout Admin Logout The login Admin


Logout page is
opened.
3 Add Entering Registration Adding new New Admin
customer customer Page Customer customer
details to the gets added
record.

4 Edit Entering Admin Editing/ Admin Admin


Admin adding details get
Admin details admin edited
5 Delete Delete Admin Deleting Deleted Admin
customer customer customer customer

6 Update/Del Entering Admin Adding Product gets Admin


ete/Add Product product added
product details

7 Customer Login Customer Checks for Opens the Customer


login valid email cart process
id and if
password successful

8 Customer Logout Customer Logs out of The main Customer


logout the session homepage
is opened

E-Commerce Website 11| P a g e


2.1.2 E-R Diagram:

fig. E-R Diagram

E-Commerce Website 12| P a g e


2.1.3 List of tables with constraints:
SQL constraints are used to specify rules for the data in a table.

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

fig.Admin Table Structure

Brand

fig. Brand Table Structure

E-Commerce Website 13 | P a g e
Cart

fig. Cart Table Structure

Categories

fig. Categories Table Structure

E-Commerce Website 14| P a g e


Customers

fig. Customers Table Structure

Orders

fig. Orders Table Structure

E-Commerce Website 15| P a g e


Payments

fig. Payments Table Structure

Products

fig. Products Table Structure

E-Commerce Website 16| P a g e


2.1.4 Use Case Diagram:

fig. Use Case Diagram

E-Commerce Website 17| P a g e


2.1.5 Class Diagram:

fig. Class Diagram

E-Commerce Website 18| P a g e


2.1.6 Activity Diagram:

fig. Activity Diagram

E-Commerce Website 19| P a g e


2.1.7 Sequence Diagram:

fig. Sequence Diagram

E-Commerce Website 20 | P a g e
2.1.8 State Machine Diagram (Admin):

fig. State Machine Diagram (Admin)

E-Commerce Website 21| P a g e


2.1.8 State Machine Diagram (Customer):

fig. State Machine Diagram (Customer)

E-Commerce Website 22| P a g e


2.1.9 Component Diagram:

fig. Component Diagram

E-Commerce Website 23 | P a g e
2.1.10 Deployment Chart:

fig. Deployment Chart

E-Commerce Website 24| P a g e


2.1.11 Site Map:

fig. Site Map

E-Commerce Website 25| P a g e


2.2 Physical design
2.2 System flow chart

Admin flow chart:

START

LOGIN

N0
If
Valid

Add/remove

customer

Remove/Upda
te Products

Management

END

fig. Admin Flow Chart

E-Commerce Website 26| P a g e


Customer flow chart:

START

LOGIN

NO
If Valid

Browse for

Products

Add to cart

Order Placed

END

fig. Customer Flow Chart

E-Commerce Website 27| P a g e


3. Implementation Phase
3.1 Screen Layout
Home page

fig. Homepage

fig. Homepage

E-Commerce Website 28 | P a g e
Login page
Customer:

fig. Customer Login

Admin Login

fig. Admin Login

E-Commerce Website 29| P a g e


Registration page
Customer:

fig. Customer Register

fig. Customer Register

E-Commerce Website 30| P a g e


fig. Customer Register

E-Commerce Website 31| P a g e


Contact us

fig. Contact Us

fig. Contact Us

E-Commerce Website 32| P a g e


Category
Example:

fig. Category - Laptops

fig. Category - Mobiles

E-Commerce Website 33| P a g e


Cart

fig. Shopping Cart

fig. Shopping Cart

E-Commerce Website 34 | P a g e
Checkout

fig. Checkout

fig. Payment

E-Commerce Website 35 | P a g e
All Products

fig. All Products

Details

fig. Product Details

E-Commerce Website 36| P a g e


3.2 Report layout
Admin Side

fig. Admin Panel

E-Commerce Website 37 | P a g e
Insert Product

fig. Product Insert

Insert Category

fig. Create Category

E-Commerce Website 38| P a g e


View Categories

fig. View All Categories

Insert new Brand

fig. Insert New Brand

E-Commerce Website 39| P a g e


View brands

fig. View All Brands

View Customers

fig. View All Customers

E-Commerce Website 40| P a g e


View Orders

fig. View All Orders

View Payments

fig. View All Payments

E-Commerce Website 41| P a g e


3.3 Validations
Registration Form

fig. Customer Sign Up Validations

fig. Customer Sign Up Validations

E-Commerce Website 42| P a g e


Login Form

fig. Customer Login Validations

E-Commerce Website 43| P a g e


3.4 TEST CASES
Black Box Testing
Technique: Boundary Value Analysis (BVA)

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

T01.Email Id& 1.Either Email Id It should display It displays Error Pass


password or Password both Error Message Message
Validation wrong. “Password or “Password or
email is incorrect, email is incorrect,
plz try again!”. plz try again!”.
2.Enter null value It should display Itdisplays Error Pass
for Email Id. Error Message Message “Please
“Please fill out fill out this field”.
this field”.

3.Enter null value It should display It displays Error Pass


for Password. Error Message “Please
Message “Please fill out this field”.
fill out this field”.

T02.Submit Click on Submit. It should validate It validates the Pass


the fields and fields and navigate
navigate to proper to proper page.
page.

T04.Don’t have Click on the Should It navigates to Pass


account then link. Navigate to register
please Register register page. page.
yourself.

E-Commerce Website 44| P a g e


Test Cases:2
Identifier: 2
Purpose: Test functionality of Registration form.
Pre-requisite: Appropriate database with sample record should be ready.
Test Input/data:
Test Data/Action Condition Excepted Result Actual Result Remark
Description

T01.Blank form Form should not Form is not Pass


validation be submitted & all submitted & all
the validation the validation
errors are errors are
displayed. displayed.

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”.

2.Enter null value It should display It displays Pass


for last name. error message error message
“Please fill out “Please fill out
this field”. this field”.

3.Enter null value It should display It displays error Pass


for password. error message message
“Please fill out “Please fill out
this field”. this field”.

4.Enter null value It should display It displays Pass


for contact no. error message error message
“Please fill out “Please fill out
this field". this field”.

5.Enter null value It should display It displays Pass


for Email Id. error message error message
“Please fill out “Please fill out
this field”. this field”.

6.Enter null value It should display It displays Pass


for address. error message error message
“Please fill out Please fill out
this field”. this field”.

E-Commerce Website 45| P a g e


T03.Contact no Contact no field It should It displays Pass
validation. should have display error error message
only 10 or 13 message “Please match the
digits. “Please match the requested format:
requested format: Minimum 10
Minimum 10 digits”.
digits”.
T05.Email Id 1.Invalid Email It should display It displays error Pass
validation Id format error message message "Please
“Please Enter an enter an email
email address". address".

T06.Submit Click on Submit. It should validate It validates the Pass


the fields and fields and
navigate to proper navigate to proper
page. page.

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

T01.click on - Should display It displays Home Pass


Home home page page
page hyperlink
menu
T02.click - Should It displays all Pass
on All Products display all products page
us page products page
hyperlink menu
T03.click - Should It displays Pass
on My Account display My My Account
page hyperlink Account page page
menu
T04.click on - Should display It displays all Pass
Brands all Brands Brands
page hyperlink
menus
T05.click on - Should display It displays Pass
Contact us page Contact us page Contact us page
hyperlink menu

T06.click on Cart - Should display It displays Cart Pass


page hyperlink Cart page page
menu

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.

T02.Products Click on checkout It should go to It goes to the Pass


with total button. the Paypal Paypal checkout
amount, cost. checkout page. page.

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:

 Fixing bugs if at all anything found during actual working.


 Any minor changes that is required when the client working with it will be done.
 Periodic checking of website at regular intervals.
 Make better use of existing tools and techniques.
 Online technical support at any instance of time.
Future Enhancement:
Nothing can be ended in a single step. It is the fact that nothing is permanent in this world. So
this project also has some future enhancements in the evergreen and booming IT industry.
Further enhancement of the software will have the following features:
• Bill generation will be incorporated which will keep track of all the expense, income
obtained each month and many more.
• A web application will be developed that will make bill generation faster and on the
go. Customer will not have to visit the shop personally.

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.

How to view an order of the customer?

1. Go to the admin page and login with credentials.


2. There you will find a menu bar that displays view order.
3. Click on it.
4. And click on complete button according to admin wishes.

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>

E-Commerce Website 50| P a g e


5.1.2 Customer_login.php

<?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;

echo "<script>alert('You logged in successfully, Thanks!')</script>";


echo "<script>window.open('checkout.php','_self')</script>";

}}
?>
</div>

E-Commerce Website 51| P a g e


5.2.1 Cart.php

<!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-->
<!--Navigation Bar starts-->
<div class="menubar">

<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

<!--Content wrapper starts-->


<div class="content_wrapper">
<div id="sidebar">
<div id="sidebar_title">Categories</div>
<ul id="cats">
<?php getCats(); ?>
</ul>
<div id="sidebar_title">Brands</div>
<ul id="cats">
<?php getBrands(); ?>
</ul></div>
<div id="content_area">
<?php cart(); ?>
<div id="shopping_cart">
<span style="float:right; font-size:17px; padding:5px;
line-height:40px;">
<?php
if(isset($_SESSION['customer_email'])){
echo "<b>Welcome:</b>" . $_SESSION['customer_email'] .
"<b style='color:yellow;'>Your</b>" ;
}
else {
echo "<b>Welcome Guest:</b>";
}
?>
<b style="color:yellow">Shopping Cart -</b> Total Items:
<?php total_items();?> Total Price: <?php total_price(); ?>
<a href="index.php" style="color:yellow">Back to Shop</a>
<?php
if(!isset($_SESSION['customer_email'])){
echo "<a href='checkout.php' style='color:orange;'>Login</a>";
}
else {
echo "<a href='logout.php' style='color:orange;'>Logout</a>";
}
?></span></div>
<div id="products_box">
<form action="" method="post" enctype="multipart/form-data">
<table align="center" width="700" bgcolor="skyblue">
<tr align="center">
<th>Remove</th>
<th>Product(S)</th>
<th>Quantity</th>
<th>Total Price</th>
</tr>

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 "&#8377;" . $single_price; ?></td>
</tr>

E-Commerce Website 54| P a g e


5.2.4 Cart.php

<?php } } ?>
<tr><td colspan="4" align="right"><b>Sub Total:</b></td>
<td><?php echo "&#8377;" . $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;">&copy;
TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->
</body>
</html>

E-Commerce Website 55| P a g e


5.3.1 Customer_register.php

<!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-->

<!--Navigation Bar starts-->


<div class="menubar">

<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-->

E-Commerce Website 56| P a g e


5.3.2 Customer_register.php

<!--Content wrapper starts-->


<div class="content_wrapper">
<div id="sidebar"><div id="sidebar_title">Categories</div>
<ul id="cats">
<?php getCats(); ?></ul>
<div id="sidebar_title">Brands</div>
<ul id="cats">
<?php getBrands(); ?> </ul>
</div>
<div id="content_area">
<?php cart(); ?>
<div id="shopping_cart">
<span style="float:right; font-size:18px; padding:5px; line-height:40px;">
Welcome Guest! <b style="color:yellow">Shopping Cart -</b> Total Items:
<?php total_items();?> Total Price: <?php total_price(); ?>
<a href="cart.php" style="color:yellow">Go to Cart</a>
</span>
</div>
<form action="customer_register.php" method="post" enctype="multipart/form-data">
<table align="center" width="750">
<tr align="center">
<td colspan="6"><h2>Create an Account</h2></td>
</tr><tr>
<td align="right">Customer Name:</td>
<td><input type="text" name="c_name" placeholder="Viraj Narkar"required/></td>
</tr><tr>
<td align="right">Customer Email:</td>
<td><input type="email" name="c_email" placeholder="[email protected]"required/></td>
</tr><tr>
<td align="right">Customer Password:</td>
<td><input type="password" name="c_pass" pattern=".{8,}" placeholder="viraj@345"
title="Must contain at least 8 or more characters"
required/></td>

E-Commerce Website 57| P a g e


5.3.3 Customer_register.php

</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;">&copy; TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->

E-Commerce Website 58| P a g e


5.3.4 Customer_register.php

</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;">&copy; TYBSc.IT batch 2017-18</h2>
</div></div>
<!--Main Container ends here-->

E-Commerce Website 59| P a g e


5.4 logout.php

<?php

session_start();

session_destroy();

echo "<script>window.open('index.php','_self')</script>";

?>

E-Commerce Website 60| P a g e


6. Conclusion

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.

E-Commerce Website 61| P a g e


7. ANNEXURE

7.1 Refernce:
www.w3schools.com/html
www.w3schools.com/css
www.wikipedia.org/wiki/PHP
www.youtube.com
Murach's PHP and MySQL

E-Commerce Website 62| P a g e

You might also like