Created
April 16, 2018 22:18
-
-
Save Battletoad21/76c196664df557f3b9c91750ecb9becb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php require 'inc/head.php'; | |
if (empty($_SESSION['loginname'])){ | |
header ("location: login.php"); | |
} | |
$panier = $_COOKIE["panier"]; | |
$total = 0; | |
$total += $panier["cookie1"]; | |
$total += $panier["cookie2"]; | |
$total += $panier["cookie3"]; | |
$total += $panier["cookie4"]; | |
?> | |
<section class="cookies container-fluid"> | |
<div class="row"> | |
<h3>Basket</h3> | |
<?php echo " there's " . $panier["cookie1"] . " Pecan Nuts <br/>";?> | |
<?php echo " there's " . $panier["cookie2"] . " Chocolate CHips <br/>";?> | |
<?php echo " there's " . $panier["cookie3"] . " Chocolate cookie <br/>";?> | |
<?php echo " there's " . $panier["cookie4"] . " mms <br/><br/>";?> | |
<a href="index.php"><button type="button" class="btn btn-warning">Modify basket</button><br/></a> | |
<a href="vider.php"><button type="button" class="btn btn-danger">rm rf basket</button></a> | |
</div> | |
</section> | |
<?php require 'inc/foot.php'; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
session_destroy(); | |
setCookie("panier[cookie1]", 0, time()-5); | |
setCookie("panier[cookie2]", 0, time()-5); | |
setCookie("panier[cookie3]", 0, time()-5); | |
setCookie("panier[cookie4]", 0, time()-5); | |
header('location: login.php'); | |
exit(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if(!empty($_POST['loginname'])) | |
{ | |
$_SESSION['loginname'] = $_POST['loginname']; | |
} | |
?> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr"> | |
<head> | |
<title>The Cookie Factory</title> | |
</head> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<link href="https://fonts.googleapis.com/css?family=Kaushan+Script" rel="stylesheet"> | |
<link rel="stylesheet" type="text/css" href="assets/styles.css" /> | |
<body> | |
<header> | |
<!-- MENU ENTETE --> | |
<nav class="navbar navbar-default navbar-fixed-top"> | |
<div class="container-fluid"> | |
<!-- Brand and toggle get grouped for better mobile display --> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" | |
data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> | |
<span class="sr-only">Toggle navigation</span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</button> | |
<a class="navbar-brand" href="index.php" > | |
<img class="pull-left" src="assets/img/cookie_funny_clipart.png" alt="The Cookies Factory logo"> | |
<h1>The Cookies Factory</h1> | |
</a> | |
</div> | |
<!-- Collect the nav links, forms, and other content for toggling --> | |
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
<ul class="nav navbar-nav navbar-right"> | |
<li><a href="#">Chocolates chips</a></li> | |
<li><a href="#">Nuts</a></li> | |
<li><a href="#">Gluten full</a></li> | |
<li> | |
<a href="cart.php" class="btn btn-warning navbar-btn"> | |
<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> | |
Cart | |
</a> | |
</li> | |
<li><a href="../disconnect.php" class="btn btn-danger">Logout</a></li> | |
</ul> | |
</div><!-- /.navbar-collapse --> | |
</div><!-- /.container-fluid --> | |
</nav> | |
<div class="container-fluid text-right"> | |
<?php if (!empty($_SESSION['loginname'])):?><strong>Hello <?= $_SESSION['loginname']?> !</strong> | |
<?php endif;?> | |
</div> | |
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'inc/head.php'; | |
if (empty($_SESSION['loginname'])){ | |
header ("location: login.php"); | |
exit(); | |
} | |
$panier = $_COOKIE["panier"]; | |
if (!empty($_GET)) { | |
switch ($_GET["ajouter"]) { | |
case "cookie1": | |
$panier["cookie1"]++; | |
setCookie("panier[cookie1]", $panier["cookie1"]); | |
break; | |
case "cookie2": | |
$panier["cookie2"]++; | |
setCookie("panier[cookie2]", $panier["cookie2"]); | |
break; | |
case "cookie3": | |
$panier["cookie3"]++; | |
setCookie("panier[cookie3]", $panier["cookie3"]); | |
break; | |
case "cookie4": | |
$panier["cookie4"]++; | |
setCookie("panier[cookie4]", $panier["cookie4"]); | |
break; | |
} | |
} | |
?> | |
<section class="cookies container-fluid"> | |
<div class="row"> | |
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> | |
<figure class="thumbnail text-center"> | |
<img src="assets/img/product-46.jpg" alt="cookies choclate chips" class="img-responsive"> | |
<figcaption class="caption"> | |
<h3>Pecan nuts</h3> | |
<p>Cooked by Penny !</p> | |
<a href="index.php?ajouter=cookie1" class="btn btn-primary"> | |
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add to cart | |
</a> | |
<?php echo $panier["cookie1"]?> | |
</figcaption> | |
</figure> | |
</div> | |
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> | |
<figure class="thumbnail text-center"> | |
<img src="assets/img/product-36.jpg" alt="cookies choclate chips" class="img-responsive"> | |
<figcaption class="caption"> | |
<h3>Chocolate chips</h3> | |
<p>Cooked by Bernadette !</p> | |
<a href="index.php?ajouter=cookie2" class="btn btn-primary"> | |
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add to cart | |
</a> | |
<?php echo $panier["cookie2"]?> | |
</figcaption> | |
</figure> | |
</div> | |
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> | |
<figure class="thumbnail text-center"> | |
<img src="assets/img/product-58.jpg" alt="cookies choclate chips" class="img-responsive"> | |
<figcaption class="caption"> | |
<h3>Chocolate cookie</h3> | |
<p>Cooked by Bernadette !</p> | |
<a href="index.php?ajouter=cookie3" class="btn btn-primary"> | |
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add to cart | |
</a> | |
<?php echo $panier["cookie3"]?> | |
</figcaption> | |
</figure> | |
</div> | |
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> | |
<figure class="thumbnail text-center"> | |
<img src="assets/img/product-32.jpg" alt="cookies choclate chips" class="img-responsive"> | |
<figcaption class="caption"> | |
<h3>M&M's© cookies</h3> | |
<p>Cooked by Penny !</p> | |
<a href="index.php?ajouter=cookie4" class="btn btn-primary"> | |
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add to cart | |
</a> | |
<?php echo $panier["cookie4"] ?> | |
</figcaption> | |
</figure> | |
</div> | |
</div> | |
</section> | |
<?php require 'inc/foot.php'; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if ((isset($_POST['loginname'])) && (!empty($_POST['loginname']))){ | |
$_SESSION['loginname'] = $_POST['loginname']; | |
header('location: index.php'); | |
exit(); | |
} | |
if ((isset($_SESSION['loginname'])) && (!empty($_SESSION['loginname']))){ | |
header ('location: index.php'); | |
exit(); | |
} | |
?> | |
<?php require 'inc/head.php'; ?> | |
<div class="container" style="margin-top:40px"> | |
<div class="row"> | |
<div class="col-sm-6 col-md-4 col-md-offset-4"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<strong> Sign in to continue</strong> | |
</div> | |
<div class="panel-body"> | |
<form role="form" action="#" method="POST"> | |
<fieldset> | |
<div class="row"> | |
<div class="center-block"> | |
<img class="profile-img" | |
src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120" alt=""> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-sm-12 col-md-10 col-md-offset-1 "> | |
<div class="form-group"> | |
<div class="input-group"> | |
<span class="input-group-addon"> | |
<i class="glyphicon glyphicon-user"></i> | |
</span> | |
<input class="form-control" placeholder="Username" name="loginname" type="text" autofocus> | |
</div> | |
</div> | |
<div class="form-group"> | |
<input type="submit" class="btn btn-lg btn-primary btn-block" value="Sign in"> | |
</div> | |
</div> | |
</div> | |
</fieldset> | |
</form> | |
</div> | |
<div class="panel-footer "> | |
Don't have an account ? <a href="#" onClick="">Too bad !</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php require 'inc/foot.php'; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
setCookie("panier[cookie1]", 0, time()+3600); | |
setCookie("panier[cookie2]", 0, time()+3600); | |
setCookie("panier[cookie3]", 0, time()+3600); | |
setCookie("panier[cookie4]", 0, time()+3600); | |
header("location: index.php"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment