Design and Implementation of An Online Farm Marketing System

You might also like

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

CHAPTER ONE

INTRODUCTION

1.1 Background of the Study

Agriculture sector in Nigeria is considered a major contributor to economic growth

and development. This sector not only meets food demands of population but also

provides raw material for industry besides providing surplus for exports. Despite

the face this sector has witnessed many high points and low points in recent years,

overall growth has remained satisfactory. This sector has a proven great potential

to support the nation’s economy both now and in the future if due consideration is

given to solve rising issues. Reasonable agriculture growth and improvement rely

on how concerns various partners particularly farmers who are facing several risks

in farm production and marketing of their farm produce, are adequately addressed

(Mawazo, Michael & ko, 2014). Regularly, farmers need to bear value reduction in

their produce due to poor infrastructure and post-harvest practices. Moreover,

frequent food surpluses and deficiencies have featured the need to modernize

marketing system framework so that goal situations can be handled. Marketing can

be defined and comprehended in various ways but commonly it is recognized as a

place or areas where buyers and sellers gather and interact for buying and selling

goods and services (Shepherd & Schalke, 2015).


Many other scholars has described marketing as an exchange process of goods and

services accompanied by price making mechanism. Agricultural markets play a

central role of assembling rural agricultural produce from scattered and vast

production areas and distribute these commodities further to consumers and other

stakeholders in urban and peri-urban areas (Rai et al., 2014). Agricultural

marketing most times encompasses activities which may be picking/harvesting,

drying, cleaning, sorting, grading, processing, packaging, labeling, transporting,

storage, promotion and sale of agricultural products (Metkewar & Acharya, 2016).

All these major activities contribute in adding value to agricultural products as

these products flow from farm producers to consumers. While some of these major

activities are performed on farmers’ farm, the others are carried out off-farm by

other market intermediaries such as traders and agro-processors.

1.2     Statement of the Problem

Agricultural farm products differ from industrial products due to their perishable

nature and special requirements during various harvesting process and

transportation operations. There is a need to design a farm product marking system

to aid in displaying farm produce from farmers across the country to meet major

stakeholders in need of this farm products. This will assist in growing the economy

of the country when international investors invest in the farm produce seen on the

marketing system. Furthermore, agricultural marketing includes all business


activities designed to plan, price, promote and distribute want satisfying goods and

services to household consumers and industrial users.

This research work was undertaken to solve the various challenges encounter in

showcasing and delivering goods and services to different client around the globe.

Where every business transaction involve an on presence for transaction to be

successfully executed. Most shops are experienced some draw back in their

operation due to the current shopping system (manual shopping) which are:

i. Lack of accuracy in customer’s record

ii. Slow in processing customer’s records

iii. Lack of proper accountability

iv. It does not give a customer the incredible convenience to shop at any time of

the day due to the limited working hours.

There is a need to change from manual way of shopping to a computerized way,

where customers can browse through the

Internet and the system administrator to approve requests shoppers can buy

products anywhere and a database that will maintain the products detail

information.
1.3 Objective of the Study

The main aim and object of this study is to design and implement an online farm

marketing system. The following are the objectives of the study.

i. To design and implement a Farm Product Marketing system to aid farmers

in rural areas have a proper platform to promote their farm product.

ii. Enhance link between Farmers and end product users in urban areas

iii. Ease the distribution of farm products across the country through

technology.

iv. Display goods and services in the store

v. Automate every sales effectively without mixing product prizes

vi. Store product detail using a secure database.

1.4 Significance of the Study

Agriculture is a well-organized and vibrate sector in Africa, it contributes

significantly to the growth of any economy. It also provides employment to over

1.5 million people. Recently, this sector has shown 8 to 10 percent growth rate per

annum due to rising demand of various agricultural products. It is observed that an

agricultural commodity changes seven to eight different hands before reaching

ultimate consumers. Functions performed by various market bodies (especially the

middlemen in the market chain) remain one of the most controversial issues in
Africa’s agricultural economy. It is argued that middlemen exploit marginal

farmers and hamper their legitimate share which can be solved with the use of

technology to link farmers directly to buyers.

1.5 Scope of the Study

This research work scope is to develop a system capable of handling sales by

automating in itself a cart system that stores all sales details prior to when the user

request close the sales service.

i. The system will also incorporate in its design a billing system that will

display the total sales and product at the close of each transaction.

ii. The system will not incorporate in its development all the functions of a

functional business activities system but will focus only on the

aforementioned functionalities. The system will not be responsible for any

loss of data if its environment (network/system installed on) is corrupt.

1.6 Limitations of the Study

Usually, every work has some limitations and this study is not exempted. The two

major limitations of this study are the high programming technique as well as

financial constraints. The high programming technique constraint in PHP,

JQUERY and MYSQL prevents the researcher to have an in depth study and

analysis on the subject matter. While the issue of financial constraint limits the
frequency of investigation to/from the institution toward gathering the necessary

information relevant for the study.

1.7 Definition of Terms

Farmer – a person who owns or manages a farm

Market - a regular gathering of people for the purchase and sale of provisions,

livestock, and other commodities. A regular gathering of people for the purchase

and sale of provisions: livestock, and other

Agriculture – a regular gathering of people for the purchase and sale of

provisions: livestock, and other commodities.

Online - An online is a condition of connected to a network of computers of other

devices. The term is frequently used to describe someone who is currently

connected to the internet.

Internet - this is a global connection of computer network co-operating with each

other to exchange data using common software standard protocols

Database: A systematized collection of data that can be access immediately and

manipulated by a data processing system for a specific purpose

E-Commerce: Electronic commerce refers to the process of marketing, buying and

selling of product and services online.


CHAPTER THREE

SYSTEM ANALYSIS AND DESIGN

3.1 Methodology

Methodology is defined as a framework that is used to structure, plan, and control

the process of developing an information system. It is used to refer to a specific

series of steps, methods, techniques and procedures which governs the collection,

analysis and design of a particular project. In the dynamic world, the subject

methodology, system analysis and design mainly deal with the software

development activities (Uba, 2011).

A design methodology is a systematic programming approach of well-defined

procedure that should be followed in carrying out a thorough design project or

defined as the analysis of the principles of methods, rules and postulates employed

by a discipline. An adequately suitable methodology would ensure a very detailed

design work and ensure that a higher degree of accuracy and efficiency is adopted.

The design methodology used helps to ensure that a thorough study of the present

system is carried out, thus helping the project designer to completely understand

the modus operandi of the present existing system so as to know how the new

system should be structured and the functionalities needed in it to address the

seemingly, existing problems discovered. This helps to know if there should be a


perfective maintenance of the existing system or if only improvement (preventive

maintenance) should be made.

3.1.1 Choice of Methodology

The System will adopt the object oriented approach to system design, which has

enormous benefits. It is an evolutionary and iterative process that encompasses

abstractions of the system attributes and behaviours using necessary tools such as

Unified Modeling language (UML).

Object oriented analysis and design methodology is used to analyze the present

system as well as to design the proposed system with the primary aim of;

1. Identifying the problems inherent in the present system.

2. Investigating the causes of these problems

3. Proffering solutions to the manual systems

3.1.2 Justification of Methodology

1. It speeds up application development and requires less programming efforts.

2. Modules created in OOP can be re-used in other programs.

3. Programs can be modified by adding or removing modules.


The Object-Oriented Analysis and Design Methodology (OOADM) perform four

major activities namely:

1. Modeling the functional description of the system. To achieve this the

following steps has to be taken:

a) Identifying all actors and use cases

b) Construct a use case model

c) Document use case course of events

d) Define the analysis use case.

2. Finding and identifying business objects. To achieve this task, the steps

given below must be accomplished.

a) Review each use case to find potential objects (which are usually noun

corresponding to business entities or events)

b) Select the proposed objects.

3. Organizing the objects and identifying their relationships. To achieve this

task, the steps given below must be accomplished.

a) Identify associations and multiplicity

b) Identify generalization/specification relationships


c) Identify aggregation relationships

d) Prepare class diagram.

4. Model the behavior of each object using state chart diagram. MrsEze, u.f

(2008).

3.2 Method of Data Collection

During the course of this study, the researcher applied different method of finding

fact. The methods include.

3.1.1 Interview

The researcher visited the human resource (HR) unit of the college and other firms

to find out about the processes involved in job vacancies/recruitment management,

random job seekers were also interviewed. The facts and answers incurred from the

discussion made it possible for the researcher to begin the design of the

computerized system.

3.2.2 References to Written Document and Manual

The researcher visited some libraries and made references to already written

document for more details concerning this study. To this effect, the fact provided

by the referenced materials made it possible for the completion of the project.
3.2.3 Internet

Other relevant materials needed for the completion of this project work were

gotten from the internet through search engines like google, dock-dock-go, etc.

3.3 Analysis of the Existing System

During the feasibility study, we realized that most farmers are operating on manual

(offline) method of marketing their produce which involve going to the local

markets and display their produce in order to be purchased which consumes a lot

of time and strength before the customer will search for the goods needed. These

results in some problems like;

 Slow in processing customer’s information

 Data inconsistency/ Redundancy

 Inaccurate during customers transaction

3.4 Analysis of Proposed System

Analysis is an integral part of the development cycle of any system. The proposed

new system will make use of files and records in table’s prepared using database to

store information about everyday marketing and transaction of agricultural farm

produce based on web technologies. Having analysed the existing system, there is
need for an alternative system; the proposed system (online farm marketing

system) will eliminate the problems experienced in the existing system.

The proposed new system is design to enhance the following:

 Convenience

 Consistency of Data

 Reliability

 Increases Productivity

 Easy update and Maintenance Operations

 Variety

 Speed Optimization and reduce paper work

3.5 Problem of the Existing System

The constraints discovered in the existing system during the course of carrying out

this research work are as follows:

 It involve a lot of paper work during transaction

 Inadequate of accuracy in customer’s records

 It is inefficient, tedious and time consuming


 Customers must carry what they brought

3.6 Justification of the New System

The main reason the new system is being designed is to switch over from offline

farm marketing system (manual) to the online farm marketing system

(Computerized) so as to enhance easy, fast and convenience marketing and

shopping rather than having to visit a local market or be on a queue during

purchase and sale of farm produce. This new system will be designed using

HTML, CSS, Javascript, PHP, and MySQL such that it will enhance link to

database and other advantages like;

 It gives access for creating a database file structure for storing and retrieval

of information.

 It has enough tools and approaches for data management.


3.7 System Flowchart

Online Farm
Market
Homepage
CHAPTER FOUR

SYSTEM IMPLEMENTATION, TESTING AND INTEGRATION

Before implementing the actual design of the project, a few user interface designs

were constructed to visualize the user interaction with the system as they browse

for products, create a shopping cart and purchase products.

4.1 System Implementation

The objective of this project is to develop an automated billing and customer

feedback system for a boutique. When the user types in the URL of the online store

in the address field of the browser, a Web Server is contacted to get the requested

information, Apache Server acts as the Web Server. The sole task of a Web Server

is to accept incoming HTTP requests and to return the requested resource in an

HTTP response. The first thing Apache does when a request comes in is to decide

how to handle the request. Its decision is based upon the requested file's extension.

For example, if the requested file has the .php extension, Apache will route the

request to be handled by PHP engine

The PHP Engine then gets the requested file, and if necessary, contacts the

database through MySQL for the required file and then the information is sent back

to the Client’s browser.


Customers ordering from an e-commerce website need to be able to get

information about a vendor’s products and services, ask questions, select items

they wish to purchase, and submit payment information. Vendors need to be able

to track customer inquiries and preferences and process their orders. So, a well-

organized database is essential for the development and maintenance of an e-

commerce site

In a static Web page, content is determined at the time when the page is created.

As users access a static page, the page always displays the same information.

Example of a static Web page is the page displaying company information. In a

dynamic Web page, content varies based on user input and data received from

external sources. We use the term “data-based Web pages” to refer to dynamic

Web pages deriving some or all of their content from data files or databases.

A data-based Web page is requested when a user clicks a hyperlink or the submit

button on a Web page form. If the request comes from clicking a hyperlink, the

link specifies either a Web server program or a Web page that calls a Web server

program. In some cases, the program performs a static query, such as “Display all

items from the Inventory”. Although this query requires no user input, the results

vary depending on when the query is made. If the request is generated when the

user clicks a form’s submit button, instead of a hyperlink, the Web server program

typically uses the form inputs to create a query. For example, the user might select
five products to be purchased and then submit the input to the Web server program.

The Web server program then services the order, generating a dynamic Web page

response to confirm the transaction. In either case, the Web server is responsible

for formatting the query results by adding HTML tags. The Web server program

then sends the program’s output back to the client’s browser as a Web page.

4.2 Input Specification and Design

The input interface presents a form with text, label and command buttons. The text

boxes allow users to type in text while the command button is used to initiate

events that execute some server/client site codes. In designing the input interface,

of which the input form is one, a data structure that binds the input data to a table

was drawn. The binding was done by simply using the form objects to relate the

respective fields as contained in the database design. The sample input form

realized after the design is as shown below:


Fig 4.1 Registration form

4.3 Output Specification and Design

The output is rendered mostly on the screen. In other words, all outputs from this

system is only presented to the screen, the specification was designed in such a

way that they give good representation on the computer screen. The output format

is basically the report form. It displays the list of all items in the shopping cart and

their prices. Below is a sample of the form:

Fig 4.2 Typical Report from the system


4.4 File Design

The diagram below depicts the file designs that make up the system and the

relationship between them

Client Register

View Farm Authentication


Produce
Registered
Customer

Identity
Make Purchase Provider
Web Customer

Credit
Checkout payment
New Customer service

PayPal
4.5 Database Design

In this section, the basic structure of the tables composing the database for the

project are shown along with information about primary and foreign keys.

Table 4.1 Customer Database Structure

S/NO NAME DATA TYPE DESCRIPTION


1 UserID Varchar Primary key for Customer
identification
2 Password Varchar Security for Customer
3 First_Name Varchar
4 Last_Name Varchar
5 Address Varchar
6 City Varchar
7 State Varchar
8 Email Address Varchar
9 Phone_Number Integer

Table 4.2 Shipping Type

S/NO NAME DATA TYPE DESCRIPTION


1 Type of Shipping Varchar Primary key to define type
of shipping
2 Price Double
3 Approximate days Integer for delivery
Table 4.3 Order Details
S/NO NAME DATA TYPE DESCRIPTION
1 OrderID Integer Primary key for Order
identification
2 UserID Char Foreign key to Customer
3 Receiver’s Name Char If order is to be sent to
other address rather than
to the customer, we need
that address
4 Address Char
5 City Char
6 Zip Integer
7 State Char Foreign key to State Tax
8 Type of Shipping Char Foreign key to Shipping
Type
9 Date of Purchase Date

4.6 Justification of Programming Language Used

The researcher will be talking about the system platform used, IDE (integrated

development environment) used and programming language used.

The system platform used is windows 10. Also the IDE (integrated development

environment) used is Sublime text 3 the latest version and the programming

language used is PHP previously known as personal home page. PHP was created

by RasmusLerdorf in 1994 and publicly released in June 8, 1995and was known as

Hypertext Preprocessor. PHP is a server-side interpreted scripting language

designed for creating dynamic web pages and web pages that effectively work with

databases.
Several reasons ride the choice of using PHP for this system, one of which is its

extensive portability and use over several web host servers on the internet. Also

PHP possesses several inbuilt functions which allow it to integrate well with the

widely used and accepted database storage management system for the web-

MySQL. Due to its wide use, several documentations are available online which

will guarantee that materials about any aspect of its use will be easily found.
4.7 System Requirements

Table 4.3 Description of Hardware Requirements

Number Description

1 PC with 2 GB hard-disk

and 256 MB RAM

Table 4.4 Description of Software Requirements

Number Description

1 Windows 2000/ XP/ or Higher

with MS-office

2. Xampp or wampp server

3. Ms-Internet Explorer, Mozilla

Firefox, Google Chrome, Safari.


4.8 System Testing and Integration

Transactions in the Application

A transaction is a group of database commands that are treated as a single unit.

Transaction must pass what is known as the ACID test:

Atomic: All operations in the transaction are executed properly. In other words,

they make up a single unit of work. For example, if a customer moves and a

transaction is used to reflect that change in the database, all parts of the address

(street, city, state, etc) must be changed as an atomic action, rather than changing

street, then city, then state, and so on.

Consistent: The execution of a single transaction preserves the consistency of the

database. All the relationships between data in a database are maintained correctly.

For example, if customer information uses a tax rate from a state tax table, the state

entered for the customer must exist in the state tax table.

Isolation: Each transaction is unaware of the other transactions occurring

concurrently. Changes made by other clients cannot affect the current changes. For

example, if two data entry operators try to make a change to the same customer at

the same time, one of two things occurs: either one operator's changes are accepted

and the other is notified that the changes were not made, or both operators are
notified that their changes were not made. In either case, the customer data is not

left in an indeterminate state.

Durability: Changes the transaction has performed persist in the database. Once a

change is made, it is permanent. If a system error or power failure occurs before a

set of commands is complete, those commands are undone and the data is restored

to its original state once the system begins running again.

Transaction processing is particularly important for Web applications that use data

access, since Web applications are distributed among many different clients. In a

Web application, databases are a shared resource, and having many different

clients distributed over a wide area can present these key problems:

 Contention for resources. Several clients might try to change the same

record at the same time. This problem gets worse the more clients you have.

 Unexpected failures. The Internet is not the most reliable network, even if

your Web application and Web server are 100 percent reliable. Clients can

be unexpectedly disconnected by their service providers, by their modems,

or by power failures.

 Web application life cycle. Web applications do not follow the same life

cycle as Windows applications —Web forms live for only an instant, and a
client can leave your application at any point by simply typing a new

address in their browser.

Transaction processing follows these steps:

1. Begin a transaction.

2. Process database commands.

3. Check for errors.

4. If errors occurred, restore the database to its state at the beginning of the

transaction. If no errors occurred, commit the transaction to the database.

Suppose two users try to add the same product to the shopping cart and try to place

an order at the exact same time. An update should be done to the Products table

after the order is placed, but if only the latest transaction is noted down, the

product quantity will differ in the real world. This situation has to be handled as in

a “Transaction”. As detailed earlier, a transaction is an operation or set of

operations that succeeds or fails as a logical unit. That is, either both the updates

are not done, or both the updates are done consecutively.


APPENDIX I

PROGRAM INTERFACES
APPENDIX II

PROGRAM SOURCE CODE

<?php require_once('./config.php'); ?>

<!DOCTYPE html>

<html lang="en" class="" style="height: auto;">

<style>

#header{

height:70vh;

width:calc(100%);

position:relative;

top:-1em;

#header:before{

content:"";

position:absolute;

height:calc(100%);

width:calc(100%);

background-image:url(<?= validate_image($_settings->info("cover")) ?>);

background-size:cover;

background-repeat:no-repeat;

background-position: center center;

}
#header>div{

position:absolute;

height:calc(100%);

width:calc(100%);

z-index:2;

#top-Nav a.nav-link.active {

color: #343a40;

font-weight: 900;

position: relative;

#top-Nav a.nav-link.active:before {

content: "";

position: absolute;

border-bottom: 2px solid #343a40;

width: 33.33%;

left: 33.33%;

bottom: 0;

@media (max-width:760px){

#top-Nav a.nav-link.active {

background: #343a40db;
color: #fff;

#top-Nav a.nav-link.active:before {

content: "";

position: absolute;

border-bottom: 2px solid #343a40;

width: 100%;

left: 0;

bottom: 0;

h1.w-100.text-center.site-title.px-5{

font-size:2.5em !important;

</style>

<?php require_once('inc/header.php') ?>

<body class="layout-top-nav layout-fixed layout-navbar-fixed" style="height:


auto;">

<div class="wrapper">

<?php $page = isset($_GET['page']) ? $_GET['page'] : 'home'; ?>

<?php require_once('inc/topBarNav.php') ?>

<?php if($_settings->chk_flashdata('success')): ?>

<script>
alert_toast("<?php echo $_settings->flashdata('success') ?>",'success')

</script>

<?php endif;?>

<!-- Content Wrapper. Contains page content -->

<div class="content-wrapper pt-5" style="">

<?php if($page == "home" || $page == "about"): ?>

<div id="header" class="shadow mb-4">

<div class="d-flex justify-content-center h-100 w-100 align-items-center


flex-column px-3">

<h1 class="w-100 text-center site-title px-5"><?php echo $_settings-


>info('name') ?></h1>

<!-- <h3 class="w-100 text-center px-5 site-subtitle"><?php echo


$_settings->info('name') ?></h3> -->

</div>

</div>

<?php endif; ?>

<!-- Main content -->

<section class="content ">

<div class="container">

<?php

if(!file_exists($page.".php") && !is_dir($page)){

include '404.html';

}else{

if(is_dir($page))
include $page.'/index.php';

else

include $page.'.php';

?>

</div>

</section>

<!-- /.content -->

<div class="modal fade rounded-0" id="uni_modal" role='dialog'>

<div class="modal-dialog modal-md modal-dialog-centered rounded-0"


role="document">

<div class="modal-content rounded-0">

<div class="modal-header rounded-0">

<h5 class="modal-title"></h5>

</div>

<div class="modal-body rounded-0">

</div>

<div class="modal-footer">

<button type="button" class="btn btn-primary" id='submit' onclick="$


('#uni_modal form').submit()">Save</button>

<button type="button" class="btn btn-secondary" data-


dismiss="modal">Cancel</button>

</div>
</div>

</div>

</div>

<div class="modal fade rounded-0" id="confirm_modal" role='dialog'>

<div class="modal-dialog modal-md modal-dialog-centered" role="document">

<div class="modal-content">

<div class="modal-header rounded-0">

<h5 class="modal-title">Confirmation</h5>

</div>

<div class="modal-body rounded-0">

<div id="delete_content"></div>

</div>

<div class="modal-footer">

<button type="button" class="btn btn-primary" id='confirm'


onclick="">Continue</button>

<button type="button" class="btn btn-secondary" data-


dismiss="modal">Close</button>

</div>

</div>

</div>

</div>

<div class="modal fade rounded-0" id="uni_modal_right" role='dialog'>

<div class="modal-dialog modal-full-height modal-md" role="document">

<div class="modal-content">
<div class="modal-header rounded-0">

<h5 class="modal-title"></h5>

<button type="button" class="close" data-dismiss="modal" aria-


label="Close">

<span class="fa fa-arrow-right"></span>

</button>

</div>

<div class="modal-body rounded-0">

</div>

</div>

</div>

</div>

<div class="modal fade" id="viewer_modal" role='dialog'>

<div class="modal-dialog modal-md" role="document">

<div class="modal-content">

<button type="button" class="btn-close" data-dismiss="modal"><span


class="fa fa-times"></span></button>

<img src="" alt="">

</div>

</div>

</div>

</div>

<!-- /.content-wrapper -->

<?php require_once('inc/footer.php') ?>


</body>

</html>

<?php require_once('./config.php') ?>

<!DOCTYPE html>

<html lang="en" class="" style="height: auto;">

<?php require_once('inc/header.php') ?>

<body class="hold-transition login-page">

<script>

start_loader()

</script>

<style>

body{

width:calc(100%);

height:calc(100%);

background-image:url('<?= validate_image($_settings->info('cover')) ?>');

background-repeat: no-repeat;

background-size:cover;

#logo-img{

width:15em;

height:15em;

object-fit:scale-down;

object-position:center center;
}

#system_name{

color:#fff;

text-shadow: 3px 3px 3px #000;

</style>

<?php if($_settings->chk_flashdata('success')): ?>

<script>

alert_toast("<?php echo $_settings->flashdata('success') ?>",'success')

</script>

<?php endif;?>

<center><img src="<?= validate_image($_settings->info('logo')) ?>" alt="System


Logo" class="img-thumbnail rounded-circle" id="logo-img"></center>

<h1 class="text-center" id="system_name"><?= $_settings->info('name') ?></h1>

<div class="clear-fix my-2"></div>

<div class="login-box">

<!-- /.login-logo -->

<div class="card card-outline card-primary">

<div class="card-header text-center">

<a href="./login.php" class="h1 text-decoration-none"><b>Client


Login</b></a>

</div>

<div class="card-body">
<p class="login-box-msg">Sign in to start your session</p>

<form id="cclogin-frm" action="" method="post">

<div class="input-group mb-3">

<input type="email" class="form-control" name="email" autofocus


placeholder="Email">

<div class="input-group-append">

<div class="input-group-text">

<span class="fas fa-user"></span>

</div>

</div>

</div>

<div class="input-group mb-3">

<input type="password" class="form-control" name="password"


placeholder="Password">

<div class="input-group-append">

<div class="input-group-text">

<span class="fas fa-lock"></span>

</div>

</div>

</div>

<div class="row align-item-end">

<div class="col-8">

<a href="<?= base_url ?>">Back to Site</a>


</div>

<!-- /.col -->

<div class="col-4">

<button type="submit" class="btn btn-primary btn-block btn-flat">Sign


In</button>

</div>

<div class="col-12 text-center">

<a href="<?= base_url.'./register.php' ?>">Create an Account</a>

</div>

<!-- /.col -->

</div>

</form>

<!-- /.social-auth-links -->

<!-- <p class="mb-1">

<a href="forgot-password.html">I forgot my password</a>

</p> -->

</div>

<!-- /.card-body -->

</div>

<!-- /.card -->

</div>

<!-- /.login-box -->


<!-- jQuery -->

<script src="plugins/jquery/jquery.min.js"></script>

<!-- Bootstrap 4 -->

<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- AdminLTE App -->

<script src="dist/js/adminlte.min.js"></script>

<script>

$(function(){

end_loader();

$('#cclogin-frm').submit(function(e){

e.preventDefault();

var _this = $(this)

$('.err-msg').remove();

var el = $('<div>')

el.addClass("alert err-msg")

el.hide()

if(_this[0].checkValidity() == false){

_this[0].reportValidity();

return false;

start_loader();
$.ajax({

url:_base_url_+"classes/Login.php?f=login_client",

data: new FormData($(this)[0]),

cache: false,

contentType: false,

processData: false,

method: 'POST',

type: 'POST',

dataType: 'json',

error:err=>{

console.error(err)

el.addClass('alert-danger').text("An error occured");

_this.prepend(el)

el.show('.modal')

end_loader();

},

success:function(resp){

if(typeof resp =='object' && resp.status == 'success'){

location.href= './';

}else if(resp.status == 'failed' && !!resp.msg){

el.addClass('alert-danger').text(resp.msg);

_this.prepend(el)

el.show('.modal')
}else{

el.text("An error occured");

console.error(resp)

$("html, body").scrollTop(0);

end_loader()

})

})

})

</script>

</body>

</html>

<style>

</style>

<div class="col-lg-12 py-5">

<div class="contain-fluid">

<div class="card card-outline card-dark shadow rounded-0">

<div class="card-body rounded-0">

<div class="container-fluid">

<h3 class="text-center">Welcome</h3>
<hr>

<div class="welcome-content">

<?php include("welcome.html") ?>

</div>

</div>

</div>

</div>

<div class="clear-fix mb-3"></div>

<h3 class="text-center"><b>Products</b></h3>

<center><hr class="w-25"></center>

<div class="row" id="product_list">

<?php

$products = $conn->query("SELECT p.*, v.shop_name as vendor, c.name


as `category` FROM `product_list` p inner join vendor_list v on p.vendor_id = v.id
inner join category_list c on p.category_id = c.id where p.delete_flag = 0 and
p.`status` =1 order by RAND() limit 4");

while($row = $products->fetch_assoc()):

?>

<div class="col-lg-3 col-md-6 col-sm-12 product-item">

<a href="./?page=products/view_product&id=<?= $row['id'] ?>"


class="card shadow rounded-0 text-reset text-decoration-none">

<div class="product-img-holder position-relative">

<img src="<?= validate_image($row['image_path']) ?>" alt="Product-


image" class="img-top product-img bg-gradient-gray">

</div>
<div class="card-body border-top border-gray">

<h5 class="card-title text-truncate w-100"><?= $row['name']


?></h5>

<div class="d-flex w-100">

<div class="col-auto px-0"><small class="text-muted">Vendor:


</small></div>

<div class="col-auto px-0 flex-shrink-1 flex-grow-1"><p


class="text-truncate m-0"><small class="text-muted"><?= $row['vendor']
?></small></p></div>

</div>

<div class="d-flex">

<div class="col-auto px-0"><small class="text-


muted">Category: </small></div>

<div class="col-auto px-0 flex-shrink-1 flex-grow-1"><p


class="text-truncate m-0"><small class="text-muted"><?= $row['category']
?></small></p></div>

</div>

<div class="d-flex">

<div class="col-auto px-0"><small class="text-muted">Price:


</small></div>

<div class="col-auto px-0 flex-shrink-1 flex-grow-1"><p


class="m-0 pl-3"><small class="text-primary"><?= format_num($row['price']) ?
></small></p></div>

</div>

<p class="card-text truncate-3 w-100"><?=


strip_tags(html_entity_decode($row['description'])) ?></p>

</div>

</a>
</div>

<?php endwhile; ?>

</div>

<div class="clear-fix mb-2"></div>

<div class="text-center">

<a href="./?page=products" class="btn btn-large btn-primary rounded-pill


col-lg-3 col-md-5 col-sm-12">Explore More Products</a>

</div>

</div>

</div>

<div class="content py-3">

<div class="card rounded-0 card-outline card-navy shadow" >

<div class="card-body rounded-0">

<h2 class="text-center">About</h2>

<center><hr class="bg-navy border-navy w-25 border-2"></center>

<div>

<?= file_get_contents("about.html") ?>

</div>

</div>

</div>

</div>

<?php require_once('./config.php') ?>

<!DOCTYPE html>
<html lang="en" class="" style="height: auto;">

<?php require_once('inc/header.php') ?>

<body class="hold-transition">

<script>

start_loader()

</script>

<style>

html,body{

height: calc(100%);

width: calc(100%);

body{

width:calc(100%);

height:calc(100%);

background-image:url('<?= validate_image($_settings->info('cover')) ?>');

background-repeat: no-repeat;

background-size:cover;

#logo-img{

width:15em;

height:15em;

object-fit:scale-down;

object-position:center center;
}

#system_name{

color:#fff;

text-shadow: 3px 3px 3px #000;

#cimg{

width:200px;

height:200px;

object-fit:scale-down;

object-position:center center

</style>

<script>

</script>

<div class="d-flex justify-content-center align-items-center flex-row h-100">

<div class="col-5">

<center><img src="<?= validate_image($_settings->info('logo')) ?>"


alt="System Logo" class="img-thumbnail rounded-circle"
id="logo-img"></center>

<h1 class="text-center" id="system_name"><?= $_settings->info('name') ?


></h1>

</div>

<div class="col-7 h-100 bg-gradient-light px-4">

<div class="d-flex justify-content-center align-items-center w-100 h-100">


<div class="card card-outline card-primary col-12 rounded-0 shadow">

<div class="card-header text-center">

<a href="./register.php" class="h1"><b>Create an Account</b></a>

</div>

<div class="card-body">

<p class="login-box-msg">Sign in to start your session</p>

<form id="cregister-frm" action="" method="post">

<input type="hidden" name="id">

<div class="row">

<div class="form-group col-md-4">

<label for="firstname" class="control-label">First


Name</label>

<input type="text" id="firstname" autofocus name="firstname"


class="form-control form-control-sm form-control-border" required>

</div>

<div class="form-group col-md-4">

<label for="middlename" class="control-label">Middle


Name</label>

<input type="text" id="middlename" name="middlename"


class="form-control form-control-sm form-control-border"
placeholder="optional">

</div>

<div class="form-group col-md-4">

<label for="lastname" class="control-label">Last


Name</label>
<input type="text" id="lastname" name="lastname"
class="form-control form-control-sm form-control-border" required>

</div>

<div class="form-group col-md-4">

<label for="gender" class="control-label">Gender</label>

<select type="text" id="gender" name="gender" class="form-


control form-control-sm form-control-border select2" required>

<option>Male</option>

<option>Female</option>

</select>

</div>

<div class="form-group col-md-4">

<label for="contact" class="control-label">Contact #</label>

<input type="text" id="contact" name="contact" class="form-


control form-control-sm form-control-border" required>

</div>

</div>

<div class="row">

<div class="form-group col-md-12">

<label for="address" class="control-label">Address</label>

<textarea rows="3" id="address" name="address"


class="form-control form-control-sm rounded-0" required></textarea>

</div>

</div>

<div class="row">
<div class="form-group col-md-6">

<label for="email" class="control-label">Email</label>

<input type="email" id="email" name="email" class="form-


control form-control-sm form-control-border" required>

</div>

</div>

<div class="row">

<div class="form-group col-md-6">

<label for="password"
class="control-label">Password</label>

<div class="input-group input-group-sm">

<input type="password" id="password" name="password"


class="form-control form-control-sm form-control-border" required>

<div class="input-group-append bg-transparent border-top-0


border-left-0 border-right-0 rounded-0">

<span class="input-group-text bg-transparent border-top-


0 border-left-0 border-right-0 rounded-0">

<a href="javascript:void(0)" class="text-reset text-


decoration-none pass_view"> <i class="fa fa-eye-slash"></i></a>

</span>

</div>

</div>

</div>

<div class="form-group col-md-6">

<label for="cpassword" class="control-label">Confirm


Password</label>
<div class="input-group input-group-sm">

<input type="password" id="cpassword" class="form-


control form-control-sm form-control-border" required>

<div class="input-group-append bg-transparent border-top-0


border-left-0 border-right-0 rounded-0">

<span class="input-group-text bg-transparent border-top-


0 border-left-0 border-right-0 rounded-0">

<a href="javascript:void(0)" class="text-reset text-


decoration-none pass_view"> <i class="fa fa-eye-slash"></i></a>

</span>

</div>

</div>

</div>

</div>

<div class="row">

<div class="form-group col-md-6">

<label for="logo" class="control-label">Image</label>

<input type="file" id="logo" name="img" class="form-control


form-control-sm form-control-border" onchange="displayImg(this,$(this))"
accept="image/png, image/jpeg" required>

</div>

</div>

<div class="row">

<div class="form-group col-md-6 text-center">

<img src="<?= validate_image('') ?>" alt="Shop Logo"


id="cimg" class="border border-gray img-thumbnail">
</div>

</div>

<div class="row align-item-end">

<div class="col-8">

<a href="<?= base_url ?>">Back to Site</a>

</div>

<!-- /.col -->

<div class="col-4">

<button type="submit" class="btn btn-primary btn-block btn-


flat">Create Account</button>

</div>

<div class="col-12 text-center">

<a href="<?= base_url.'./login.php' ?>">Already have an


Account</a>

</div>

<!-- /.col -->

</div>

</form>

<!-- /.social-auth-links -->

<!-- <p class="mb-1">

<a href="forgot-password.html">I forgot my password</a>

</p> -->
</div>

<!-- /.card-body -->

</div>

</div>

</div>

</div>

<!-- jQuery -->

<script src="<?php echo base_url ?>plugins/jquery/jquery.min.js"></script>

<!-- Bootstrap 4 -->

<script src="<?php echo base_url


?>plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- AdminLTE App -->

<!-- <script src="<?php echo base_url ?>dist/js/adminlte.min.js"></script> -->

<!-- Select2 -->

<script src="<?php echo base_url


?>plugins/select2/js/select2.full.min.js"></script>

<script>

function displayImg(input,_this) {

if (input.files && input.files[0]) {

var reader = new FileReader();


reader.onload = function (e) {

$('#cimg').attr('src', e.target.result);

reader.readAsDataURL(input.files[0]);

}else{

$('#cimg').attr('src', '<?= validate_image('') ?>');

$(function(){

end_loader();

$('body').height($(window).height())

$('.select2').select2({

placeholder:"Please Select Here",

width:'100%'

})

$('.select2-selection').addClass("form-border")

$('.pass_view').click(function(){

var _el = $(this).closest('.input-group')

var type = _el.find('input').attr('type')

if(type == 'password'){

_el.find('input').attr('type','text').focus()

$(this).find('i.fa').removeClass('fa-eye-slash').addClass('fa-eye')
}else{

_el.find('input').attr('type','password').focus()

$(this).find('i.fa').addClass('fa-eye-slash').removeClass('fa-eye')

})

$('#cregister-frm').submit(function(e){

e.preventDefault();

var _this = $(this)

$('.err-msg').remove();

var el = $('<div>')

el.addClass("alert err-msg")

el.hide()

if(_this[0].checkValidity() == false){

_this[0].reportValidity();

return false;

if($('#password').val() != $('#cpassword').val()){

el.addClass('alert-danger').text('Password does not match.')

_this.append(el)

el.show('slow')

$('html,body').scrollTop(0)
return false;

start_loader();

$.ajax({

url:_base_url_+"classes/Users.php?f=save_client",

data: new FormData($(this)[0]),

cache: false,

contentType: false,

processData: false,

method: 'POST',

type: 'POST',

dataType: 'json',

error:err=>{

console.error(err)

el.addClass('alert-danger').text("An error occured");

_this.prepend(el)

el.show('.modal')

end_loader();

},

success:function(resp){

if(typeof resp =='object' && resp.status == 'success'){

location.href= './login.php';

}else if(resp.status == 'failed' && !!resp.msg){


el.addClass('alert-danger').text(resp.msg);

_this.prepend(el)

el.show('.modal')

}else{

el.text("An error occured");

console.error(resp)

$("html, body").scrollTop(0);

end_loader()

})

})

})

</script>

</body>

</html>

<?php

$user = $conn->query("SELECT * FROM client_list where id ='".$_settings-


>userdata('id')."'");

foreach($user->fetch_array() as $k =>$v){

$$k = $v;

}
?>

<?php if($_settings->chk_flashdata('success')): ?>

<script>

alert_toast("<?php echo $_settings->flashdata('success') ?>",'success')

</script>

<?php endif;?>

<style>

#cimg{

width:200px;

height:200px;

object-fit:scale-down;

object-position:center center

</style>

<div class="content py-3"></div>

<div class="card card-outline rounded-0 card-primary shadow">

<div class="card-body">

<div class="container-fluid">

<div id="msg"></div>

<form action="" id="manage-user">

<input type="hidden" name="id" value="<?php


echo $_settings->userdata('id') ?>">
<div class="row">

<div class="form-group col-md-4">

<label for="firstname" class="control-label">First Name</label>

<input type="text" id="firstname" autofocus name="firstname"


class="form-control form-control-sm form-control-border" value="<?=
isset($firstname) ? $firstname : "" ?>" required>

</div>

<div class="form-group col-md-4">

<label for="middlename" class="control-label">Middle


Name</label>

<input type="text" id="middlename" name="middlename"


class="form-control form-control-sm form-control-border" value="<?=
isset($middlename) ? $middlename : "" ?>" placeholder="optional">

</div>

<div class="form-group col-md-4">

<label for="lastname" class="control-label">Last Name</label>

<input type="text" id="lastname" name="lastname" class="form-


control form-control-sm form-control-border" value="<?= isset($lastname) ?
$lastname : "" ?>" required>

</div>

<div class="form-group col-md-4">

<label for="gender" class="control-label">Gender</label>

<select type="text" id="gender" name="gender" class="form-


control form-control-sm form-control-border select2" required>

<option <?= isset($gender) && $gender == "Male" ?


'selected' : '' ?>>Male</option>
<option <?= isset($gender) && $gender == "Female" ?
'selected' : '' ?>>Female</option>

</select>

</div>

<div class="form-group col-md-4">

<label for="contact" class="control-label">Contact #</label>

<input type="text" id="contact" name="contact" class="form-


control form-control-sm form-control-border" value="<?= isset($contact) ?
$contact : "" ?>" required>

</div>

</div>

<div class="row">

<div class="form-group col-md-12">

<label for="address" class="control-label">Address</label>

<textarea rows="3" id="address" name="address" class="form-


control form-control-sm rounded-0" required><?= isset($address) ? $address : "" ?
></textarea>

</div>

</div>

<div class="row">

<div class="form-group col-md-6">

<label for="email" class="control-label">Email</label>

<input type="email" id="email" name="email" class="form-


control form-control-sm form-control-border" value="<?= isset($email) ? $email :
"" ?>" required>

</div>
</div>

<div class="row">

<div class="form-group col-md-6">

<label for="password" class="control-label">Password</label>

<div class="input-group input-group-sm">

<input type="password" id="password" name="password"


class="form-control form-control-sm form-control-border">

<div class="input-group-append bg-transparent border-top-0


border-left-0 border-right-0 rounded-0">

<span class="input-group-text bg-transparent border-top-0


border-left-0 border-right-0 rounded-0">

<a href="javascript:void(0)" class="text-reset text-


decoration-none pass_view"> <i class="fa fa-eye-slash"></i></a>

</span>

</div>

</div>

</div>

<div class="form-group col-md-6">

<label for="cpassword" class="control-label">Confirm


Password</label>

<div class="input-group input-group-sm">

<input type="password" id="cpassword" class="form-control


form-control-sm form-control-border">

<div class="input-group-append bg-transparent border-top-0


border-left-0 border-right-0 rounded-0">
<span class="input-group-text bg-transparent border-top-0
border-left-0 border-right-0 rounded-0">

<a href="javascript:void(0)" class="text-reset text-


decoration-none pass_view"> <i class="fa fa-eye-slash"></i></a>

</span>

</div>

</div>

</div>

<small class="text-muted"><i>Leave the


New Password Fileds blank if you don't want to update it.</i></small>

</div>

<div class="row">

<div class="form-group col-md-6">

<label for="logo" class="control-label">Image</label>

<input type="file" id="logo" name="img" class="form-control


form-control-sm form-control-border" onchange="displayImg(this,$(this))"
accept="image/png, image/jpeg">

</div>

</div>

<div class="row">

<div class="form-group col-md-6 text-center">

<img src="<?= validate_image(isset($avatar) ? $avatar : "") ?>"


alt="Shop Logo" id="cimg" class="border border-gray img-thumbnail">

</div>

</div>

<div class="row">
<div class="form-group col-md-6">

<label for="oldpassword"
class="control-label">Enter Current Password</label>

<div class="input-group input-group-


sm">

<input type="password"
id="oldpassword" name="oldpassword" class="form-control form-control-sm
form-control-border" reqiured>

<div class="input-group-
append bg-transparent border-top-0 border-left-0 border-right-0 rounded-0">

<span class="input-
group-text bg-transparent border-top-0 border-left-0 border-right-0 rounded-0">

<a
href="javascript:void(0)" class="text-reset text-decoration-none pass_view"> <i
class="fa fa-eye-slash"></i></a>

</span>

</div>

</div>

</div>

</div>

</form>

</div>

</div>

<div class="card-footer text-center">

<button class="btn btn-sm btn-primary" form="manage-


user">Update</button>

</div>
</div>

</div>

<script>

function displayImg(input,_this) {

if (input.files && input.files[0]) {

var reader = new FileReader();

reader.onload = function (e) {

$('#cimg').attr('src', e.target.result);

reader.readAsDataURL(input.files[0]);

}else{

$('#cimg').attr('src', "<?= validate_image(isset($avatar) ?


$avatar : "") ?>");

$(function(){

$('.pass_view').click(function(){

var _el = $(this).closest('.input-group')

var type = _el.find('input').attr('type')

if(type == 'password'){

_el.find('input').attr('type','text').focus()
$(this).find('i.fa').removeClass('fa-eye-
slash').addClass('fa-eye')

}else{

_el.find('input').attr('type','password').focus()

$(this).find('i.fa').addClass('fa-eye-
slash').removeClass('fa-eye')

})

$('#manage-user').submit(function(e){

e.preventDefault();

var _this = $(this)

$('.err-msg').remove();

var el = $('<div>')

el.addClass("alert err-msg")

el.hide()

if(_this[0].checkValidity() == false){

_this[0].reportValidity();

return false;

if($('#password').val() != $('#cpassword').val()){

el.addClass('alert-danger').text('Password does not


match.')

_this.prepend(el)
el.show('slow')

$('html,body').scrollTop(0)

return false;

start_loader();

$.ajax({

url:_base_url_+"classes/Users.php?f=save_client",

data: new FormData($(this)[0]),

cache: false,

contentType: false,

processData: false,

method: 'POST',

type: 'POST',

dataType: 'json',

error:err=>{

console.error(err)

el.addClass('alert-danger').text("An error
occured");

_this.prepend(el)

el.show('.modal')

end_loader();

},

success:function(resp){
if(typeof resp =='object' && resp.status ==
'success'){

location.reload();

}else if(resp.status == 'failed' && !!resp.msg){

el.addClass('alert-danger').text(resp.msg);

_this.prepend(el)

el.show('.modal')

}else{

el.text("An error occured");

console.error(resp)

$("html, body").scrollTop(0);

end_loader()

})

})

})

</script>

You might also like