Example #1
0
<form method="post" action="panier.php">
<table style="width: 400px">
	<tr>
		<td colspan="4">Votre panier</td>
	</tr>
	<tr>
		<td>Libellé</td>
		<td>Quantité</td>
		<td>Prix Unitaire</td>
		<td>Action</td>
	</tr>

<?php 
ajouterArticle("Puls", 3, 19, 99);
ajouterArticle("yolo", 3, 19, 99);
?>
	<?php 
if (creationPanier()) {
    $nbArticles = count($_SESSION['panier']['libelleProduit']);
    if ($nbArticles <= 0) {
        echo "<tr><td>Votre panier est vide </ td></tr>";
    } else {
        for ($i = 0; $i < $nbArticles; $i++) {
            echo "<tr>";
            echo "<td>" . htmlspecialchars($_SESSION['panier']['libelleProduit'][$i]) . "</ td>";
            echo "<td><input type=\"text\" size=\"4\" name=\"q[]\" value=\"" . htmlspecialchars($_SESSION['panier']['qteProduit'][$i]) . "\"/></td>";
            echo "<td>" . htmlspecialchars($_SESSION['panier']['prixProduit'][$i]) . "</td>";
            echo "<td><a href=\"" . htmlspecialchars("panier.php?action=suppression&l=" . rawurlencode($_SESSION['panier']['libelleProduit'][$i])) . "\">XX</a></td>";
            echo "</tr>";
        }
Example #2
0
   if (is_array($q)){
      $QteArticle = array();
      $i=0;
      foreach ($q as $contenu){
         $QteArticle[$i++] = intval($contenu);
      }
   }
   else
   $q = intval($q);
    
}

if (!$erreur){
   switch($action){
      Case "ajout":
         ajouterArticle($l,$q,$p);
         break;

      Case "suppression":
         supprimerArticle($l);
         break;

      Case "refresh" :
         for ($i = 0 ; $i < count($QteArticle) ; $i++)
         {
            modifierQTeArticle($_SESSION['panier']['libelleProduit'][$i],round($QteArticle[$i]));
         }
         break;

      Default:
         break;
Example #3
0
if (isset($_SESSION['pseudo']) && isset($_SESSION['Mot_de_passe'])) {
    if (isset($_GET['id'])) {
        if ($conx = mysql_connect("localhost", "root", "")) {
            if ($db = mysql_select_db("jeux")) {
                $recherche = mysql_real_escape_string(htmlspecialchars($_GET['id']));
                $selection_recherche = mysql_query("SELECT * FROM games WHERE id={$recherche}", $conx);
                $nombre_resultats = mysql_num_rows($selection_recherche);
                if ($nombre_resultats == 0) {
                    echo '<h2><strong>Ce jeu n\'est pas Dispo sur Notre Site</h2></strong>';
                } elseif ($resultats = mysql_fetch_array($selection_recherche)) {
                    $nomProduit = $resultats['nom'];
                    $prixProduit = $resultats['prix'];
                    $console = $resultats['console'];
                }
                creationPanier();
                ajouterArticle($nomProduit, $prixProduit, $console);
                header('Location:index.php?select=produit&prd=InfoGame&d=' . $resultats['id'] . '#n1');
            }
            mysql_close($conx);
        } else {
            die("Echec de connexion au serveur de base de données.");
        }
    }
    if (isset($_GET['name']) && isset($_GET['con'])) {
        $nomProduit = htmlspecialchars($_GET['name']);
        $console = htmlspecialchars($_GET['con']);
        supprimerArticle($nomProduit, $console);
        header('Location:index.php?select=account&prd=commandes');
    }
    if (isset($_POST['name']) && isset($_POST['qt']) && $_POST['qt'] <= 5) {
        $nomProduit = htmlspecialchars($_POST['name']);