Вы находитесь на странице: 1из 42

John Paul II College of Davao

Ecoland Drive, Matina, Davao City


Tel No: 297-8755/299-3375



Toyworld E-commerce Website



Submitted to
Mrs. Hermilyn Mangmang

Submitted by:
Roel P. Caedo



Date
May 25, 2014



TABLE OF CONTENTS

Part I E-COMMERCE RATIONALE ................................................... 1
General Description ........................................................................... 1
History and Background ..................................................................... 3
Benefits of an Ecommerce Website ..................................................... 5
Part II WEBSITE DESIGN ............................................................. 55
Design of the Virtual Business .................................................... 55
Project Methodology .................................................................. 58
Technology ............................................................................... 60
Sytem Development Life Cycle ................................................... 60
APPENDICES ................................................................................ 92
Gantt Chart .............................................................................. 93
Sourcecode ............................................................................ 119
Screen shots ........................................................................... 119








PART I
E-COMMERCE RATIONALE:

Toyworld is one of the emerging toy stores in the Philippines. As the country
expands, new companies would enter the market place, which causes
competition amongst these businesses, which compel businesses such as this
one, to stay competitive to stay ahead of its rivals by the use of internet and
technology to help maintain and expand their customer base.

An Ecommerce website offers several advantages to customers and companies
including improvement of productivity, Customer satisfaction and general overall
productivity. In order for Toyworld to rise above their competitors and have an
increased competitive advantage, it is essential that this business incorporate
Ecommerce functionalities into their website.





.


GENERAL DESCRIPTION

Through this Ecommerce website, Toyworld offers online browsing of its
products to its customers, providing them with toys and educational products
that are just a click away. Toyworlds shoppers range from children to adults
(parents) to grandparents and this business offers an all day, all night
presentation online. Toyworld aims to improve the functionality of the services
provided online.














HISTORY AND BACKGROUND

TOYWORLD, is an emerging chain of toy stores in the Philippines. Its first store
was opened in 2001. The company started off small and at that time, had a staff
of three persons. Primarily, the business started off with carrying just a couple
brands for babies and toddlers. As business developed, the range of products
grew and so too did their customer base. So much so that, there are three
branches located nationwide and is still currently expanding.
Mission Statement:
We strive for excellence in everything that we do.
Philosophy:
Our products are not limited to children, but also to those adults who are still
kids at heart. Children absorb more information when they are enjoying
themselves, and so our strategy has been to choose products that are of the
highest quality and value, so that it may be enjoyed by everyone. Only the best
are employed at Toyworld and they include a mix of youth and experience. With
a staff of over forty persons, who include, part-time students, who know all
about fun, to well experienced mothers, who know what is best for their
children. The staff is fully educated about each product, and all participate in
numerous training sessions throughout the year.

At Toyworld, the first priority is always to ensure its customers are treated as
family. Toyworlds customer service is all about sending you off satisfied so that
you will come back and converse positive feedback about your experience along
to others, who may then become valued customers.


















BENEFITS OF AN ECOMMERCE WEBSITE TO TOYWORLD ARE:

Boosting Brands and Product Awareness
A web site containing your business means that there is a wider scope of
consumers that can be attained. Toyworld will be able to assist in increasing your
companys promotion of various products by reaching out to new business
markets and showing your web site to them. This will give users access to the
web site 24/7 conveniently and this would create word of mouth promotion of
the store and the products that are offered.

Expanding Geographical Reach
Having an ecommerce business means that there are no limitations as to who
and where the products can be sold to, as opposed to physical storefronts that
are limited to the city/town they are situated. An ecommerce website would
reach potential customers in any part of the country and even the whole world.

Creates New Relationship Prospects
Investing in an Ecommerce website can lead to greater chances and would assist
in establishing relationships with potential customers, potential business
associates and even new product manufactures. Acquiring an online business
means that it would be more accessible and reachable to users all over the
world, which would make for greater opportunities and for products suppliers to
request their products being added to your inventories, therefore increasing the
range of products that are being offered. Other businesses may even approach
an online business about becoming partners. All these things would not be
possible in a local storefront.

Help in launching customer loyalty
This will create an easier way for customers to buy items that the business is
offering and also can leave reviews of the products and customer service, which
would let the business know how the customer feels with respect to their store
and also to attract new customers and already existing customers to come again,
creating greater customer loyalty. Customers would now be able to view and get
updates on their favorite brands or products and special discounts that apply and
would be able to make a purchase anytime.

Allowance for simple delivery of information
It is simpler for a business to advertise its products through their online store or
an online brochure. Customers will have direct access to the product information,
company information, special discounts, promotions and much more. This will
not only be beneficial to the customers, but also to the store owner, as it is
easier to update a website about new products and special prices and then
update it when the time comes, than to have to manually display it in the store.

Potential to increase company Profits
Creating an online version of the business is a great way to enhance sales and
potential profits. This gives the business a better chance of increasing sales and
profits, and since this is the main livelihood of the business, it makes sense to
invest in an ecommerce site that would give way to more sales, profits and
bigger opportunities.
















PART II

WEBSITE DESIGN

Design of the Virtual Business

Toyworld is one of the emerging toy stores in the Philippines. The main product
line of Toyworld is specifically, as its name suggests toys. It is a fairly open
market to all ages of customers, since the various products appeal to children
and adults of all ages. The market for toys is also a low risk market not only
because of the constant need for new and improved toys, but especially around
the Christmas period where the company is at its peak period.

Points for Consideration:
1) Product Source
It must be noted that the company is a retail distributor of toys, and do not
manufacture these toys. The brands of toys are foreign based are mostly comes
from the United States. Hence, the products would not be produced by the same
people who maintain the web site.
2) Target Audience
The target audience for the website is:
a) Adults The main decision makers and purchasers mainly come down to the
parents, grandparents etc. in what they want their children exposed to. Although
children may use the website, for purchasing it is the responsibility of the adults.
For instance, baby items would be purchased by the adults. The website needs
to bring a perspective to the adults to instill in their minds that what they need,
whether it be baby items, gifts for children, young adults etc, the company has
it, and it can be view on the website.
b) Children Early teens are also the target audience. As technology and e-
commerce expands, the younger generations are the ones being kept in the
know. In terms of playstations, remote controlled products, collectibles etc, this
would mostly appeal to these young adults. The website, especially for this
segment, needs to show that there is a vast variety of products, and that they
can view each category.
3) Product Delivery
Products purchased on the site can either be picked up in store, or by request for
home delivery.
4) Payment Type
Payment can be made using PayPal. This will ensure the safety of customers and
offer a secure online shopping experience.
8) Additional Facilities
A functional Contact Us form in the website that would send an e-mail to the
concerned for them to be able to address concerns sent by the customers.
PROJECT METHODOLOGY

A traditional approach was used in the development of the website that involves
a series of consecutive stages in the project management process. It followed a
step-by-step sequence to design, develop and deliver the actual website. It
entailed an achieved succession in the implementation process and provided the
benefits of milestone-based planning and team building. This methodology type
is called Waterfall one portion of work follows after another in linear
sequence.

The following stages are included in the project management:
Initiation (requirements specification)
Planning and design
Execution (construction and coding)
Control and integration
Validation (testing and debugging)
Closure (installation and maintenance)





TECHNOLOGY

PHP MySQL was utilized in the development of the website; the use of cutting
edge technology is a must to be able to cope up with the current demand in the
use of the ever evolving World Wide Web.

PHP MySQL programming is a combination of the PHP language and MySQL. PHP
is a programming language that enables the web developers in producing
contents that supports databases. The database servers supported are MySQL,
Informix and Solid. MySQL is a database management system interacting with
SQL language that ensures excellent editing, accessing and processing of the
database.

Programming in PHP MySQL is highly compatible with every operating system
such as Apache, IIS and others. PHP MySQL technology offers support for
popular databases like Informix, Oracle, Sybase, etc. Maintaining a PHP MySQL
based website is cheaper compared to the other technologies based websites.
The reliability, speed and performance aspects in case of programming in PHP
MySQL language is of superior level. Linux, UNIX and Windows are the platforms
used in case of PHP MySQL programming. Websites having extraordinary
performing ability and reliability appeal the customers on a large scale. Using
PHP MySQL technology for the web development purpose ensures successful
websites. The users visiting your PHP MySQL based website can easily access the
website which later results in the rise of business.

The perfect combination of PHP and MySQL technology provides the fastest and
economical web development solutions for dynamic web application
development. PHP scripting language can be embedded in the HTML code
whereas MySQL is a popular database that connects to various other databases
like Oracle, SQL Server for creating web applications such as content
management systems, ecommerce applications, online shopping carts, etc.

PHP MySQL technologies ensure a safe and secure website with excellent
contents on various services. PHP MySQL is used for quick and affordable
websites that are complex and interactive. Using PHP MySQL, which is an open
source technology, will benefit in various advantages without any change in
quality. The website is incorporated with the latest and demanded features as
with of websites existing in the industry.






SYSTEM DEVELOPMENT LIFE CYCLE PHASES

Feasibility analysis

Includes analysis of project requirements in terms of input data and desired
output, processing required to transform input into output, cost-benefit analysis,
and schedule of the project.

Requirement analysis and specification
Includes gathering, analyzing, validating, and specifying requirements.

Design
Includes translation of the requirements into a logical structure that can be
implemented in a programming language.

Coding
Includes implementation of the design specified in the design into executable
programming language code. The output of the coding phase is the source code
for the software that acts as input to the testing and maintenance phase.



Testing
Includes detection of errors in the software. The testing process starts with a
test plan that recognizes test-related activities, such as test case generation,
testing criteria, and resource allocation for testing. The code is tested and
mapped against the design document created in the design phase. The output of
the testing phase is a test report containing errors that occurred while testing the
application.

Maintenance
Includes implementation of changes that software might undergo over a period
of time, or implementation of new requirements after the software is deployed at
the customer location. The maintenance phase also includes handling the
residual errors that may exist in the software even after the testing phase.









APPENDIX A
GANTT CHART




















APPENDIX B

SOURCECODES

Index.php
<?php
include("includes/db.php");
include("includes/functions.php");

if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){
$pid=$_REQUEST['productid'];
addtocart($pid,1);
header("location:shoppingcart.php");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<script language="javascript">
function addtocart(pid){
document.form1.productid.value=pid;
document.form1.command.value='add';
document.form1.submit();
}
</script>
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
<style>
.info {float: left;margin: 0px;width: 180px;padding-left:1.2em;}
li.name{padding:0px;margin:0px;color:brown;}
.info img{margin-top:1em;}
</style>
</head>
<body>
<form name="form1">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">ToyWorld</a></h1>
<span>Temptation in every <a href="#" rel="nofollow">BYTE</a></span>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="index.php" accesskey="1"
title="">Homepage</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping
Cart</a></li>
<li><a href="#wrapper1" accesskey="3" title="">About Us</a></li>
<li><a href="#wrapper2" accesskey="4" title="">Contact Us</a></li>
<li><a href="#wrapper4" accesskey="5" title="">Get in Touch</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Our Products</h2>
<span class="byline">Everything is special</span> </div>
<div id="content">
<div id="primarycontainer">
<div id="primarycontent">
<!-- Primary content area start -->
<div class="post">
<div class="contentarea">
<div width="">
<?php
$result=mysql_query("select * from products") or die("select * from
products"."<br/><br/>".mysql_error());
while($row=mysql_fetch_array($result)){
?>
<ul class="info"style="list-style:none;display:block;">
<img src="<?php echo $row['picture']?>" class="left" width="180" height="200"/>
<li class="name"><h4><?php echo $row['name']?></h4></li>
<li class="desc"><?php echo $row['description']?></li>
<li class="price">Price:&nbsp;&nbsp;<big style="color:green">Php <?php echo
$row['price']?></big></li>
<li class="butt"><input class="addbutton" type="button" value="Add to Cart"
onclick="addtocart(<?php echo $row['id']?>)" /></li>
<li class="butt"><form action="https://www.paypal.com/cgi-bin/webscr"
method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="business" value="roelpantaleoncaedo@gmail.com">
<input type="hidden" name="lc" value="PH">
<input type="hidden" name="item_name" value="Bought Item">
<input type="hidden" name="amount" value="99.00">
<input type="hidden" name="currency_code" value="PHP">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="undefined_quantity" value="1">
<input type="hidden" name="shipping" value="50.00">
<input type="image" src="images/paypal.jpg" border="0" name="submit" alt="PayPal -
The safer, easier way to pay online!">
</form>
</li>
</ul>
<?php } ?>
</div>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>
<div id="wrapper1">
<div id="welcome" class="container">
<div class="title">
<h2>Welcome to our website</h2>
<span class="byline">What are we June6? pls white something here</span>
</div>
<div class="content">
<p>About Us :) </p>
<a href="#" class="button">Like Us</a> </div>
</div>
</div><div id="wrapper2">
<div id="newsletter" class="container">
<div class="title">
<h2>Contact Us</h2>
<span class="byline">Names</span> </div>
<div class="content">
<form method="post" action="#">
<div class="row half">
<div class="6u">
<input type="text" class="text" name="name" placeholder="Name" />
</div>
<div class="6u">
<input type="text" class="text" name="email" placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u"> <a href="#" class="button submit">Send Message</a>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="wrapper4">
<div id="footer" class="container">
<div>
<header class="title">
<h2>Get in touch</h2>
<span class="byline">Like Us</span> </header>
<ul class="contact">
<li><a href="#" class="icon icon-twitter"><span>Twitter</span></a></li>
<li><a href="#" class="icon icon-facebook"><span></span></a></li>
<li><a href="#" class="icon icon-dribbble"><span>Pinterest</span></a></li>
<li><a href="#" class="icon icon-tumblr"><span>Google+</span></a></li>
<li><a href="#" class="icon icon-rss"><span>Pinterest</span></a></li>
</ul>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="admin/index.php"
rel="nofollow">ADMIN</a>.</p>
</div>
</body>
</html>



Shoppingcart.php

<?php
include("includes/db.php");
include("includes/functions.php");

if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0){
remove_product($_REQUEST['pid']);
}
else if($_REQUEST['command']=='clear'){
unset($_SESSION['cart']);
}
else if($_REQUEST['command']=='update'){
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=intval($_REQUEST['product'.$pid]);
if($q>0 && $q<=999){
$_SESSION['cart'][$i]['qty']=$q;
}
else{
$msg='Some proudcts not updated!, quantity must be a number between 1 and 999';
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
</head>
<body>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">Toyworld</a></h1>
<span>Temptation in every <a href="#"
rel="nofollow">BYTE</a></span> </div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="index.php" accesskey="1"
title="">Homepage</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping Cart</a></li>
<li><a href="#wrapper1" accesskey="3" title="">About Us</a></li>
<li><a href="#wrapper2" accesskey="4" title="">Contact Us</a></li>
<li><a href="#wrapper4" accesskey="5" title="">Get in Touch</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Your Shopping Cart</h2>
<span class="byline">Everything is special</span> </div>
<div id="content">
<script language="javascript">
function del(pid){
if(confirm('Do you really mean to delete this item')){
document.form1.pid.value=pid;
document.form1.command.value='delete';
document.form1.submit();
}
}
function clear_cart(){
if(confirm('This will empty your shopping cart, continue?')){
document.form1.command.value='clear';
document.form1.submit();
}
}
function update_cart(){
document.form1.command.value='update';
document.form1.submit();
}
</script>
<div id="primarycontainer">
<div id="primarycontent">
<!-- Primary content area start -->
<div class="post">
<div class="contentarea">
<form name="form1" method="post">
<input type="hidden" name="pid" />
<input type="hidden" name="command" />
<div style="margin:0px auto; width:600px;" >
<div style="padding-bottom:10px">
<input type="button" value="Continue Shopping"
onclick="window.location='index.php'" />
</div>
<div style="color:#F00"><?php echo $msg?></div>
<table border="0" cellpadding="5px" cellspacing="1px" style="font-family:Verdana,
Geneva, sans-serif; font-size:11px; background-color:#E1E1E1" width="96%">
<?php
if(is_array($_SESSION['cart'])){
echo '<tr bgcolor="#FFFFFF" style="font-
weight:bold"><td>id</td><td>Name</td><td>Price</td><td>Qty</td><td>Amoun
t</td><td>Options</td></tr>';
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$pname=get_product_name($pid);
if($q==0) continue;
?>
<tr bgcolor="#FFFFFF"><td><?php echo $i+1?></td><td><?php echo
$pname?></td>
<td>P <?php echo get_price($pid)?></td>
<td><input type="text" name="product<?php echo $pid?>" value="<?php echo
$q?>" maxlength="3" size="2" /></td>
<td>P <?php echo get_price($pid)*$q?></td>
<td><a href="javascript:del(<?php echo
$pid?>)">Remove</a></td></tr>
<?php
}
?>
<tr><td><b>Order Total: P<?php echo get_order_total()?></b></td><td
colspan="5" align="right"><input type="button" value="Clear Cart"
onclick="clear_cart()"><input type="button" value="Update Cart"
onclick="update_cart()"><input type="button" value="Place Order"
onclick="window.location='billing.php'"></td></tr>
<?php
}
else{
echo "<tr bgColor='#FFFFFF'><td>There are no items in
your shopping cart!</td>";
}
?>
</table>
</div>
</form>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>
<div id="wrapper1">
<div id="welcome" class="container">
<div class="title">
<h2>Welcome to our website</h2>
<span class="byline">What are we June6? pls white something here</span> </div>
<div class="content">
<p>About Us :) </p>
<a href="#" class="button">Like Us</a> </div>
</div>
</div><div id="wrapper2">
<div id="newsletter" class="container">
<div class="title">
<h2>Contact Us</h2>
<span class="byline">Names</span> </div>
<div class="content">
<form method="post" action="#">
<div class="row half">
<div class="6u">
<input type="text" class="text" name="name" placeholder="Name" />
</div>
<div class="6u">
<input type="text" class="text" name="email" placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u"> <a href="#" class="button submit">Send Message</a> </div>
</div>
</form>
</div>
</div>
</div>
<div id="wrapper4">
<div id="footer" class="container">
<div>
<header class="title">
<h2>Get in touch</h2>
<span class="byline">Like Us</span> </header>
<ul class="contact">
<li><a href="#" class="icon icon-twitter"><span>Twitter</span></a></li>
<li><a href="#" class="icon icon-facebook"><span></span></a></li>
<li><a href="#" class="icon icon-dribbble"><span>Pinterest</span></a></li>
<li><a href="#" class="icon icon-tumblr"><span>Google+</span></a></li>
<li><a href="#" class="icon icon-
rss"><span>Pinterest</span></a></li>
</ul>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="#" rel="nofollow">Roerlpc</a>.</p>
</div>
</body>
</html>


cartupdate.php

<?php
session_start(); //start session
include_once("imp/config.php"); //include config file
if(isset($_POST["type"]) && $_POST["type"]=='add')
{
$product_code = filter_var($_POST["product_code"], FILTER_SANITIZE_STRING);
$return_url = base64_decode($_POST["return_url"]); //return url
$results = $mysqli->query("SELECT product_name,price FROM products WHERE
product_code='$product_code' LIMIT 1");
$obj = $results->fetch_object();
if ($results) { //we have the product info
$new_product = array(array('name'=>$obj->product_name,
'code'=>$product_code, 'qty'=>1, 'price'=>$obj->price));
if(isset($_SESSION["products"])) {
$found = false
foreach ($_SESSION["products"] as $cart_itm) {
if($cart_itm["code"] == $product_code){ $qty = $cart_itm["qty"]+1;
$product[] = array('name'=>$cart_itm["name"],
'code'=>$cart_itm["code"], 'qty'=>$qty, 'price'=>$cart_itm["price"]);
$found = true;
}else{
$product[] = array('name'=>$cart_itm["name"],
'code'=>$cart_itm["code"], 'qty'=>$cart_itm["qty"], 'price'=>$cart_itm["price"]);
}
}
if($found == false) {
$_SESSION["products"] = array_merge($product, $new_product);
}else{
$_SESSION["products"] = $product;
}
}else{
$_SESSION["products"] = $new_product;
}
}
header('Location:'.$return_url);
}
if(isset($_GET["removep"]) && isset($_GET["return_url"]) &&
isset($_SESSION["products"]))
{
$product_code = $_GET["removep"]; $return_url =
base64_decode($_GET["return_url"]); //get return url

foreach ($_SESSION["products"] as $cart_itm) {
if($cart_itm["code"]==$product_code){
if($cart_itm["qty"]>1)
{
$qty = $cart_itm["qty"]-1
$product[] = array('name'=>$cart_itm["name"], 'code'=>$cart_itm["code"],
'qty'=>$qty, 'price'=>$cart_itm["price"]);
}
}else{
$product[] = array('name'=>$cart_itm["name"], 'code'=>$cart_itm["code"],
'qty'=>$cart_itm["qty"], 'price'=>$cart_itm["price"]);
}
$_SESSION["products"] = $product;
}
header('Location:'.$return_url);
}
?>


billing.php

<?php
include("includes/db.php");
include("includes/functions.php");
if($_REQUEST['command']=='update'){
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$address=$_REQUEST['address'];
$phone=$_REQUEST['phone'];
$result=mysql_query("insert into customers
values('','$name','$email','$address','$phone')");
$customerid=mysql_insert_id();
$date=date('Y-m-d');
$result=mysql_query("insert into orders values('','$date','$customerid')");
$orderid=mysql_insert_id();
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$price=get_price($pid);
mysql_query("insert into order_detail values
($orderid,$pid,$q,$price)");
}
die('Thank You! your order has been placed!');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<script language="javascript">
function validate(){
var f=document.form1;
if(f.name.value==''){
alert('Your name is required');
f.name.focus();
return false;
}
f.command.value='update';
f.submit();
}
</script>
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
</head>
<body>
<form name="form1">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">Toyworld</a></h1>
<span>Temptation in every <a href="#"
rel="nofollow">BYTE</a></span> </div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="index.php" accesskey="1"
title="">Homepage</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping Cart</a></li>
<li><a href="#wrapper1" accesskey="3" title="">About Us</a></li>
<li><a href="#wrapper2" accesskey="4" title="">Contact Us</a></li>
<li><a href="#wrapper4" accesskey="5" title="">Get in Touch</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Billing Info</h2>
<span class="byline">Everything is special</span> </div>
<div id="content">
<div id="primarycontainer">
<div id="primarycontent">
<!-- Primary content area start -->

<div class="post">
<div class="contentarea">
<form name="form1" onsubmit="return validate()"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="command" />
<div align="center">

<table border="0" cellpadding="2px">
<tr><td>Order Total: P</td><td><?php echo get_order_total()?></td></tr>
<tr><td>Your Name:</td><td><input type="text" name="name" /></td></tr>
<tr><td>Address:</td><td><textarea name="address" maxlength="100" cols="19"
rows="3"></textarea></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" /></td></tr>
<tr><td>Phone:</td><td><input type="text" name="phone" /></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><th COLSPAN=2>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="roelpantaleoncaedo@gmail.com">
<input type="hidden" name="lc" value="PH">
<input type="hidden" name="item_name" value="Grand Total">
<input type="hidden" name="currency_code" value="PHP">
<input type="hidden" name="amount" value="<?php echo get_order_total()?>">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="shipping" value="50.00">
<input type="image" src="images/checkout.png" style="width:10em;" name="submit"
alt="Make payments with PayPal - it's fast, free and secure!">
</th></tr>
</table>
</div>
</form>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>
<div id="wrapper1">
<div id="welcome" class="container">
<div class="title">
<h2>Welcome to our website</h2>
<span class="byline">What are we June6? pls white something
here</span> </div>
<div class="content">
<p>About Us :) </p>
<a href="#" class="button">Like Us</a> </div>
</div>
</div><div id="wrapper2">
<div id="newsletter" class="container">
<div class="title">
<h2>Contact Us</h2>
<span class="byline">Names</span> </div>
<div class="content">
<form method="post" action="#">
<div class="row half">
<div class="6u">
<input type="text" class="text" name="name" placeholder="Name" />
</div>
<div class="6u">
<input type="text" class="text" name="email" placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u"> <a href="#" class="button submit">Send Message</a> </div>
</div>
</form>
</div>
</div>
</div>
<div id="wrapper4">
<div id="footer" class="container">
<div>
<header class="title">
<h2>Get in touch</h2>
<span class="byline">Like Us</span> </header>
<ul class="contact">
<li><a href="#" class="icon icon-twitter"><span>Twitter</span></a></li>
<li><a href="#" class="icon icon-facebook"><span></span></a></li>
<li><a href="#" class="icon icon-dribbble"><span>Pinterest</span></a></li>
<li><a href="#" class="icon icon-tumblr"><span>Google+</span></a></li>
<li><a href="#" class="icon icon-rss"><span>Pinterest</span></a></li>
</ul>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="#" rel="nofollow">Roerlpc</a>.</p>
</div>
</body>
</html>



login.php


<?php
include("includes/db1.php");
$header_num = 0;

if (count($_POST) > 0)
{
login();
}
function login()
{
$username = $_POST["username"];
$password = $_POST["password"];

$sql = "select count(*) as num from admin where username = '$username' and
password = '".md5($password)."'";
$rs = mysql_query($sql);
$data = mysql_fetch_array($rs);
$num = $data['num'];
if ($num == 0)
{
echo "<script
language=\"javascript\">alert(\"error!\");location.href=\"login.php\"</script>";
exit;
}
else
{
if($num > 0)
{
session_start();
$_SESSION['admin'] = $username;echo "<script
language=\"javascript\">location.href=\"admin.php\";</script>";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="../default.css" rel="stylesheet" type="text/css" media="all" />
<link href="../fonts.css" rel="stylesheet" type="text/css" media="all" />
<script src="script/show_file.js" type="text/javascript"></script>
<script src="script/functions.js" type="text/javascript"></script>
<style>
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
#add td
{
background-color:green;
color:white;
}
#infoMessage p{
padding: .8em;
margin-bottom: 1em;
border: 2px solid #ddd;
background: #FFF6BF;
color: #817134;
border-color: #FFD324;
text-align: center;
}
</style>
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
</head>
<body>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">Toyworld</a></h1>
<span>Temptation in every <a href="#"
rel="nofollow">BYTE</a></span> </div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="../index.php" accesskey="1"
title="">Logout</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping Cart</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Administration Panel</h2>
<span class="byline">For Official Use Only</span> </div>
<div id="content">
<div id="primarycontainer">
<div id="primarycontent">
<div class="post">
<div class="contentarea">
<!---- START ------>


<form name="login" method="POST" action="login.php" align="center">
Username <input type="text" name="username"/><br><br>
Password <input type="password" name="password"/><br><br>

<input type="submit" name="submit_login" value="Login">
<input type="reset" value="Cancel"/>
</div>
</form>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="#" rel="nofollow">Roerlpc</a>.</p>
</div>
</body>
</html>


admin.php


<?php
require_once('admin_state.php');
$header_num = 1;
include("includes/db1.php");
$action = $_GET['action'];
if($action == "edit")
{
edit_conf();
}
function edit_conf()
{
global $Conn;
$admin_name = $_POST['admin_name'];
$admin_email = $_POST['admin_email'];
$admin_pass = $_POST['admin_pass'];

$sql_step1 = "UPDATE admin SET username = '$admin_name', password
= '".md5($admin_pass)."', email = '$admin_email'";
mysql_query($sql_step1);
echo "<script language=\"javascript\">alert(\"Update
Successfully!\");location.href=\"admin.php\"</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="../default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<style>
table, td, th
{
border:1px solid #FF6600;
}
th
{
background-color:#FF6600;
color:white;
}
#add td
{
background-color:#FF6600;
color:white;
font-weight:bold;
}

#infoMessage p{
padding: .8em;
margin-bottom: 1em;
border: 2px solid #ddd;
background: #FFF6BF;
color: #817134;
border-color: #FFD324;
text-align: center;
}
</style>
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
</head>
<body>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">Toyworld</a></h1>
<span>Temptation in every <a href="#"
rel="nofollow">BYTE</a></span> </div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="../index.php" accesskey="1"
title="">Logout</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping Cart</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Administration Panel</h2>
<span class="byline">For Official Use Only</span> </div>
<div id="content">
<div id="primarycontainer">
<div id="primarycontent">
<div class="post">
<div class="contentarea">
<form name="frmproduct" method="post">
<input type="hidden" name="rid" />
<input type="hidden" name="command" />
<table width="100%" align="center">
<tr>

<th width="150"><strong>Product Name</strong></th>
<th><strong>Product Description</strong></th>
<th><strong>Price</strong></th>
<th><strong>Edit</strong></th>
<th><strong>Delete</strong></th>
</tr>
<?php
include("../includes/db.php");
$result=mysql_query("SELECT * FROM products");
while($test = mysql_fetch_array($result))
{
$id = $test['id'];
echo "<tr align='center'>";
echo"<td><font color='black'>" .$test['name']."</font></td>";
echo"<td><font color='black'>". $test['description']. "</font></td>";
echo"<td><font color='black'>". $test['price']. "</font></td>";
echo"<td> <a href ='edit.php?id=$id'>Edit</a></td>";
echo"<td> <a href ='del.php?id=$id'><center>Delete</center></a></td>";
echo "</tr>";
}
mysql_close($conn);
?>
</table>
</form>
<fieldset>
<h1 style="color:brown;">Add Product</h1>
<form method="post" action="add.php" >
<table id="add" width="100%" border="1" cellpadding="0" cellspacing="2"
align="center">
<tr>
<td width="10%" align="center" bgcolor="#FFFFFF">Product Name: </td>
<td><input type="text" name="name" maxlength="5" size="50"/></td>
</tr>
<tr>
<td width="10%" align="center" bgcolor="#FFFFFF">Product Description: short</td>
<td ><textarea name="description" value="limit to 25 characters" maxlength="15"
cols="10" rows="4"></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">Price:</td>
<td><input type="text" name="price" maxlength="10" size="50"/></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">Picture (182x100):</td>
<td><input type="text" name="picture" value="images/*.*" maxlength="50"
size="50"/></td><br/><br/>
</tr>
<tr>
<td>Action</td>
<td><input type="submit" name="submit" value="Submit"/>
</td>
</tr>
</table>
</form>
</fieldset>
<fieldset>
<form name="system_settings" method="POST" action="admin.php?action=edit">
<legend>Change Administration Settings</legend>
<table>
<tr>
<td>Admin Name: </td>
<td><input type="text" name="admin_name" value="<?php echo $username ?>"
class="large"></td>
</tr>
<tr>
<td>Admin Email: </td>
<td><input type="text" name="admin_email" value="<?php echo $email ?>"
class="large"></td>
</tr>
<tr>
<td>Admin Password: </td>
<td><input type="password" name="admin_pass" value="" class="large"></td>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit_settings"
value="Update System Settings"></td>
</tr>
<div style="text-align: center;">
</div>
</form>
</table>
</fieldset>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="#" rel="nofollow">Roerlpc</a>.</p>
</div>
</body>
</html>


edit.php


<?php
error_reporting(0);
$id = $_GET["id"];
include("../includes/db.php");
$result = mysql_query("SELECT * FROM products where id=$id");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$name=$test['name'] ;
$price= $test['price'] ;
$description=$test['description'] ;
if(isset($_POST['save']))
{
$name_save = $_POST['name'];
$price_save = $_POST['price'];
$description_save = $_POST['description'];
mysql_query("UPDATE products SET name ='$name_save',description
='$description_save',
price ='$price_save' WHERE id = '$id'")
or die(mysql_error());
}
mysql_close($conn);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link
href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,
900" rel="stylesheet" />
<link href="../default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<style>
table, td, th
{
border:1px solid orange;
}
th
{
background-color:orange;
color:white;
}
#add td
{
background-color:orange;
color:white;
font-weight:bold;
}
#infoMessage p{
padding: .8em;
margin-bottom: 1em;
border: 2px solid #ddd;
background: #FFF6BF;
color: #817134;
border-color: #FFD324;
text-align: center;
}
</style>
<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]--
>
</head>
<body>
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<span class="icon icon-fire"></span>
<h1><a href="#">Toyworld</a></h1>
<span>Temptation in every <a href="#" rel="nofollow">BYTE</a></span>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="admin.php" accesskey="1"
title="">Admin</a></li>
<li><a href="shoppingcart.php" accesskey="2" title="">Shopping Cart</a></li>
</ul>
</div>
</div>
</div>
<div id="wrapper3">
<div id="portfolio" class="container">
<div class="title">
<h2>Administration Panel</h2>
<span class="byline">For Official Use Only</span> </div>
<div id="content">
<div id="primarycontainer">
<div id="primarycontent">
<div class="post">
<div class="contentarea">
<h1 style="color:brown;">Edit Products</h1>
<form name="frmproduct" method="post">
<input type="hidden" name="rid" />
<input type="hidden" name="command" />
<table width="100%" align="center">
<tr>
<th width="150"><strong>Product Name</strong></th>
<th><strong>Product Description</strong></th>
<th><strong>Price</strong></th>
<th><strong>Edit</strong></th>
</tr>
<?php
$result=mysql_query("SELECT * FROM products");
while($test = mysql_fetch_array($result))
{
$id = $test['id'];
echo "<tr align='center'>";

echo"<td><font color='black'>" .$test['name']."</font></td>";
echo"<td><font color='black'>". $test['description']. "</font></td>";
echo"<td><font color='black'>". $test['price']. "</font></td>";
echo"<td> <a href ='edit.php?id=$id'>Edit</a></td>";
echo "</tr>";
}
mysql_close($conn);
?>
</table>
</form>
<form method="post">
<table id="add" width="100%" border="1" cellpadding="0" cellspacing="2"
align="center">
<tr>
<td width="10%" align="center" bgcolor="#FFFFFF">Product Name: </td>
<td><input type="text" name="name" value="<?php echo $name ?>"
maxlength="20" size="17"/></td>
</tr>
<tr>
<td width="10%" align="center" bgcolor="#FFFFFF">Product Description: short</td>
<td><textarea name="description" value="limit to 25 characters" maxlength="25"
cols="16" rows="4"></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">Price:</td>
<td><input type="text" name="price" value="<?php echo $price ?>" maxlength="10"
size="17"/></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">Picture (182x100):</td>
<td><input type="text" name="picture" value="images/*.*" maxlength="50"
size="17"/></td><br/><br/>
</tr>
<tr>
<td>Action</td>
<td><input type="submit" name="save" value="Submit" />
</td>
</tr>
</table>
</form>
</div><!------- END CONTENT AREA --------->
</div>
</div>
</div>
</div>
</div>
</div>


<div id="copyright">
<p>Copyright (c) 2013 SadSoftEng'g. All rights reserved. | Photos by <a
href="#">WebSite</a> | Design by <a href="#" rel="nofollow">Roerlpc</a>.</p>
</div>
</body>
</html>


add.php


<?php
if (isset($_POST['submit']))
{
include("../includes/db.php");
$name=$_POST['name'] ;
$description=$_POST['description'];
$price= $_POST['price'] ;
$picture=$_POST['picture'] ;
mysql_query("INSERT INTO `products`(name,description,price,picture)
VALUES ('$name','$description','$price','$picture')");
}
?>
<script language="javascript">
location="admin.php"
</script>


delete.php

<?php
include("../includes/db.php");
$id =$_REQUEST['id'];
mysql_query("DELETE FROM products WHERE ID = '$id'")
or die(mysql_error());
?>
<script language="javascript">
location="admin.php"
</script>

Вам также может понравиться