"; // récupération des informations du client $reqcli = "select idcli,edu from commande where idcmde='$idcmde'"; $result1=mysql_query($reqcli) or die ("Erreur SQL :$reqcli
".mysql_error()."..."); while ($ligne1 = mysql_fetch_row($result1)) { $idcli=$ligne1[0]; $edu = $ligne1[1]; } $reqcli2="SELECT nomcli, prenomcli,email, libelleadr, codepostal, ville FROM `client` , adresse WHERE adresse.idcli=$idcli AND client.idcli = adresse.idcli"; //$reqcli2 = "select nomcli,prenomcli,libelleadr,ville,codepostale email from client where idcli='$idcli'"; $result2=mysql_query($reqcli2) or die ("Erreur SQL :$reqcli2
".mysql_error()."..."); while ($ligne2 = mysql_fetch_row($result2)) { $nomcli=$ligne2[0]; $prenomcli=$ligne2[1]; $email=$ligne2[2]; $adresse=$ligne2[3]; $codepostal=$ligne2[4]; $ville=$ligne2[5]; } $storeaccountname="AirTria"; $id="$idcmde"; if($edu==1) $edu="Yes"; else $edu="No"; $time = time(); // la date au format système $date = getdate($time); // passage de la variable time dans getdate pour ressortir les infos print "id : $id
"; print "StoreAccountName : $storeaccountname
"; $time = $date[month].' '.$date[mday].', '.$date[year].', '.$date[hours].':'.$date[minutes]; print "time : $time
"; $numeric = time(); print "numeric : $numeric
"; $ship=" $nomcli $prenomcli $adresse $ville FR $codepostal "; $bill=" $nomcli $prenomcli $adresse $ville FR $codepostal $email "; $suite1=" First Class Mail $edu thierry.tallagrand@airtria.fr $nomcli n :$id "; print "ship : '$ship'
"; print "bill : '$bill'
"; $reqprod = "select count(idprod) from composee where idcmde='$idcmde'"; $result=mysql_query($reqprod) or die ("Erreur SQL :$reqprod
".mysql_error()."..."); while ($ligne = mysql_fetch_row($result)) { $compteur=$ligne[0]; //id produit } print "
il y a $compteur produits commandés"; $reqprod2 = "select idprod,qtecmde from composee where idcmde='$idcmde'"; $result2=mysql_query($reqprod2) or die ("Erreur SQL :$reqprod
".mysql_error()."..."); while ($ligne = mysql_fetch_row($result2)) { $i++; print "

Produit n°$i
"; $idprod[$i]=$ligne[0]; $qtecmde[$i]=$ligne[1]; print "
idprod : $idprod[$i] ---- Qte cmde : $qtecmde[$i]
"; $reqprix ="select prix,marge,qteprod from prix where idprod='$idprod[$i]' order by qteprod desc"; $resultprix=mysql_query($reqprix) or die ("Erreur SQL :$reqprix
".mysql_error()."..."); while ($ligne2 = mysql_fetch_row($resultprix)) { $j++; $code[$j]=$ligne2[0]; $marge=$ligne2[1]; $qteprod=$ligne2[2]; if ($marge) //prix dynamique { print "
Prix : $prix - marge : $marge -- qteprod : $qteprod
"; while ($qtecmde[$i]>= $qteprod) { $item[0][]=$code[$j]; $item[1][]=floor($qtecmde[$i]/$qteprod); $qtecmde[$i]=$qtecmde[$i]%$qteprod; } } } //for($k=0;$k
code:".$item[0][$k].";qte:".$item[1][$k]."
"; } for($k=0;$k ".$item[0][$k]." ".$item[1][$k]." $prixunit "; print "$xmlprod[$k]
"; $xml=$xml.$xmlprod[$k]; $subtotal += ($prixunit * $item[1][$k]); } print "
Sous total : $subtotal"; $insert = " $numeric ".$ship." ".$bill." ".$suite1." ".$xml." $subtotal 0.00 0.00 $subtotal "; $fichier = '../mail/codeweaver.xml'; $pointeur = fopen($fichier, 'w+'); fwrite($pointeur, $insert); fclose($pointeur); $pointeur = fopen($fichier, 'r'); $contenu = fread($pointeur, filesize($fichier)); fclose($pointeur); $codeweavers="store-process@codeweavers.com"; exec ("/usr/freeware/bin/smtpclient -v -f tallagrand@airtria.fr -b ../mail/codeweaver.xml -P 25 -S o2000 store-process@codeweavers.com "); //store-process@codeweavers.com ?>