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 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
|
<?php session_start(); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_update"])) && ($_POST["MM_update"] == "Quantite")) {
$updateSQL = sprintf("UPDATE shop_panier SET client_cookie=%s, article=%s, quantite=%s WHERE id_panier=%s",
GetSQLValueString($_POST['client_cookie'], "text"),
GetSQLValueString($_POST['article'], "int"),
GetSQLValueString($_POST['quantite'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_HvdBoutique, $HvdBoutique);
$Result1 = mysql_query($updateSQL, $HvdBoutique) or die(mysql_error());
$updateGoTo = "panier.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .='quantite='. $_POST['quantite'];
header(sprintf("Location: %s", $updateGoTo));
}
$paramClient_VPanier = "0";
if (isset($_COOKIE['monpanier'])) {
$paramClient_VPanier = (get_magic_quotes_gpc()) ? $_COOKIE['monpanier'] : addslashes($_COOKIE['monpanier']);
}
mysql_select_db($database_HvdBoutique, $HvdBoutique);
$query_VPanier = sprintf("SELECT shop_panier.*, shop_livres.titre, shop_livres.photo, shop_livres.prix_ttc, (shop_livres.prix_ttc* shop_panier.quantite) AS total_ttc FROM shop_panier INNER JOIN shop_livres ON shop_panier.article=shop_livres.id_livres WHERE client_cookie = %s", GetSQLValueString($paramClient_VPanier, "text"));
$VPanier = mysql_query($query_VPanier, $HvdBoutique) or die(mysql_error());
$row_VPanier = mysql_fetch_assoc($VPanier);
$totalRows_VPanier = mysql_num_rows($VPanier);
$paramClient_Total = "0";
if (isset($_COOKIE['monpanier'])) {
$paramClient_Total = (get_magic_quotes_gpc()) ? $_COOKIE['monpanier'] : addslashes($_COOKIE['monpanier']);
}
mysql_select_db($database_HvdBoutique, $HvdBoutique);
$query_Total = sprintf("SELECT now() AS date, SUM(shop_panier.quantite*shop_livres.prix_ttc) AS total_ttc FROM shop_panier INNER JOIN shop_livres ON shop_livres.id_livres = shop_panier.article WHERE shop_panier.client_cookie = %s GROUP BY shop_panier.client_cookie", GetSQLValueString($paramClient_Total, "text"));
$Total = mysql_query($query_Total, $HvdBoutique) or die(mysql_error());
$row_Total = mysql_fetch_assoc($Total);
$totalRows_Total = mysql_num_rows($Total);
$colname_Client = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Client = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_HvdBoutique, $HvdBoutique);
$query_Client = sprintf("SELECT * FROM shop_client WHERE mail = %s", GetSQLValueString($colname_Client, "text"));
$Client = mysql_query($query_Client, $HvdBoutique) or die(mysql_error());
$row_Client = mysql_fetch_assoc($Client);
$totalRows_Client = mysql_num_rows($Client);
// inserttion d'un cookie pour identifier le client
if (!isset($_COOKIE['monpanier']))
{
$bt_sid = date("U") . getMyPid();
setcookie("monpanier",$bt_sid,time()+3600); /* expire dans une heure */
}
?>
<!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"><!-- InstanceBegin template="/Templates/Model Prin.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Document sans nom</title>
<!-- InstanceEndEditable -->
<link href="file:///F|/wamp/www/HvdBoutique/CSS/Style CSS.css" rel="stylesheet" type="text/css" />
<link href="file:///F|/wamp/www/HvdBoutique/CSS/style.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' 1 2 3 4......\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' limite de '+min+' à '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' 1 2 3 4...\n'; }
} if (errors) alert('Vous devez taper les chiffre !\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
<!-- InstanceEndEditable -->
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '\n'; }
} if (errors) alert('Saisissez votre recherche\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>
<body>
<div id="page">
<!--début banner -->
<div id="banner">ds</div>
<!--fin banner -->
<!--début menu -->
<div id="menu">
<ul>
<li></li>
<li><a href="EspaceClient/index.php">Espace Client</a></li>
<li><a href="#">Conctact</a></li>
<li><a href="#">Soldes</a></li>
<li><a href="#">Info</a></li>
<li><a href="index.php">Acceuil</a></li>
</ul>
</div>
<!--fin menu -->
<!--début recherche -->
<div id="recherche">
<table width="470" height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="470"><form action="resultat.php" method="post" name="Recherche" id="Recherche" onsubmit="MM_validateForm('MotCle','','R');return document.MM_returnValue">
<label> <img src="Image/fleche.png" width="12" height="12" /> <span class="textblanc_gras"></span><span class="textnoir_gras">Recherche ...</span>
<input name="MotCle" type="text" id="MotCle" size="26" />
</label>
<label>
<input type="submit" name="Submit" value="OK" />
</label>
</form></td>
</tr>
</table>
</div>
<!--fin recherche -->
<!--début navigation -->
<div id="navigation">"navigation"</div>
<!--fin navigation -->
<!--début gauche -->
<div id="gauche">
<table width="95%" height="61" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="61"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="gauche_box">
<tr>
<td width="15%" background="file:///F|/wamp/www/HvdBoutique/Image/BlockHeader.png"><div align="center"><img src="Image/IconeMenu.png" width="17" height="17" /></div></td>
<td width="86%" height="25" background="file:///F|/wamp/www/HvdBoutique/Image/BlockHeader.png"><p class="gauche_text">INFORMATIQUE</p></td>
</tr>
<tr>
<td colspan="2"><ul id="MenuBar1" class="MenuBarVertical">
<li><a class="MenuBarItemSubmenu" href="#">Processeurs</a>
<ul>
<li><a href="#">Intel Socket LGA 775</a></li>
<li><a href="#">Intel Core i7</a></li>
<li><a href="#">AMD Socket AM2/AM2</a></li>
<li><a href="#">AMD Socket AM3</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Cartes mères</a>
<ul>
<li><a href="#">Intel Socket LGA 775</a></li>
<li><a href="#">Intel Socket LGA 1366</a></li>
<li><a href="#">AMD Socket AM2/AM2+</a></li>
<li><a href="#">AMD Socket AM3</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">Cartes mères</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="#">Elément 3.1</a>
<ul>
<li><a href="#">Elément 3.1.1</a></li>
<li><a href="#">Elément 3.1.2</a></li>
</ul>
</li>
<li><a href="#">Elément 3.2</a></li>
<li><a href="#">Elément 3.3</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Boitiers PC & Alimentations</a>
<ul>
<li><a href="#">Boitiers PC</a></li>
<li><a href="#">Alimentations</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Cartes graphiques</a>
<ul>
<li><a href="#">ATI</a></li>
<li><a href="#">NVIDIA </a></li>
</ul>
</li>
</ul>
</td>
</tr>
</table></td>
</tr>
</table>
<br />
<table width="100%" height="61" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="61"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="gauche_box">
<tr>
<td width="15%" background="file:///F|/wamp/www/HvdBoutique/Image/BlockHeader.png"><div align="center"><img src="Image/IconeMenu.png" alt="" width="17" height="17" /></div></td>
<td width="86%" height="25" background="file:///F|/wamp/www/HvdBoutique/Image/BlockHeader.png"><p class="gauche_text">CD & DVD Vierge</p></td>
</tr>
<tr>
<td colspan="2"><ul id="MenuBar2" class="MenuBarVertical">
<li><a class="MenuBarItemSubmenu" href="#">CD-R</a>
<ul>
<li><a href="#">Elément 1.1</a></li>
<li><a href="#">Elément 1.2</a></li>
<li><a href="#">Elément 1.3</a></li>
</ul>
</li>
<li><a href="#">DVD-R</a></li>
<li><a class="MenuBarItemSubmenu" href="#">DVD+R</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="#">Elément 3.1</a>
<ul>
<li><a href="#">Elément 3.1.1</a></li>
<li><a href="#">Elément 3.1.2</a></li>
</ul>
</li>
<li><a href="#">Elément 3.2</a></li>
<li><a href="#">Elément 3.3</a></li>
</ul>
</li>
<li><a href="#">DVD-RW</a></li>
<li><a href="#">DVD+RW</a></li>
</ul>
</td>
</tr>
</table></td>
</tr>
</table>
<br />
</div>
<!--fin gauche -->
<!--début centre -->
<div id="centre"><!-- InstanceBeginEditable name="ContenuCentre" -->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="centre_box">
<tr>
<td width="33%" height="25" class="textnoir_gras"><div align="center" class="textnoir_titre">1.Validation du panier</div></td>
<td width="34%" class="textnoir_titre"><div align="center" class="textnoir_gras">2.Vos information</div></td>
<td width="33%" class="textnoir_gras"><div align="center">3.Moyen de paiement</div></td>
</tr>
</table>
<?php if ($totalRows_VPanier == 0) { // Show if recordset empty ?>
<div align="center" class="textnoir_titre">Votre panier est vide ! </div>
<?php } // Show if recordset empty ?>
<br />
<?php if ($totalRows_VPanier > 0) { // Show if recordset not empty ?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" >
<tr bgcolor="#FFFFFF">
<td width="35" height="30" bgcolor="#EBEBEB" class="text_khung"> </td>
<td width="307" height="30" align="center" bgcolor="#EBEBEB" class="text_khung"><strong class="textnoir_gras">Article</strong></td>
<td width="60" align="center" bgcolor="#EBEBEB" class="text_khung"><strong class="textnoir_gras">Prix Unitaire</strong></td>
<td width="120" align="center" bgcolor="#EBEBEB" class="text_khung"><strong class="textnoir_gras">Quantité</strong></td>
<td width="25" align="center" bgcolor="#EBEBEB"><img src="Image/corbeille.gif" width="12" height="17" /></td>
<td width="50" align="center" bgcolor="#EBEBEB"><strong class="textnoir_gras">Poids</strong></td>
<td width="100" align="center" bgcolor="#EBEBEB"><strong class="text_noir">Prix TTC</strong></td>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF">
<td width="35" height="40"><div align="center"><img src="Photo/<?php echo $row_VPanier['photo']; ?>.gif" width="30" height="30" /></div></td>
<td height="30" bgcolor="#FFFFFF" class="text_noir"><?php echo $row_VPanier['titre']; ?></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir"><?php echo ($row_VPanier['prix_ttc']. " €") ?></div></td>
<td><form action="<?php echo $editFormAction; ?>" onSubmit="javascript:document.Quantite.submit();" method="POST" name="Quantite" id="Quantite" >
<div align="center">
<select name="quantite" id="quantite" onchange="javascript:document.Quantite.submit();">
<option <?php if ($_GET['quantite'] == 1) echo 'selected="selected"'; ?> value="1">1</option>
<option <?php if ($_GET['quantite'] == 2) echo 'selected="selected"'; ?> value="2">2</option>
<option <?php if ($_GET['quantite'] == 3) echo 'selected="selected"'; ?> value="3">3</option>
<option <?php if ($_GET['quantite'] == 4) echo 'selected="selected"'; ?> value="4">4</option>
</select>
<input name="id" type="hidden" id="id" value="<?php echo $row_VPanier['id_panier']; ?>" />
<input name="client_cookie" type="hidden" id="client_cookie" value="<?php echo $row_VPanier['client_cookie']; ?>" />
<input name="article" type="hidden" id="article" value="<?php echo $row_VPanier['article']; ?>" />
<input type="hidden" name="MM_update" value="Quantite" />
</div>
</form></td>
<td><div align="center"><a href="sup_article.php?id=<?php echo $row_VPanier['id_panier']; ?>"><img src="Image/corbeille.gif" width="12" height="17" border="0" /></a></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir"><?php echo $row_VPanier['poids_tt']; ?></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir"><?php echo ($row_VPanier['total_ttc']. " €") ?></div></td>
</tr>
<?php } while ($row_VPanier = mysql_fetch_assoc($VPanier)); ?>
<tr bgcolor="#FFFFFF">
<td height="18"> </td>
<td height="30"> </td>
<td> </td>
<td colspan="2" bgcolor="#FFFFFF"><strong class="text_noir">Livraison avec poids:</strong></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir">
<div align="center"><?php echo $row_Total['poids_ttc']; ?></div>
</div></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir">
<?php
// --- Calcule frais de port
error_reporting(E_ALL | E_STRICT);
if ($row_Total['poids_ttc'] <= 0.40)
{
$row_Total['total_ttc'] = $row_Total['total_ttc'] + $row_Total['port'];
echo ($row_Total['port']. " €");
}
elseif ($row_Total['poids_ttc'] == 0.50 OR $row_Total['poids_ttc'] < 1 )
{
$row_Total['total_ttc'] = $row_Total['total_ttc'] + $row_Total['port_moyen'];
echo ($row_Total['port_moyen']. " €");
}
elseif ($row_Total['poids_ttc'] < 10)
{
$row_Total['total_ttc'] = $row_Total['total_ttc'] + $row_Total['port_plus'];
echo ($row_Total['port_plus']. " €");
}
else
{
$row_Total['port'] = 0;
echo "0 ";
}
?>
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="18"> </td>
<td height="30"> </td>
<td> </td>
<td colspan="3" bgcolor="#FFFFFF"><div align="right" class="text_noir"><strong>Prix Total TTC :</strong></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="text_noir"><?php echo ($row_Total['total_ttc']. " €")?></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="18"> </td>
<td height="30"> </td>
<td> </td>
<td colspan="4" bgcolor="#FFFFFF"><?php
// Affiche si qu'il n'y pas de seesion
if (!isset($_SESSION['MM_Username'])) {
?>
<form id="Alert" name="Alert" method="get" action="login.php">
<input name="Submit_Alert" type="submit" id="Submit2" onclick="MM_popupMsg('Vous devez identifier pour passer la commande !')" value="Passer commande" />
</form>
<?php
// Affiche si qu'il y de session
} else { ?>
<form action="EspaceClient/infoperso_commande.php" method="get" name="Validation" id="Validation2">
<input type="submit" name="Submit_Valider" id="Submit_Valider" value="Passer commande S" />
</form>
<?php
// Fin code
}
?> </td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<br />
<!-- InstanceEndEditable --></div>
<!--fin centre -->
<!--début droite -->
<div id="droite"><!-- InstanceBeginEditable name="ContenuDroite" -->
<table width="99%" height="60" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="60" valign="top"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="droite_box">
<tr>
<td width="15%" background="Image/BlockHeader.png"><div align="center"><img src="Image/IconeMenu.png" width="17" height="17" /></div></td>
<td width="86%" height="25" background="Image/BlockHeader.png" class="droite_text">Mon Panier</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<br />
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="droite_box">
<tr>
<td width="15%" background="Image/BlockHeader.png"><div align="center"><img src="Image/IconeMenu.png" width="17" height="17" /></div></td>
<td width="86%" height="25" background="Image/BlockHeader.png" class="droite_text">Mon Compte</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
</tr>
</table>
<!-- InstanceEndEditable --></div>
<!--fin droite -->
<!--début pied -->
<div id="pied">
<p align="center"><a href="#">Contact</a> - <a href="#">Plan site</a> - <a href="#">Info</a></p>
</div>
<!--fin pied -->
</div>
</div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($VPanier);
mysql_free_result($Total);
mysql_free_result($Client);
?> |