Commit a4c06427 authored by Fleure Valentine's avatar Fleure Valentine
Browse files

Modifier compte fonctionne et il reste le panier

parent d0775834
......@@ -18,10 +18,10 @@
<div>
<table id="menu">
<tr >
<td class="bouton_menu"><a href="Accueil_sans_connexion.html">Accueil</a></td>
<td class="bouton_menu"><a href="Compte.html">Connexion</a></td>
<td class="bouton_menu"><a href="Accueil_sans_connexion.php">Accueil</a></td>
<td class="bouton_menu"><a href="Page_de_connexion.php">Connexion</a></td>
<td class="grise"><a href="Catalogue_sans_connexion.php">Catalogue</a></td>
<td class="bouton_menu"><a href="QuiSommesNous.html">Qui Sommes nous</a></td>
<td class="bouton_menu"><a href="QuiSommesNousSansConnexion.php">Qui Sommes nous</a></td>
</tr>
</table>
</div>
......
......@@ -12,6 +12,16 @@ abstract class Biere
// Accesseurs
public function __construct($n, $f, $p, $d, $t, $qteR, $ty){
$this->nom = $n;
$this->format = $f;
$this->prix = $p;
$this->degre = $d;
$this->taille = $t;
$this->qteRestante = $qteR;
$this->type = $ty;
}
public function getNom(){
return $this->nom;
}
......
<?php
require_once'utilisateur.class.php';
session_start();
$user="vfleure";
$pw="1107412";
$_SESSION['message']='';
// Connexion à la BD
try {
$bd = new PDO("mysql:host=gm6.insa-rouen.fr;dbname=vfleure", $user, $pw);
} catch (Exception $e) {
die($e->getMessage());
}
if (isset($_SESSION['message']) and $_SESSION['message']!='') {
echo '<script type="text/javascript"> alert("'.$_SESSION['message'].'") </script>';
}
......@@ -8,11 +21,17 @@ $_SESSION['message']='';
?>
<?php
function ajouterDansLePanier($donnee){
$_SESSION['nomBiere']=$donnee['nom'];
$_SESSION['volumeBiere']=$donnee['volume'];
$_SESSION['nomBiere']=$donnee['nom'];
$_SESSION['nomBiere']=$donnee['nom'];
}
function afficherBiereAC($donnee){
echo "<div class=\"biere_catalogue\">";
echo "<img src=".$donnee['nom'].".jpeg\" alt=\"Photo de biere\" id=\"photo_biere_catalogue\"/>";
echo "<img src=\"".$donnee['nom'].".jpeg\" alt=\"Photo de biere\" id=\"photo_biere_catalogue\"/>";
echo "<div class=\"description_et_ajout\">";
echo "<h6> ".$donnee['nom']." </h6>";
echo "<p> ".$donnee['description']." </p>";
......@@ -21,13 +40,14 @@ function afficherBiereAC($donnee){
echo "<p> ".$donnee['format']." de ".$donnee['volume']." cl.</p>";
echo "<form id=\"ajout\" action=\"ajouterPanier.php method=\"POST\"> ";
echo "<input type=\"number\" name=\"quantite\" min=\"1\" size=\"5\">";
echo "<input type=\"submit\" value=\"Ajouter au panier\">";
echo "</form>";
echo "</div>";
echo "</div>";
echo "<input type=\"submit\" value=\"Ajouter au panier\" action = <?php echo $_SESSION['utilisateur']->ajouterAuPanier>";
echo "</form>";
echo "</div>";
echo "</div>";
}
?>
<!--DOCTYPE html-->
<html>
<head>
......@@ -77,10 +97,10 @@ echo "</div>";
<h2>Blondes</h2>
<div id="bieres_catalogue">
<?php
<?php
$cat = 'blonde';
$re = $bd->prepare('SELECT * FROM Bieres WHERE categorie= ?');
$re->execute(array($cat));
$re = $bd->prepare('SELECT * FROM Bieres WHERE categorie= :nomCat');
$re->execute(array('nomCat' => $cat));
while ($donnee = $re->fetch()){
afficherBiereAC($donnee);
}
......
......@@ -17,10 +17,10 @@ try {
<?php
function afficherBiereSC($donnee){
echo "<div class=\"biere_catalogue\">";
echo "<img src=".$donnee['nom']."jpeg\" alt=\"Photo de biere\" id=\"photo_biere_catalogue\"/>";
echo "<img src=\"".$donnee['nom'].".jpeg\" alt=\"Photo de biere\" id=\"photo_biere_catalogue\">";
echo "<div class=\"description_et_ajout\">";
echo "<h6> ".$donnee['nom']." </h6>";
echo "<p> ".$donnee['description']." </p>";
echo "<p> ".$donnee['description']." euros </p>";
echo "<p> Prix : ".$donnee['prixunitaire']." </p>";
echo "<p> Degré : ".$donnee['degAlcool']." </p>";
echo "<p> ".$donnee['format']." de ".$donnee['volume']." cl.</p>";
......@@ -51,10 +51,10 @@ echo "</div>";
<div>
<table id="menu">
<tr >
<td class="bouton_menu"><a href="Accueil_sans_connexion.html">Accueil</a></td>
<td class="bouton_menu"><a href="Compte.html">Connexion</a></td>
<td class="bouton_menu"><a href="Accueil_sans_connexion.php">Accueil</a></td>
<td class="bouton_menu"><a href="Page_de_connexion.php">Connexion</a></td>
<td class="grise"><a href="Catalogue_sans_connexion.php">Catalogue</a></td>
<td class="bouton_menu"><a href="QuiSommesNous.html">Qui Sommes nous</a></td>
<td class="bouton_menu"><a href="QuiSommesNousSansConnexion.php">Qui Sommes nous</a></td>
</tr>
</table>
</div>
......
......@@ -14,6 +14,10 @@ font-size:150%;
margin: auto;
width:30%;
}
.texte_mdp {
font-size:100%;
}
.infos
......
<?php
require_once("utilisateur.class.php");
session_start();
?>
......@@ -56,19 +57,19 @@ session_start();
<table>
<tr>
<td><label for="name"> Prénom : </label></td>
<td><input placeholder="Prénom" name="name" type="text" size= "30" /></td>
<td><input placeholder= "Prenom" name="name" type="text" size= "30" value=<?php echo $_SESSION['utilisateur']->getPrenom() ?> /></td>
</tr>
<tr>
<td><label for="surname"> Nom : </label></td>
<td><input placeholder= "Nom" name="surname" type="text" size= "30" /></td>
<td><input placeholder= "Nom" name="surname" type="text" size= "30" value=<?php echo $_SESSION['utilisateur']->getNom() ?> /></td>
</tr>
<tr>
<td><label for="email"> E-mail : </label></td>
<td><input placeholder= "Adresse mail" name="email" type="text" size= "30" /></td>
<td><input placeholder= "Adresse mail" name="email" type="email" size= "30" value=<?php echo $_SESSION['utilisateur']->getMail() ?> /></td>
</tr>
<tr>
<td><label for="pwds"> Mot de passe : </label></td>
<td><input placeholder= "Mot de passe" type="password" size= "30" /></td>
<tr>
<td><label for="pwds"> Mot de passe* : </label></td>
<td><input placeholder= "Mot de passe" name="pwds" type="password" size= "30" /></td>
</tr>
</table>
<div id="bouton_modifier" >
......@@ -79,7 +80,7 @@ session_start();
</form>
</div>
<p id='texte_mdp'> * Si vous voulez changer votre mot de passe, entrez le nouveau dans le champ. </p>
</body>
<footer> <!-- Message d'attention pour l'abus d'alcool -->
......
<?php
require_once("panier.class.php");
require_once("utilisateur.class.php");
session_start();
$user="vfleure";
......@@ -6,8 +8,7 @@ $pw="1107412";
$_SESSION['message']='';
error_reporting(E_ALL);
require_once("panier.class.php");
require_once("utilisateur.class.php");
// Connexion à la BD
try {
$bd = new PDO("mysql:host=gm6.insa-rouen.fr;dbname=vfleure", $user, $pw);
......@@ -41,6 +42,7 @@ else {
$panier = new panier();
$utilisateur = new utilisateur($donnees['prenom'],$donnees['nom'], $mail, $panier);
$_SESSION['utilisateur']=$utilisateur;
$_SESSION['text'] = 'caca';
// $_SESSION['search']="off";
header('Location:Accueil_avec_connexion.php');
}
......
<?php
echo'-1';
session_start();
echo '0';
require_once "utilisateur.class.php";
session_start();
$user="vfleure";
$pw="1107412";
$_SESSION['message']='';
echo '1';
// Connexion à la BD
try {
$bd = new PDO("mysql:host=gm6.insa-rouen.fr;dbname=vfleure", $user, $pw);
} catch (Exception $e) {
die($e->getMessage());
}
echo '2';
// On se protège
$nom= htmlspecialchars($_POST['name']);
$prenom= htmlspecialchars($_POST['surname']);
$mail= htmlspecialchars($_POST['mail']);
$prenom= htmlspecialchars($_POST['name']);
$nom= htmlspecialchars($_POST['surname']);
$mail= htmlspecialchars($_POST['email']);
$pwds= htmlspecialchars($_POST['pwds']);
echo '3';
if (empty($_POST['pwds'])){
$r = $bd->prepare('SELECT mdp FROM Utilisateur WHERE mail = :mail_verif');
$r->execute(array('mail_verif' => $_SESSION['utilisateur']->getMail())) or die(print_r($bd->errorInfo()));;
$verif_mdp1 = $r->fetch();
$verif_mdp = $verif_mdp1['mdp'];
echo $verif_mdp;
}
else{
$verif_mdp = hash('sha256', $_POST['pwds']);
}
// On prépare une requete
$req = $bd->prepare('UPDATE Utilisateur SET nom = :nom, prenom = :prenom, mail = :mail, mdp =:mdp WHERE mail = :mail_verif' );
$re->execute(array(
'nom' => $_POST['name'],
'prenom' => $_POST['surname'],
'mail' => $_POST['mail'],
'mdp' => hash('sha256', $_POST['pwds'],
$req = $bd->prepare('UPDATE Utilisateur SET nom =:nom, prenom = :prenom, mail = :mail, mdp = :mdp WHERE mail = :mail_verif');
$req->execute(array(
'nom' => $_POST['surname'],
'prenom' => $_POST['name'],
'mail' => $_POST['email'],
'mdp' => $verif_mdp,
'mail_verif' => $_SESSION['utilisateur']->getMail()
));
echo '4';
/*
$_SESSION['mail_utilisateur']=$_POST['mail'];
$_SESSION['nom_utilisateur']=$_POST['nom'];
$_SESSION['prenom_utilisateur']=$_POST['prenom'];
*/
$_SESSION['utilisateur']->setPrenom($_POST['surname']);
$_SESSION['utilisateur']->setNom($_POST['name']);
$_SESSION['utilisateur']->setMail($_POST['mail']);
echo '5';
// $_SESSION['search']="off";
header('Location:Accueil_avec_connexion.php');
))or die(print_r($bd->errorInfo()));
$_SESSION['utilisateur']->setPrenom($_POST['name']);
$_SESSION['utilisateur']->setNom($_POST['surname']);
$_SESSION['utilisateur']->setMail($_POST['email']);
header('Location:Accueil_avec_connexion.php');
?>
<?php
require_once("panier.class.php");
require_once("utilisateur.class.php");
session_start();
if (isset($_SESSION['message']) and $_SESSION['message']!='') {
......
<?php
require_once'utilisateur.class.php';
session_start();
$user="vfleure";
$pw="1107412";
$_SESSION['message']='';
$_SESSION['utilisateur']->ajouterAuPanier($biere,$_POST["quantite"]);
try {
$bd = new PDO("mysql:host=gm6.insa-rouen.fr;dbname=vfleure", $user, $pw);
} catch (Exception $e) {
die($e->getMessage());
}
$r = $bd->prepare('SELECT * FROM Bieres WHERE nom = ? AND format = ? AND volume = ? AND categorie = ?');
$r->execute(array($_SESSION['nomBiere'], $_SESSION['formatBiere'], $_SESSION['volumeBiere'], $_SESSION['categorieBiere']))or die(print_r($bd->errorInfo()));
$nom_biere = $r->fetch();
$_SESSION['utilisateur']->ajouterAuPanier($nom_Biere['nom'], $nom_Biere['format'], $nom_Biere['prixunitaire'], $nom_Biere['degAlcool'], $nom_Biere['volume'], $nom_Biere['qteRestante'], $nom_Biere['categorie'], $_SESSION['qteBiereVoulue']);
?>
......@@ -77,7 +77,8 @@ class utilisateur
$this->setMail($m); // Initialisation du mel
// + requet sql
}
public function ajouterAuPanier($biere, $qte){
public function ajouterAuPanier($n, $f, $p, $d, $t, $qteR, $ty, $qte){
$biere = new Biere($n, $f, $p, $d, $t, $qteR, $ty);
$commandes=$this->getPanier()->getCommande();
$verif = true;
foreach($commandes as $value){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment