PHP 7 MySQL Project to Build Bakery Shop Management System With Authentication in Browser
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(isset($_GET['action']) && $_GET['action']=="add"){
$id=intval($_GET['id']);
if(isset($_SESSION['cart'][$id])){
$_SESSION['cart'][$id]['quantity']++;
}else{
$sql_p="SELECT * FROM products WHERE id={$id}";
$query_p=mysqli_query($con,$sql_p);
if(mysqli_num_rows($query_p)!=0){
$row_p=mysqli_fetch_array($query_p);
$_SESSION['cart'][$row_p['id']]=array("quantity" => 1, "price" => $row_p['productPrice']);
header('location:index.php');
}else{
$message="Product ID is invalid";
}
}
}
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<title>Tutsy Delights Bakery</title>
<!--Bootstrap -->
<link rel="stylesheet" href="assets2/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="assets2/css/style.css" type="text/css">
<link rel="stylesheet" href="assets2/css/owl.carousel.css" type="text/css">
<link rel="stylesheet" href="assets2/css/owl.transitions.css" type="text/css">
<link href="assets2/css/slick.css" rel="stylesheet">
<link href="assets2/css/bootstrap-slider.min.css" rel="stylesheet">
<link href="assets2/css/font-awesome.min.css" rel="stylesheet">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets2/images/favicon-icon/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets2/images/favicon-icon/apple-touch-icon-114-precomposed.html">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets2/images/favicon-icon/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets2/images/favicon-icon/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="assets2/images/favicon-icon/favicon.png">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet">
<!-- CSS -->
<link href="style.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
<link href='files/dist/themes/fontawesome-stars.css' rel='stylesheet' type='text/css'>
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Customizable CSS -->
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/green.css">
<link rel="stylesheet" href="assets/css/owl.carousel.css">
<link rel="stylesheet" href="assets/css/owl.transitions.css">
<!--<link rel="stylesheet" href="assets/css/owl.theme.css">-->
<link href="assets/css/lightbox.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/animate.min.css">
<link rel="stylesheet" href="assets/css/rateit.css">
<link rel="stylesheet" href="assets/css/bootstrap-select.min.css">
<!-- Demo Purpose Only. Should be removed in production -->
<link rel="stylesheet" href="assets/css/config.css">
<link href="assets/css/green.css" rel="alternate stylesheet" title="Green color">
<link href="assets/css/blue.css" rel="alternate stylesheet" title="Blue color">
<link href="assets/css/red.css" rel="alternate stylesheet" title="Red color">
<link href="assets/css/orange.css" rel="alternate stylesheet" title="Orange color">
<link href="assets/css/dark-green.css" rel="alternate stylesheet" title="Darkgreen color">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,700' rel='stylesheet' type='text/css'>
<!-- Script -->
<script src="jquery-3.0.0.js" type="text/javascript"></script>
<script src="files/dist/jquery.barrating.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('.rating').barrating({
theme: 'fontawesome-stars',
onSelect: function(value, text, event) {
// Get element id by data-id attribute
var el = this;
var el_id = el.$elem.data('id');
// rating was selected by a user
if (typeof(event) !== 'undefined') {
var split_id = el_id.split("_");
var postid = split_id[1]; // postid
// AJAX Request
$.ajax({
url: 'rating_ajax.php',
type: 'post',
data: {postid:postid,rating:value},
dataType: 'json',
success: function(data){
// Update average
var average = data['averageRating'];
$('#avgrating_'+postid).text(average);
}
});
}
}
});
});
</script>
</head>
<body>
<header class="header-style-1">
<?php include('includes/top-header.php');?>
<?php include('includes/main-header.php');?>
<?php include('includes/menu-bar.php');?>
</header>
<!-- Banners -->
<section id="banner" class="banner-section">
<div class="container">
<div class="div_zindex">
<div class="row">
<div class="col-md-5 col-md-push-7">
<div class="banner_content">
<h1>Ever Tasty Ever Delicious.</h1>
<p>We have more than twenty cake flavours for you to choose. </p>
<a href="cake-listing.php" class="btn">Order Now <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span></a> </div>
</div>
</div>
</div>
</div>
</section>
<!-- /Banners -->
<!-- Resent Cat-->
<section class="section-padding gray-bg">
<div class="container">
<div class="section-header text-center">
<h2>What we have in wait <span> For You</span></h2>
<div class="row">
<!-- Recently Listed New Cakes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="resentnewCake">
<?php
$ret=mysqli_query($con,"select * from products ORDER BY id DESC");
while ($row=mysqli_fetch_array($ret))
{
# code...
?>
<div class="col-list-3">
<div class="recent-Cake-list">
<div class="car-info-box"> <a href="product-details.php?pid=<?php echo htmlentities($row['id']);?>"><img src="admin/productimages/<?php echo htmlentities($row['id']);?>/<?php echo htmlentities($row['productImage1']);?>" data-echo="admin/productimages/<?php echo htmlentities($row['id']);?>/<?php echo htmlentities($row['productImage1']);?>" class="img-responsive" alt="image"></a>
</div>
<div class="Cake-title-m" style="color:black;">
<h4><a href="product-details.php?pid=<?php echo htmlentities($row['id']);?>"><?php echo htmlentities($row['productName']);?></a></h4>
<span class="price">Ksh <?php echo htmlentities($row['productPrice']);?> <s> Ksh <?php echo htmlentities($row['productPriceBeforeDiscount']);?></s></span>
</div>
<div class="inventory_info_m">
<iframe name="Framename" src="rating/index.php" width="100" height="120" frameborder="0" scrolling="no" style="width:100%;"> </iframe>
<div class="action"><a href="index.php?page=product&action=add&id=<?php echo $row['id']; ?>" class="lnk btn btn-primary">Add to Cart</a></div>
</div>
</div>
</div>
<?php }?>
</div>
</div>
</div>
</section>
<!-- /Resent Cat -->
<?php
include('includes/config2.php'); ?>
<!--Testimonial -->
<section class="section-padding testimonial-section parallex-bg">
<div class="container div_zindex">
<div class="section-header white-text text-center">
<h2>Our Satisfied <span>Customers</span></h2>
</div>
<div class="row">
<div id="testimonial-slider">
<?php
$tid=1;
$sql = "SELECT pato_testimonial.Testimonial,pato_users.FullName from pato_testimonial join pato_users on pato_testimonial.UserEmail=pato_users.EmailId where pato_testimonial.status=:tid";
$query = $dbh -> prepare($sql);
$query->bindParam(':tid',$tid, PDO::PARAM_STR);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{ ?>
<div class="testimonial-m">
<div class="testimonial-content">
<div class="testimonial-heading">
<h5><?php echo htmlentities($result->FullName);?></h5>
<p><?php echo htmlentities($result->Testimonial);?></p>
<!-- <iframe name="Framename" src="rating/index.php" width="100" height="120" frameborder="0" scrolling="no" style="width:100%;"> </iframe> -->
</div>
</div>
</div>
<?php }} ?>
</div>
</div>
</div>
<!-- Dark Overlay-->
<div class="dark-overlay"></div>
<?php include('includes/footer.php');?>
</section>
<!-- /Testimonial-->
<!--Footer -->
<!-- /Footer-->
<!--Back to top-->
<div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-hidden="true"></i> </a> </div>
<!--/Back to top-->
<!--Login-Form -->
<!--/Forgot-password-Form -->
<!-- Scripts -->
<script src="assets2/js/jquery.min.js"></script>
<script src="assets2/js/bootstrap.min.js"></script>
<script src="assets2/js/interface.js"></script>
<!--bootstrap-slider-JS-->
<script src="assets2/js/bootstrap-slider.min.js"></script>
<!--Slider-JS-->
<script src="assets2/js/slick.min.js"></script>
<script src="assets2/js/owl.carousel.min.js"></script>
</body>
</html>