//********************************** // DISCORAMA.FR // Code HTML/PHP: PROXIS Interactif // Août 2008 //********************************** // Commande v0.1 //********************************** require_once("includes/config.inc.php"); require_once("includes/main.inc.php"); require_once("includes/functions.inc.php"); require_once("includes/caddie.inc.php"); require_once("includes/commandes.inc.php"); $mycon = openDB(); require_once("caddie.inc.php"); session_register("compte"); $compte = $_SESSION['compte']; include_once("includes/login.inc.php"); $flsh = getVar("flsh"); $action = getVar("action"); if ($action=="addcommande") { $clientid = getVar("clientid"); $fnom = getVar("fnom"); $fprenom = getVar("fprenom"); $fadresse = getVar("fadresse"); $fcp = getVar("fcp"); $fville = getVar("fville"); $fpays1 = getVar("fpays1"); $fpays2 = getVar("fpays2"); if ($fpays1=="Autres") $fpays = $fpays2; else $fpays = $fpays1; if ($clientid!="" && $clientid!=0 && is_numeric($clientid)) { $fcdate = date("Y-m-d H:i:s"); if ($fnom=="" || $fprenom=="" || $fadresse=="" || $fcp=="" || $fville=="" || $fpays=="") $flivraison = getLivraison($caddieId,getPaysIdByNom(getDatasClientById($clientid,"pays"))); else if ($fnom!="" && $fprenom!="" && $fadresse!="" && $fcp!="" && $fville!="" && $fpays!="") { if ($fpays=="Reunion" || $fpays=="France Metropolitaine") $flivraison = getLivraison($caddieId,getPaysIdByNom($fpays)); else $flivraison = getLivraison($caddieId,getPaysIdByNom("Autres")); } $fetatpaiement = 1; $fetatcommande = 1; $myquery = "INSERT INTO commandes (cdate,caddie,client,nom,prenom,adresse,cp,ville,pays,livraison,etatpaiement,etatcommande) VALUES ('$fcdate','$caddieId','$clientid','$fnom','$fprenom','$fadresse','$fcp','$fville','$fpays','$flivraison','$fetatpaiement','$fetatcommande')"; mysql_query($myquery,$mycon); $myquery = "SELECT id FROM commandes WHERE cdate='$fcdate' AND caddie='$caddieId' AND client='$clientid'"; $result = mysql_query($myquery,$mycon); if (mysql_num_rows($result)>0) { $cid = mysql_result($result,0,"id"); $myquery = "SELECT album,titre,formule,quantite FROM caddie_contenus WHERE caddie='$caddieId'"; $cadresult = mysql_query($myquery,$mycon); $nbcad = mysql_num_rows($cadresult); if ($nbcad>0) { for ($i=0;$i<$nbcad;$i++) { $q_album = mysql_result($cadresult,$i,"album"); $q_titre = mysql_result($cadresult,$i,"titre"); $q_formule = mysql_result($cadresult,$i,"formule"); $q_quantite = mysql_result($cadresult,$i,"quantite"); $myquery = "INSERT INTO commande_contenus (commande,album,titre,formule,quantite) VALUES ('$cid','$q_album','$q_titre','$q_formule','$q_quantite')"; mysql_query($myquery,$mycon); } } } if (hasOnlyDownloads($cid)) { setEtatPaiement($cid,4); // si que des téléchargements alors redirection vers page telechargements header("Location: telechargements.php?client=".$clientid."&commande=".$cid); } } } else if ($action=="cancelcommande") { $cid = getVar("cid"); if ($cid!="" && $cid!=0 && is_numeric($cid) && getEtatCommande($cid)==1) { $myquery = "DELETE FROM commande_contenus WHERE commande='$cid'"; mysql_query($myquery,$mycon); $myquery = "DELETE FROM commandes WHERE id='$cid'"; mysql_query($myquery,$mycon); header("Location: panier.php?flsh=2"); exit(); } } ?>
Vous êtes ici : Accueil > Panier > Commande