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
| <?php
session_start();
include_once("fonctions-panier.php");
if (isset($_GET['action']))
{
$erreur=false;
if(in_array( $_GET['action'],array('ajout', 'suppression', 'refresh')))
$action = $_GET['action'];
else
$erreur=true;
$l = preg_replace('#\v#', '', $_GET['l']);
$q = intval($_GET['q']);
$p = floatval($_GET['p']);
}
elseif(isset($_POST['action']))
{
unset($_GET);
$erreur=false;
if(in_array($_POST['action'],array('ajout', 'suppression', 'refresh')))
$action=$_POST['action'];
else
$erreur=true;
$l = preg_replace('#\v#', '',$_POST['l']);
$p = floatval($_POST['p']);
$QteArticle = array();
$i=0;
foreach ($_POST['QteArticle'] as $contenu){
$QteArticle[$i++] = intval($contenu);
}
}
if ($erreur==false){
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;
}
}
echo '<?xml version="1.0" encoding="utf-8"?>';?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aequalis Informatique - Panier</title>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
<link href="/SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href=/aequalis.css" rel="stylesheet" type="text/css" media="screen">
</head>
<body>
<div id="content">
<h1>Votre panier ...</h1>
<p>
<form method="post" action="panier.php">
<table style="width: 700px" border ="0">
<tr>
<td><font face='arial' size='3' color='#000066'><b>Référence</b></font></td>
<td><font face='arial' size='3' color='#000066'><b>Libellé</b></font></td>
<td align='center'><font face='arial' size='3' color='#000066'><b>Quantité</b></td>
<td align='right'><font face='arial' size='3' color='#000066'><b>Prix Unitaire</b></td>
<td align='center'> </td>
</tr>
<?
if (creationPanier())
{
$nbArticles=count($_SESSION['panier']['libelleProduit']);
if ($nbArticles <= 0)
echo "<tr><td><font face='arial' size='2' color='#000066'>Votre panier est vide </font></ td></tr>";
else
{
for ($i=0 ;$i < $nbArticles ; $i++)
{
echo "<tr></tr>";
echo "<tr>";
echo "<td><font face='arial' size='2' color='#000066'>".htmlspecialchars($_SESSION['panier']['libelleProduit'][$i])."</font></td>";
echo "<td align='center'><font face='arial' size='2' color='#000066'><input type=\"text\" size=\"2\" name=\"QteArticle[]\" value=\"".htmlspecialchars($_SESSION['panier']['qteProduit'][$i])."\"/></font></td>";
echo "<td align='right'><font face='arial' size='2' color='#000066'>".number_format(htmlspecialchars($_SESSION['panier']['prixProduit'][$i]),2)." </font></td>";
echo "<td align='center'><a href=\"".htmlspecialchars("panier.php?action=suppression&l=".rawurlencode($_SESSION['panier']['libelleProduit'][$i]))."\"><img src='http://scoot.master.free.fr/images/croix.jpg' border='0' /></a></td>";
echo "</tr>";
}
echo "<tr><td colspan=\"2\"> </td>";
echo "<td colspan=\"1\" align='right'><font face='arial' size='3' color='#0066CC'><b>";
echo "Total : ".number_format(MontantGlobal(),2)." ";
echo "</b></font></td></tr>";
echo "<tr><td colspan=\"2\">";
echo "<input type=\"submit\" value=\"Rafraichir\"/>";
echo "<input type=\"hidden\" name=\"action\" value=\"refresh\"/>";
echo "</td></tr>";
}
}
?>
</table>
</form>
</p>
</div>
<div id="footer" class="clearfix">
<p align="center">
<!-- #BeginDate format:Fr1m -->31/07/09 13:28<!-- #EndDate -->
</p>
<p align="center">2008</p>
</div></div>
</body>
</html> |
Partager