Je n'arrive plus à supprimer un article du panier.

panier.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
 
// Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 
 
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}
 
$MM_restrictGoTo = "client_non_identifie.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
 
require_once('../Connections/xxx.php');
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
 
 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
  $insertSQL = sprintf("INSERT INTO commande (mail, `date`, ss_total_ttc, reduc, expedition, total_net) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['mail'], "text"),
                       GetSQLValueString($_POST['date'], "date"),
                       GetSQLValueString($_POST['ss_total_ttc'], "double"),
					   GetSQLValueString($_POST['reduc'], "double"),
					   GetSQLValueString($_POST['expedition'], "double"),
					   GetSQLValueString($_POST['total_net'], "double"));
 
  mysql_select_db($database_xxx, $xxx);
  $Result1 = mysql_query($insertSQL, $xxx) or die(mysql_error());
 
	$totalnet = $_POST['total_net'];
	$total = str_replace(".","",$totalnet);	
	$mail = $_POST['mail'];
 
  header("Location: http://www.xxx.com/compte/traitement_panier.php?total_net=$total&mail=$mail");
}
 
$paramclient_panier = "0";
if (isset($_SESSION['MM_Username'])) {
  $paramclient_panier = $_SESSION['MM_Username'];
}
mysql_select_db($database_xxx, $xxx);
$query_panier = sprintf("SELECT panier.*, produit.id, produit.nom_marque_produit, produit.modele, produit.couleur, produit.prix, produit.miniatures, (produit.prix*panier.quantite) AS ss_ss_total_ttc FROM panier INNER JOIN produit ON produit.id = panier.produit WHERE panier.client = %s", GetSQLValueString($paramclient_panier, "text"));
$panier = mysql_query($query_panier, $xxx) or die(mysql_error());
$row_panier = mysql_fetch_assoc($panier);
$totalRows_panier = mysql_num_rows($panier);
 
$paramclient_total = "0";
if (isset($_SESSION['MM_Username'])) {
  $paramclient_total = $_SESSION['MM_Username'];
}
mysql_select_db($database_xxx, $xxx);
$query_total = sprintf("SELECT now() AS date, SUM(panier.quantite*produit.prix) AS ss_total_ttc, CAST(SUM(panier.quantite*produit.prix/1.196) AS DECIMAL (10, 2)) AS ss_total_ht FROM panier INNER JOIN produit ON produit.id = panier.produit WHERE panier.client = %s GROUP BY panier.client ", GetSQLValueString($paramclient_total, "text"));
$total = mysql_query($query_total, $xxx) or die(mysql_error());
$row_total = mysql_fetch_assoc($total);
$totalRows_total = mysql_num_rows($total);
 
$paramclient_identite = "0";
if (isset($_SESSION['MM_Username'])) {
  $paramclient_identite = $_SESSION['MM_Username'];
}
mysql_select_db($database_xxx, $xxx);
$query_identite = sprintf("SELECT nom, prenom, type_client FROM client WHERE mail = %s", GetSQLValueString($paramclient_identite, "text"));
$identite = mysql_query($query_identite, $xxx) or die(mysql_error());
$row_identite = mysql_fetch_assoc($identite);
$totalRows_identite = mysql_num_rows($identite);
 
?>
 
<!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Transitional/EN" "http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:/www.w3.org/1999/xhtml">
<head>
<title>Panier</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
<link href="/style/style.css" rel="stylesheet" type="text/css">
 
	<?php include('/web/sites/vhbu3/3/105/124571/public/www/inc/script.inc.php'); ?> 
 
    <script language="JavaScript" type="text/JavaScript">
<!--
 
 
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
 
<body onload="MM_preloadImages('file:///SYSTEME/Users/veroniquepenot/Desktop/croix-suppr-gris.gif')">
<div id="page_panier">
 
		<?php include('/web/sites/vhbu3/3/105/124571/public/www/inc/bandeau_panier.inc.php'); ?>
<?php include('/web/sites/vhbu3/3/105/124571/public/www/inc/menu_top_compte.inc.php'); ?>
 
 
		<div id="no_menu_panier">
 
 
        <?php if ($totalRows_panier == 0) { // visible si l'enregistrement panier est vide ?>
  			<p class="infotexte"><?php echo $row_identite['prenom']; ?> <?php echo $row_identite['nom']; ?>, votre panier est vide.</p>
			<p class="infotexte">Pour commander des produits, cliquez sur l'onglet boutique ou <a href="http://www.xxx.com/index.php">ici</a>.</p>
  		<?php } // visible si l'enregistrement panier est vide ?>
 
		<?php if ($totalRows_panier > 0) { // visible si l'enregistrement panier n'est pas vide ?>
		<p class="infotexte">Panier de <?php echo $row_identite['prenom']; ?> <?php echo $row_identite['nom']; ?></p>
		<p class="infotexte">&nbsp;</p>
		<div id="panier_photo_intitule">Photo</div>
		<div id="panier_mmc_intitule">Marque</div>
		<div id="panier_mmc_intitule">Mod&egrave;le</div>
		<div id="panier_mmc_intitule">Couleur</div>
		<div id="panier_prixq_intitule">Taille</div>
		<div id="panier_prixq_intitule">Prix</div>
		<div id="panier_prixq_intitule">Quantit&eacute;</div>
		<div id="panier_sstot_intitule">Total</div>
 
		<?php do { ?>
	    <div id="panier_photo"><a href="http://www.xxx.com/boutique/produit.php?id=<?php echo $row_panier['id']; ?>"><img src="<?php echo $row_panier['miniatures']; ?>" name="Image1" border="0" id="Image1" /></a></div>
		<div id="panier_mmc"><?php echo $row_panier['nom_marque_produit']; ?> </div>
		<div id="panier_mmc"><?php echo $row_panier['modele']; ?> </div>
		<div id="panier_mmc"><?php echo $row_panier['couleur']; ?> </div>
		<div id="panier_prixq"><?php echo $row_panier['taille']; ?> </div>
		<div id="panier_prixq"><?php echo $row_panier['prix']; ?> &euro; </div>
		<div id="panier_prixq"><?php echo $row_panier['quantite']; ?> <br /> 
		 <a href="suppr_panier.php?id=<?php echo $row_panier['id']; ?>">Supprimer</a>
		  <br />
	    <a href="suppr_panier.php?id=<?php echo $row_panier['id']; ?>" target="_top"><img src="/images/croix-suppr-gris.gif" title="supprimer un produit du panier" alt="supprimer un produit du panier" name="supprimer" width="15" height="15" border="0" /></a> </div>
		<div id="panier_sstot"><?php echo $row_panier['ss_ss_total_ttc']; ?> &euro;  </div>  
	    <?php } while ($row_panier = mysql_fetch_assoc($panier)); ?>
 
 
			<div id="panier_tot_int">Sous-total TTC</div> 
			<div id="panier_tot"><?php echo $row_total['ss_total_ttc']; ?> &euro; </div> 
 
			<?php if ($row_identite['type_client'] != "normal") { // visible si le type de client différent de normal ?>
			<div id="panier_tot_int">R&eacute;duction : - 10 % </div> 
			<?php $reduc = bcmul($row_total['ss_total_ttc'], 0.1, 2) ; ?>
			<div id="panier_tot">- <?php echo $reduc; ?> &euro; </div> 
		<?php } // visible si le type de client différent de normal ?>
 
 
			<div id="panier_tot_int">Frais de port : offerts </div> 
			<?php $expedition = 0; ?>
			<div id="panier_tot"><?php echo $expedition; ?> &euro; </div> 
 
			<div id="panier_tot_int">Total (net &agrave; payer)</div> 
			<div id="panier_tot_gras">
			<?php if ($row_identite['type_client'] == "normal") {
			$totalnet = $row_total['ss_total_ttc']; 
			}else{
			$totalnet = bcmul($row_total['ss_total_ttc'], 0.9, 2) ;
			} 
			echo $totalnet;
			?>
			&euro; </div> 
			   <p>&nbsp; </p>
			<div id="commander">
 
			<input type="button" name="retour_boutique" value="Continuer mes achats" onclick="self.location.href='http://www.xxx.com/index.php'" id="boutons_achat" />
 
              <form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
                  <input type="submit" value="Valider ma commande" id="boutons_comde" />
                  <input type="hidden" name="mail" value="<?php echo $_SESSION['MM_Username']; ?>" />
                  <input type="hidden" name="date" value="<?php echo $row_total['date']; ?>" />
                  <input type="hidden" name="ss_total_ttc" value="<?php echo $row_total['ss_total_ttc']; ?>" />
				  <input type="hidden" name="reduc" value="<?php echo $reduc; ?>" />
				  <input type="hidden" name="expedition" value="<?php echo $expedition; ?>" />
				  <input type="hidden" name="total_net" value="<?php echo $totalnet; ?>" />
                  <input type="hidden" name="MM_insert" value="form2" />
 
              </form> 
		 	</div>
			<p>&nbsp; </p>
          <?php } // visible si l'enregistrement panier n'est pas vide ?>
  </div>
 
		<?php include('/web/sites/vhbu3/3/105/124571/public/www/inc/pdp.inc.php'); ?>
</div>
</body>
</html>
<?php
mysql_free_result($total);
?>
suppr_panier.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php require_once('../Connections/xxx.php'); 
 
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
 
if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
  $deleteSQL = sprintf("DELETE FROM panier WHERE id=%s",
                       GetSQLValueString($_GET['id'], "int"));
 
  mysql_select_db($database_xxx, $xxx);
  $Result1 = mysql_query($deleteSQL, $xxx) or die(mysql_error());
 
  $deleteGoTo = "panier.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}
 session_start();?>
Est-ce que quelqu'un voit d'où ça vient ?