include ("definitioninfo.php");
include ("aff_panier.inc.php");
"".$date = date("L/m/Y ");
"".$date2 = date("d/m/Y H:i:s");
echo"
".$date2."
";
if (!session_id())
session_start();
$pseudo = $_SESSION['pseudo'];
echo $pseudo;
if (!isset($_SESSION['panier']))
{
$panier = array (
"ref_produit" => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20),
"quantite" => array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
);
$_SESSION['panier'] = $panier;
$_SESSION['total'] = 0;
}
for ($i = 0; $i < 20; $i++)
{
$quantite = $_POST['quantite'];
$article = $_POST['article'];
if(!($base=mysql_connect("localhost","root","")))
{
echo "
probleme lors de la connexion à MySql
";
exit();
}
else
{
mysql_select_db(BASE, $base);
if (($tab_com = mysql_query("SELECT ref_produit, designation_produit, prix_produit
FROM produit
WHERE designation_produit = '".$article."'", $base)))
$res_com = mysql_fetch_array($tab_com);
$_SESSION['article'] = $res_com[1];
$_SESSION['prix'] = $res_com[2];
$_SESSION['quantite'] = $quantite;
$_SESSION['ref_produit']= $res_com[0];
_SESSION['panier']['quantite'][$_SESSION['ref_produit']] = $_SESSION['panier']['quantite'][$_SESSION['ref_produit']]+$quantite;
$_SESSION['total'] = $_SESSION['total']+($res_com[2]*$quantite);
echo "
Votre Panier de Commande :
".$_SESSION['total']." € | |||||