goldorak72

Utilisateur open source
  • Compteur de contenus

    2
  • Inscrit(e) le

  • Dernière visite


Réputation sur la communauté

0 Neutral

À propos de goldorak72

  • Rang
    Nouveau

Activité de goldorak72

  1. goldorak72 a ajouté un message dans un sujet  Erreur email_commande   

    Pour info avec le fichier fonctions d'origine sans modif ok donc sa bug avec celui que j'ai modifier


    <?php function est_identifie() { /* Retourne true si l'utilisateur des identifie */ return isset($_SESSION) && isset($_SESSION['utilisateur']) && !empty($_SESSION['utilisateur']['email']) && vb($_SESSION['url']) == $_SERVER['HTTP_HOST']; } function necessite_identification() { /* Cette fonction vérifie si l'utilisateur est identifié. Si non affiche * l'écran d'authentification avant de laisser l'utilisateur continuer */ global $wwwroot; if (! est_identifie()) { $_SESSION['wantsurl'] = $_SERVER['PHP_SELF']; echo "<meta http-equiv='Refresh' content='1; url=$wwwroot/membre.php'>"; } } function necessite_priv($priv) { /* Cette fonction vérifie si l'utilisateur a les privilèges de $priv. Si non affiche * l'écran informant que les privilèges sont insuffisants et arrête le traitement */ global $wwwroot; if ( vb($_SESSION['utilisateur']['priv']) != "admin" ) { if ( vb($_SESSION['utilisateur']['priv']) != "redac" ) { if ( vb($_SESSION['utilisateur']['priv']) != $priv ) { ?> <html> <head> <title>Privilèges Non accordés</title> </head> <style> h1 { font-family: Tahoma, Arial, sans-serif; font-size: 13px; font-weight: bold; color: #CC0000; } </style> <body bgcolor=#ffffff link=#0000ff vlink=#000099 alink=#ff0000> <h1 align=center>Vous n'avez pas les autorisations nécessaires pour accéder à l'administration du site. <p></p>Insérer votre identifiant et votre mot de passe. <a href="<?=$wwwroot?>/index.php">Cliquez ici pour revenir à la boutique</a> </h1> </body> </html> <? die; } } } } function necessite_priv_affilie($priv) { /* Cette fonction vérifie si l'utilisateur a les privilèges de $priv. Si non affiche * l'écran informant que les privilèges sont insuffisants et arrête le traitement */ global $wwwroot; if ( $_SESSION['utilisateur']['priv'] != "affi") { ?> <html> <head> <title>Privilèges Non accordés</title> </head> <style> h1 { font-family: verdana, Arial, sans-serif; font-size: 10pt; font-weight: bold; color: #CC0000; } </style> <body bgcolor=#ffffff link=#0000ff vlink=#000099 alink=#ff0000> <h1 align=center>Vous n'avez pas les autorisations nécessaires pour accéder à l'interface Affilié. <p></p>Insérer votre identifiant et votre mot de passe. </h1> </body> </html> <? die; } } function a_priv($priv) { /* Renvoie true si l'utilisateur de la session a le privilège $priv */ return $_SESSION['utilisateur']['priv'] == $priv; } function affiche_arbre_categorie($catid=false) { /* Affiche l'arbre de categories tree en appelemnt recupere_arbre_categorie */ echo recupere_arbre_categorie($catid); } function recupere_arbre_categorie($catid=0) { /* Renvoie l'arbre des catégories des produits, en commençant de top jusquà la * categorie specifiee par $id */ global $wwwroot; $qid = mysql_query("SELECT parent_id, nom_".$_SESSION['langue']." FROM peel_categories WHERE id = '".intval($catid)."' AND etat = '1'"); if ($qid) { if (mysql_num_rows($qid)) { list($parent, $nom) = mysql_fetch_row($qid); $nom = "<a class=petit href='$wwwroot/achat/index.php?catid=$catid'>$nom</a>"; } else { $parent = 0; $nom = ""; } } else { $parent = 0; $nom = ""; } if ($parent > 0) { return affiche_arbre_categorie($parent) . "<span class=\"petit\"> > " . $nom."</span"; } elseif ($catid > 0) { return "<span class=\"petit\"> ".HERE."</span> : <span class=\"petit\"><a class=petit href='$wwwroot/achat/index.php'>".HOME."</a> > " . $nom."</span>"; } elseif ($catid == 0) { return "<span class=\"petit\"> ".HERE."</span> : <a class=petit href='$wwwroot/achat/index.php'>".HOME."</a>"; } } function construit_arbo_cat(&$sortie, &$preselectionne, $parent=0, $indent="") { /* Parcours récurcivement l'arbre des catégories, commençant d'un parent * il descend dans l'arbre et affiche les options pour une liste de boîtes de sélection * Les élément preselectionnés sont marqué comme tel */ $qid = mysql_query("SELECT id, nom_".$_SESSION['langue'].", parent_id FROM peel_categories WHERE parent_id = $parent ORDER BY position"); if ($qid) { if (mysql_num_rows($qid) > 0) { while ($cat = mysql_fetch_array($qid)) { $selectionne = in_array($cat['id'], $preselectionne) ? "selected" : ""; $sortie .= "<option value=\"" . $cat['id'] . "\" $selectionne>$indent" .stripslashes($cat['nom_'.$_SESSION['langue'].''])."</option>"; if ($cat['id'] != $parent) { construit_arbo_cat($sortie, $preselectionne, $cat['id'], $indent." "); } } } } } function select_arbo_cat(&$sortie, $parent=0, $indent="") { $qid = mysql_query("SELECT id, nom_".$_SESSION['langue'].", parent_id FROM peel_categories WHERE parent_id = $parent ORDER BY nom_".$_SESSION['langue']."") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); if ($qid) { if (mysql_num_rows($qid) > 0) { while ($cat = mysql_fetch_array($qid)) { $sortie .= "<option value=\"" . $cat['id'] . "\">$indent" .stripslashes($cat['nom_'.$_SESSION['langue'].''])."</option>"; if ($cat['id'] != $parent) { select_arbo_cat($sortie, $cat['id'], $indent." "); } } } } } function affiche_arbre_rubrique($rubid=false) { echo recupere_arbre_rubrique($rubid); } function recupere_arbre_rubrique($rubid=0) { /* Renvoie l'arbre des catégories des produits, en commençant de top jusquà la * categorie specifiee par $id */ global$wwwroot; $qid = mysql_query("SELECT parent_id, nom_".$_SESSION['langue']." FROM peel_rubriques WHERE id = '".intval($rubid)."' AND etat = '1'"); if ($qid) { if (mysql_num_rows($qid)) { list($parent, $nom) = mysql_fetch_row($qid); $nom = "<a class=petit href='$wwwroot/lire/index.php?rubid=$rubid'>$nom</a>"; } else { $parent = 0; $nom = HERE." : "; } } else { $parent = 0; $nom = ""; } if ($parent > 0) { return affiche_arbre_rubrique($parent) . " > " . $nom; } elseif ($rubid > 0) { return "<span class=\"petit\">".HERE."</span> : <a class=petit href='$wwwroot/lire/index.php'>".HOME."</a> > " . $nom; } elseif ($rubid == 0) { return "<span class=\"petit\">".HERE."</span> : <a class=petit href='$wwwroot/lire/index.php'>".HOME."</a>"; } } function construit_arbo_rub(&$sortie, &$preselectionne, $parent=0, $indent="") { $qid = mysql_query("SELECT id, nom_".$_SESSION['langue'].", parent_id FROM peel_rubriques WHERE parent_id = $parent ORDER BY position") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); if ($qid) { if (mysql_num_rows($qid) > 0) { while ($rub = mysql_fetch_array($qid)) { $selectionne = in_array($rub['id'], $preselectionne) ? "selected" : ""; $sortie .= "<option value=\"" . $rub['id'] . "\" $selectionne>$indent" . $rub['nom_'.$_SESSION['langue'].'']; if ($rub['id'] != $parent) { construit_arbo_rub($sortie, $preselectionne, $rub['id'], $indent." "); } } } } } // Fonction récursive pour rechercher si $noeud fait partie de l'arborescence d'un noeud donné // Utilisé par construit_menu afin d'ouvrir les DIV necesssaires dans l'arborescence function parent_noeud_rub($noeud_rub,$aktul_rub,&$actif_rub){ // Si c'est pas la racine if($aktul_rub != 0 && $noeud_rub != 0){ // Recherche le parent du noeud à tester $sql=mysql_query("SELECT id, parent_id FROM peel_rubriques WHERE id = $aktul_rub"); // récupère le résultat $rub=mysql_fetch_array($sql); // Appel récursif jusqu'à la racine parent_noeud_rub($noeud_rub,$rub['parent_id'],$actif_rub); // Si le noeud testé est le noeud recherché if($rub['parent_id']==$noeud_rub){ // Met le drapeau à 1 $actif_rub=1; } } } function recupere_articles_caddie() { /* Retourne $qid de tous les éléments du caddie */ $in_clause = $_SESSION['caddie']->recupere_produitid_list(); if (empty($in_clause)) { return false; } $requete = "SELECT id, reference, nom, promotion, prix, tva, poids, stock FROM peel_produits WHERE id IN ($in_clause)"; return mysql_query($requete); } function initialise_mot_passe($email) { /* Initialise le mot de passe de l'utilisateur et lui envoie par e-mail*/ global $support, $site; /* Chargement des infos de l'utilisateur */ $qid = mysql_query("SELECT email, prenom, nom_famille FROM peel_utilisateurs WHERE email = '$email'"); $utilisateur = mysql_fetch_array($qid); /* initialise le mot de passe */ $nouveau_mot_passe = MDP(); $qid = mysql_query("UPDATE peel_utilisateurs SET mot_passe = '" . md5($nouveau_mot_passe) ."' WHERE email = '$email'"); /* envoie par email */ $email = $utilisateur['email']; $mailSujet = SUBJECT_PASSWORD_EMAIL." : ". $mailObjet = OBJECT_EMAIL_PASSWORD; $mailObjet .= IDENTIFIANT_EMAIL." : ".$email."\n\r"; $mailObjet .= IDENTIFIANT_PASSWORD." : ".$nouveau_mot_passe."\n\r"; mail($email,$mailSujet,$mailObjet,"From:$support"); mail($support,$mailSujet,$mailObjet,"From:$support"); } function lit_modele($nom_fichier, &$var) { /* Retourne une chaine contenant le contenu d'un fichier modele avec interpolation * des variables. Toutes les variables doivent être dans le tableau $var[] * ATTENTION: Ne pas utiliser sur les gros fichiers!! */ $temp = str_replace("\\", "\\\\", implode(file($nom_fichier), "")); $temp = str_replace('"', '\"', $temp); eval("\$modele = \"$temp\";"); return $modele; } function chop_ccnum($ccnum) { /* Retourne des infos parcélaires sur la carte de crédit pour discrétion */ return substr($ccnum, 0, 4) . "..." . substr($ccnum, -4); } function enregistre_commandeinfo(&$frm) { $commande = array(); $commande['client1'] = $frm['client1']; $commande['contact1'] = $frm['contact1']; $commande['email1'] = $frm['email1']; $commande['adresse1'] = $frm['adresse1']; $commande['code_postal1'] = $frm['code_postal1']; $commande['ville1'] = $frm['ville1']; $commande['pays1'] = $frm['pays1']; $commande['client2'] = $frm['client2']; $commande['contact2'] = $frm['contact2']; $commande['email2'] = $frm['email2']; $commande['adresse2'] = $frm['adresse2']; $commande['code_postal2'] = $frm['code_postal2']; $commande['ville2'] = $frm['ville2']; $commande['pays2'] = $frm['pays2']; $commande['commentaires'] = $frm['commentaires']; $commande['cgv'] = $frm['cgv']; $criteres = explode("|", $frm['paiement']); $paiement = $criteres[0]; $tarif_paiement = $criteres[1]; $id_paiement = $criteres[2]; $commande['paiement'] = $paiement; $commande['tarif_paiement'] = $tarif_paiement; $commande['id_paiement'] = $id_paiement; $_SESSION['commande'] = $commande; } function charge_commande() { if (empty($_SESSION['commande'])) { return false; } else { return $_SESSION['commande']; } } function vide_commandeinfo() { unset($_SESSION['commande']); } function print_societe() { /* Affiche la liste des catégories qui sont spéciales */ $qid = mysql_query("SELECT * FROM peel_societe"); if ($qid) { if (mysql_num_rows($qid) > 0) { $ligne = mysql_fetch_object($qid); echo "<br />"; if (!empty($ligne->societe)) { echo "<br /><b>" . html_entity_decode($ligne->societe) . "</b> ";} if (!empty($ligne->adresse)) { echo "<br />" .html_entity_decode($ligne->adresse) . " ";} if (!empty($ligne->code_postal)) { echo "<br />" .$ligne->code_postal . " ";} if (!empty($ligne->ville)) { echo " " .html_entity_decode($ligne->ville) . " ";} if (!empty($ligne->pays)) { echo "<br />" .html_entity_decode($ligne->pays) . " ";} if (!empty($ligne->tel)) { echo "<br />Tel. : " . $ligne->tel . "";} if (!empty($ligne->fax)) { echo "<br />Fax. : " . $ligne->fax . "";} if (!empty($ligne->siren)) { echo "<br />Siren : " . $ligne->siren . "";} if (!empty($ligne->tvaintra)) { echo "<br />TVA Intracommunaire : " . $ligne->tvaintra. "";} if (!empty($ligne->cnil)) { echo "<br />Numéro CNIL. : " . $ligne->cnil . "";} echo "<br />"; } } } function print_rib() { /* Affiche la liste des catégories qui sont spéciales */ $qid = mysql_query("SELECT * FROM peel_societe"); if ($qid) { if (mysql_num_rows($qid) > 0) { $ligne = mysql_fetch_object($qid); print "<div class=\"normal\">"; if (!empty($ligne->code_banque)) { print "<b>Code banque :</b> $ligne->code_banque<br />";} if (!empty($ligne->code_guichet)) { print "<b>Code guichet :</b> $ligne->code_guichet<br />";} if (!empty($ligne->numero_compte)) { print "<b>Numéro de compte :</b> $ligne->numero_compte<br />";} if (!empty($ligne->cle_rib)) { print "<b>Clé RIB :</b> $ligne->cle_rib<br />";} if (!empty($ligne->titulaire)) { print "<b>Titulaire du compte :</b> $ligne->titulaire<br />";} if (!empty($ligne->domiciliation)) { print "<b>Domiciliation :</b> $ligne->domiciliation<br />";} if (!empty($ligne->iban)) { print "<b>IBAN :</b> $ligne->iban<br />";} if (!empty($ligne->swift)) { print "<b>SWIFT:</b> $ligne->swift<br />";} print "</div>"; } } } function fdate(&$date_nok) { $date_ok = date("d-m-Y H:i",strtotime($date_nok)); return $date_ok; } function fprix(&$prix_nok) { $prix_ok = number_format($prix_nok,2, ',', ' '); return $prix_ok; } # fonction de validation d'adresse mail trouvée sur http://www.phpinfo.net/?p=trucs&rub=astuces function EmailOK($email) { return( ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email) ); } # création d'un mot de passe crypté function unique_id() { mt_srand((double)microtime()*1000000); return md5( mt_rand(0,9999999) ); } function return_date_fr($timestamp){ // par defaut on affiche la date du jour $jsem = date('w', strtotime($timestamp)); // jour de la semaine $jmois = date('j', strtotime($timestamp)); // jour du mois ('d' est aussi utilisable) $mois = date('n', strtotime($timestamp)); // mois de l'annee $annee = date('Y', strtotime($timestamp)); // l'annee $tabjour=array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'vendredi', 'Samedi'); $tabmois=array('0', 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'); // construction de la date formatee $datefr = $tabjour[$jsem]." $jmois ".$tabmois[$mois]." $annee"; // affichage (remplacer 'echo' par 'return' pour retourner le resultat) return $datefr; } function cree_commande(&$commande) { // Enregistre la commande dans la base global $normal; global $express; global $site; global $support; global $wwwroot; global $seuil; global $affiliate_rate; $remise = 0; $tab_pays1 = mysql_fetch_array(mysql_query("SELECT pays_".$_SESSION['langue']." FROM peel_pays WHERE id = '".$commande['pays1']."'")); // Constuit les infos du client en une chaîne // Addresse de facturation $client_info1 = $commande['client1']."\n" .$commande['adresse1']."\n" .$commande['code_postal1']."\n" .$commande['ville1']."\n" .$tab_pays1['pays_'.$_SESSION['langue'].'']."\n" .$commande['contact1']."\n" .$commande['email1']."\n"; $coord1 = explode(" ", $commande['client1']); if (empty($commande['adresse2']) || empty($commande['code_postal2']) || empty($commande['ville2'])) { // Addresse de livraison $client_info2 = $commande['client1']."\n" .$commande['adresse1']."\n" .$commande['code_postal1']."\n" .$commande['ville1']."\n" .$_SESSION['caddie']->pays."\n" .$commande['contact1']."\n" .$commande['email1']."\n"; } else { // Addresse de livraison $client_info2 = $commande['client2']."\n" .$commande['adresse2']."\n" .$commande['code_postal2']."\n" .$commande['ville2']."\n" .$_SESSION['caddie']->pays."\n" .$commande['contact2']."\n" .$commande['email2']."\n"; } $coord1 = explode(" ", $commande['client1']); $coord2 = explode(" ", $commande['client2']); /* Le reversement affilié est calculé sur le total ht des produits */ if (isset($_SESSION['affilie'])) { $affilie = 1; $statut_affilie = 0; $montant_affilie = $_SESSION['caddie']->total_produit_ht * $affiliate_rate/100; $id_affilie = intval($_SESSION['affilie']); } else { $affilie = 0; $montant_affilie = 0; $statut_affilie = 0; $id_affilie = 0; } $sql = " INSERT INTO peel_commandes ( email , id_utilisateur , o_timestamp , a_timestamp , statut , statut_details , client_info1 , client_info2 , commentaires , montant , montant_ht , total_tva , tva_transport , total_produit_avant_promo , total_produit_avant_promo_ht , total_produit , type , zone , zone_tva , pays , transport , cout_transport , cout_transport_ht , lang , points , points_etat , poids , affilie , montant_affilie , statut_affilie , id_affilie , remise_produit , remise_produit_ht , remise_client , remise_client_ht , remise_client_percent , remise_code , remise_code_ht , remise_code_percent , code_promo , code_cheque_cadeau , remise_cheque , remise_cheque_ht , code_bon , remise_bon , remise_bon_ht , avoir , paiement , tarif_paiement , prenom_bill , nom_bill , adresse_bill , zip_bill , ville_bill , pays_bill , email_bill , telephone_bill , prenom_ship , nom_ship , adresse_ship , zip_ship , ville_ship , pays_ship , email_ship , telephone_ship , id_parrain , parrain , ecotaxe_ttc , ecotaxe_ht ) VALUES ( '{$_SESSION['utilisateur']['email']}' ,'".intval($_SESSION['utilisateur']['id_utilisateur'])."' ,now() ,now() ,0 ,'commande initialisée' ,'".htmlspecialchars($client_info1, ENT_QUOTES)."' ,'".htmlspecialchars($client_info2, ENT_QUOTES)."' ,'".htmlspecialchars($commande['commentaires'], ENT_QUOTES)."' ,'".$_SESSION['caddie']->total."' ,'".$_SESSION['caddie']->total_ht."' ,'".$_SESSION['caddie']->total_tva."' ,'".$_SESSION['caddie']->tva_transport."' ,'".$_SESSION['caddie']->total_produit_avant_promo."' ,'".$_SESSION['caddie']->total_produit_avant_promo_ht."' ,'".$_SESSION['caddie']->total_produit."' ,'".htmlspecialchars($_SESSION['caddie']->type,ENT_QUOTES)."' ,'".htmlspecialchars($_SESSION['caddie']->zone,ENT_QUOTES)."' ,'".intval($_SESSION['caddie']->zoneTva)."' ,'".htmlspecialchars($_SESSION['caddie']->pays,ENT_QUOTES)."' ,'".htmlspecialchars($_SESSION['caddie']->zone,ENT_QUOTES)." - ".htmlspecialchars($_SESSION['caddie']->type,ENT_QUOTES)."' ,'".$_SESSION['caddie']->cout_transport."' ,'".$_SESSION['caddie']->cout_transport_ht."' ,'".$_SESSION['langue']."' ,'".$_SESSION['caddie']->total_points."' ,'0' ,'".$_SESSION['caddie']->total_poids."' ,'".$affilie."' ,'".$montant_affilie."' ,'".$statut_affilie."' ,'".$id_affilie."' ,'".$_SESSION['caddie']->total_remise_produit."' ,'".$_SESSION['caddie']->total_remise_produit_ht."' ,'".$_SESSION['caddie']->total_remise_client."' ,'".$_SESSION['caddie']->total_remise_client_ht."' ,'".$_SESSION['caddie']->remise_client_percent."' ,'".$_SESSION['caddie']->total_remise_code."' ,'".$_SESSION['caddie']->total_remise_code_ht."' ,'".$_SESSION['caddie']->remise_code_percent."' ,'".htmlspecialchars($_SESSION['caddie']->code_promo,ENT_QUOTES)."' ,'".htmlspecialchars($_SESSION['caddie']->code_cheque,ENT_QUOTES)."' ,'".$_SESSION['caddie']->total_remise_cheque."' ,'".$_SESSION['caddie']->total_remise_cheque_ht."' ,'".htmlspecialchars($_SESSION['caddie']->code_bon,ENT_QUOTES)."' ,'".$_SESSION['caddie']->total_remise_bon."' ,'".$_SESSION['caddie']->total_remise_bon_ht."' ,'".$_SESSION['caddie']->avoir."' ,'".htmlspecialchars($_SESSION['caddie']->paiement,ENT_QUOTES)."' ,'".$_SESSION['caddie']->tarif_paiement."' , '".htmlspecialchars(vb($coord1[0]),ENT_QUOTES)."' , '".htmlspecialchars(vb($coord1[1]),ENT_QUOTES)."' , '".htmlspecialchars($commande['adresse1'],ENT_QUOTES)."' , '".htmlspecialchars($commande['code_postal1'])."' , '".htmlspecialchars($commande['ville1'],ENT_QUOTES)."' , '".htmlspecialchars($tab_pays1['pays_'.$_SESSION['langue'].''],ENT_QUOTES)."' , '".htmlspecialchars($commande['email1'])."' , '".htmlspecialchars($commande['contact1'])."' , '".htmlspecialchars(vb($coord2[0]),ENT_QUOTES)."' , '".htmlspecialchars(vb($coord2[1]),ENT_QUOTES)."' , '".htmlspecialchars($commande['adresse2'],ENT_QUOTES)."' , '".htmlspecialchars($commande['code_postal2'])."' , '".htmlspecialchars($commande['ville2'],ENT_QUOTES)."' , '".htmlspecialchars($_SESSION['caddie']->pays,ENT_QUOTES)."' , '".htmlspecialchars($commande['email2'])."' , '".htmlspecialchars($commande['contact2'])."' ,'".vn($_SESSION['utilisateur']['id_parrain'])."' ,'".vb($_SESSION['utilisateur']['type'])."' ,'".$_SESSION['caddie']->ecotaxe_ttc."' ,'".$_SESSION['caddie']->ecotaxe_ht."' )"; $qid = mysql_query($sql) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); $commandeid = mysql_insert_id(); mysql_query("UPDATE peel_utilisateurs SET avoir = avoir - '".vn($_SESSION['caddie']->avoir)."', parrain = '' WHERE id_utilisateur = '".intval($_SESSION['utilisateur']['id_utilisateur'])."'"); if (isset($_SESSION['affilie'])) { mysql_query("INSERT INTO peel_utilisateurs_commandes (utilisateur_id, commande_id) VALUES ('".$_SESSION['affilie']."', '".$commandeid."')"); } if (!empty($_SESSION['caddie']->code_cheque)) { mysql_query("UPDATE peel_cheques_cadeaux SET a_timestamp = now(), etat = '0' WHERE code = '".$_SESSION['caddie']->code_cheque."'"); } /* ajout des articles à la table commandes_articles */ foreach ($_SESSION['caddie']->articles as $i => $produitid) { $qid = mysql_query("SELECT * FROM peel_produits WHERE id= '$produitid'"); if ($qid) { if (mysql_num_rows($qid) > 0) { $article=mysql_fetch_array($qid); if ($article['on_stock'] == 1) { $c = mysql_fetch_array(mysql_query("SELECT id FROM peel_couleurs WHERE nom_".$_SESSION['langue']." = '".$_SESSION['caddie']->couleur[$i]."'")); $t = mysql_fetch_array(mysql_query("SELECT id FROM peel_tailles WHERE nom_".$_SESSION['langue']." = '".$_SESSION['caddie']->taille[$i]."'")); $s = mysql_fetch_array(mysql_query("SELECT stock FROM peel_stocks WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'")); $stock = $s['stock'] - $_SESSION['caddie']->quantite[$i]; if ($stock >= 0) { $stock_restant = $stock; } else { $stock_restant = 0; } if ($stock < 0) { $stock_to_order = $_SESSION['caddie']->quantite[$i] - $s['stock']; /* Calcul le stock restant à commander */ mysql_query("UPDATE peel_commandes SET statut = '9' WHERE id = '".$commandeid."'"); /* Passage de la commande en stand by */ } else { $stock_to_order = 0; } mysql_query("UPDATE peel_stocks SET stock = ".$stock_restant." WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'"); $sqlStockTemp = "SELECT stock, qte FROM peel_stocks_temp WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'"; $resStockTemp = mysql_query($sqlStockTemp); $StockTemp = mysql_fetch_array($resStockTemp); if ($StockTemp['qte'] == $_SESSION['caddie']->quantite[$i]) { mysql_query("DELETE FROM peel_stocks_temp WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'"); } else { mysql_query("UPDATE peel_stocks_temp SET stock = ".$stock_restant.", qte = qte - ".$_SESSION['caddie']->quantite[$i].", o_timestamp = now() WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'"); } if ($s['stock'] <= $seuil) { mail("$support","[$site] Notification d'alerte STOCK","Seuil d'alerte atteint pour le produit ".html_entity_decode($article['nom_'.$_SESSION['langue'].''])."\n\r Couleur : ".$_SESSION['caddie']->couleur[$i]."\n\r Taille : ".$_SESSION['caddie']->taille[$i]."\n\r Stock restant : ".$s['stock']."\n\r","FROM:$support"); } } $statut_envoi = ($article['on_download'] == 1) ? "En attente" : ""; $requete = "INSERT INTO peel_commandes_articles ( commande_id , produit_id , nom_produit , prix_cat , prix_cat_ht , prix , prix_ht , total_prix , total_prix_ht , quantite , promotion , remise_produit , tva , tva_percent , couleur , taille , comment , option_prix , delivery_stock , order_stock , points , poids , email_check , on_download , statut_envoi , nb_envoi , nb_download ) VALUES ( '$commandeid' ,'".$article['id']."' ,'".htmlspecialchars($article['nom_'.$_SESSION['langue'].''], ENT_QUOTES)."' ,'".$_SESSION['caddie']->prix_cat[$i]."' ,'".$_SESSION['caddie']->prix_cat_ht[$i]."' ,'".$_SESSION['caddie']->prix[$i]."' ,'".$_SESSION['caddie']->prix_ht[$i]."' ,'".$_SESSION['caddie']->total_prix[$i]."' ,'".$_SESSION['caddie']->total_prix_ht[$i]."' ,'".$_SESSION['caddie']->quantite[$i]."' ,'".$_SESSION['caddie']->remise_produit_percent[$i]."' ,'".$_SESSION['caddie']->remise_produit[$i]."' ,'".$_SESSION['caddie']->tva[$i]."' ,'".$_SESSION['caddie']->tva_percent[$i]."' ,'".htmlspecialchars($_SESSION['caddie']->couleur[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->taille[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->comment[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->option[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->delivery_stock[$i])."' ,'".intval(vn($stock_to_order))."' ,'".htmlspecialchars($_SESSION['caddie']->points[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->poids[$i])."' ,'".htmlspecialchars($_SESSION['caddie']->email_check[$i])."' ,'".intval($article['on_download'])."' ,'".$statut_envoi."' ,'0' ,'0' )"; mysql_query($requete) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); if (!empty($_SESSION['caddie']->email_check[$i])) { $code = strtoupper(MDP()); $email_client = $_SESSION['utilisateur']['email']; $email_ami = $_SESSION['caddie']->email_check[$i]; /* Mode production : mettre l'état à 0 et passer les fonctions mails dans la liste des chèques cadeaux */ mysql_query("INSERT INTO peel_cheques_cadeaux ( id_utilisateur, email_acheteur, email_ami, nom_produit, code, remise_cheque, o_timestamp, seuil, etat ) VALUES ( '".intval($_SESSION['utilisateur']['id_utilisateur'])."', '$email_client', '$email_ami', '".htmlspecialchars($article['nom_'.$_SESSION['langue'].''], ENT_QUOTES)."', '".$code."', '".$_SESSION['caddie']->prix[$i]."', now(), '".$_SESSION['caddie']->prix[$i]."', '1')") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); $message = "Bonjour,\n\r"; $message .= "Votre ami ".$_SESSION['utilisateur']['prenom']." ".$_SESSION['utilisateur']['nom_famille']." a souhaité vous offrir un chèque cadeau sur le site $site.\n\r"; $message .= "Pour en bénéficier, connectez vous simplement au site $wwwroot et utilisez votre code $code.\n\rVous bénéficierez alors d'un avoir de ".$_SESSION['caddie']->prix[$i]." EURO TTC sur votre commande.\n\r"; $message .= "A bientôt sur $site."; mail($email_ami,"[$site] ".$_SESSION['utilisateur']['email']." vous offre un chèque cadeau",$message,"FROM:$email_client"); mail($email_client ,"[$site - copie du message envoyé à ".$_SESSION['caddie']->email_check[$i]."] ".$_SESSION['utilisateur']['email']." vous offre un chèque cadeau",$message,"FROM:$support"); $message_support = "Bonjour,\n\rLe code chèque cadeau $code vient d'être créé sur $site.\n\r Merci de le valider à réception du règlement."; mail($support ,"[$site] Création d'un chèque cadeau à valider",$message_support,"FROM:$support"); } } } } /* Annule la remise en % du client, supprimer ces lignes si vous souhaitez que les remises client soient permanentes */ mysql_query("UPDATE peel_utilisateurs SET remise_percent = '0', avoir = '0' WHERE id_utilisateur = '".$_SESSION['utilisateur']['id_utilisateur']."'"); $_SESSION['utilisateur']['remise_percent'] = 0; $_SESSION['utilisateur']['avoir'] = 0; $_SESSION['utilisateur']['id_parrain'] = 0; $_SESSION['utilisateur']['type'] = ''; #- Suppression du statut filleul return $commandeid; } function send_avis_expedition($commandeid) { global $site; global $wwwroot; global $support; $resCom = mysql_query("SELECT * FROM peel_commandes WHERE id = '".intval($commandeid)."'"); $com = mysql_fetch_object($resCom); $resClient = mysql_query("SELECT * FROM peel_utilisateurs WHERE id_utilisateur = '".intval($com->id_utilisateur)."'"); $client = mysql_fetch_object($resClient); $message = "Bonjour ".$client->prenom." ".$client->nom_famille.",\n\r"; $message .= "Nous avons le plaisir de vous confirmer la préparation et la prochaine livraison de la commande no. ".$commandeid." dans son intégralité.\n\r"; $message .= "Articles expédiés :\n\r"; $resComArt = mysql_query("SELECT * FROM peel_commandes_articles WHERE commande_id = '".intval($commandeid)."'"); while ($ComArt = mysql_fetch_array($resComArt)) { $message .= "- ".html_entity_decode($ComArt['nom_produit'])."\n\r"; } $message .= "Transporteur :\n\r"; $message .= "Le transporteur que vous avez choisi lors de la passation de votre commande est ".$com->transport."\n\r"; $message .= "Références de l'envoi : "; $message .= "Le no. de colis est ".$com->colis.", vous pouvez suivre l'acheminement de votre colis en cliquant sur le lien suivant http://www.coliposte.fr/ \n\r"; $message .= "Adresse d'expédition :\n\r"; $message .= $com->client_info2."\n\r"; $message .= "RAPPEL IMPORTANT !\n\r"; $message .= "Nous vous invitons à suivre scrupuleusement nos instructions pour éviter tout litige. Le transport est une phase délicate qui demande une attention toute particulière.\r"; $message .= "Par conséquent, merci de vous conformer aux règles d'usages élémentaires rappelées ci-dessous :\n\r"; $message .= "- Colis en mauvais état\r"; $message .= "- colis ouvert et/ou écrasé\r"; $message .= "- système de fermeture (adhésif...) détérioré ou ne semblant pas d'origine\r"; $message .= "\n\rQUE FAIRE ?\n\r"; $message .= "- ne pas ouvrir le colis\r"; $message .= "- refuser le colis\r"; $message .= "- émettre immédiatement les réserves d'usage auprès du transporteur\r"; $message .= "- nous signaler le problème en nous indiquant le no. de commande concernée\n\r"; $message .= "IMPORTANT\n\r"; $message .= "$site refusera systématiquement le remboursement d'une commande si :\n\r"; $message .= "- aucune réserve n'a été émise auprès du transporteur\r"; $message .= "- aucune preuve de l'émission des réserves n'est fournie\n\r"; $message .= "Nous vous remercions de votre compréhension et restons à votre entière disposition pour tout complément d'information.\n\r"; $message .= "A bientôt sur $site\n\r"; mail($com->email,"[$site] Avis d'expédition de la commande n° $commandeid",$message,"FROM:$support"); echo "L'avis d'expédition a été envoyé à ".$com->email."<br />"; } function frmvalide(&$var, $true_value = "checked", $false_value = "") { /* Affiche le mot "checked" si la variable est vraie sinon rien */ if ($var) { echo $true_value; } else { echo $false_value; } } function valide(&$var, $init_valeur = 1, $vide_valeur = 0) { /* Si var est défini, place init_valeur dedans, sinon place vide_valeur.*/ if (empty($var)) { $var = $vide_valeur; } else { $var = $init_valeur; } } function vb(&$var, $default="") { // Variable blanche /* if $var n'est pas défini, retourne $default, sinon retourne $var */ return isset($var) ? $var : $default; } function vn(&$var, $default=0) { // Variable nulle /* if $var n'est pas défini, retourne $default, sinon retourne $var */ return isset($var) ? $var : $default; } function pv(&$var) { // print var /* retourne $var avec les caractères HTML correctement traité (comme "<", ">", etc.), * ou si $var n'est pa défini, retourne une chaîne vide. * Cette fonction doit être appelée avec une variable, utilisez la fonction p() */ p(vb($var)); } function t($var) { // Traitement des variables textes /* returns $var with HTML characters (like "<", ">", etc.) properly quoted, * or if $var is empty, will return an empty string. */ return empty($var) ? "" : htmlSpecialChars(stripslashes($var)); } function p($var) { //print /* prints $var with HTML characters (like "<", ">", etc.) properly quoted, * or if $var is empty, will print an empty string. */ echo t($var); } function jstring($var) { /* returns string that is quoted for javascript */ return addslashes($var); } /* Fonction de contrôle pour l'upload de fichiers */ function validate_upload($the_file) { global $my_max_file_size; global $image_max_width; global $image_max_height; global $allowed_types; global $registered_types; $error = ""; $the_file_type = $the_file['type']; $start_error = "\n<font color=\"red\"><b>Attention :</b></font>\n<ul>"; if (in_array($the_file_type,$allowed_types)) {} if ($the_file == "none") { $error .= "\n<li>Vous n'avez rien uploadé.</li>"; } else { # Vérification du type de fichier uploadé if (!in_array($the_file_type,$allowed_types)) { $error .= "\n<li>Le type de fichier que vous essayez d'uploader n'est pas autorisé, vous ne pouvez télécharger des fichiers que du type : \n<ul>"; while ($type = current($allowed_types)) { $error .= "\n<li>" . $registered_types[$type] . " (" . $type . ")</li>"; next($allowed_types); } $error .= "\n</ul>"; } if (in_array($the_file_type,$allowed_types)) { list($width, $height, $type, $attr) = getimagesize($the_file['tmp_name']); if ($width > $image_max_width) { $error .= "\n<li>Votre image ne devrait être plus large que " . $image_max_width . " Pixels</li>"; } if ($height > $image_max_height) { $error .= "\n<li>Votre image ne devrait être plus haute que " . $image_max_height . " Pixels</li>"; } } if ($error) { $error = $start_error . $error . "\n</ul>"; return $error; } else { return false; } } } // Fin de la fonction validate upload /*Fonction d'upload de fichiers */ function upload($the_file) { global $the_path; $the_file_tmp = $the_file['tmp_name']; $the_file_name = $the_file['name']; $error = validate_upload($the_file); // Teste la validité du document $extension = substr($the_file_name, strrpos($the_file_name, ".")); $dateheure = strftime("%d%m%y_%H%M%S"); $mdp = MDP(); $the_new_file_name = $dateheure . "_PEEL_" .$mdp.$extension; if ($error) { echo $error; return ""; } else { # cool, we can continue if (!move_uploaded_file($the_file_tmp, $the_path . $the_new_file_name)) { //form("\n<b>Quelques choses ne fonctionnent pas : vérifier le chemin de la variable $path et les permissions du répertoire /upload (il doit être en CHMOD777</b>"); } else { chmod($the_path . $the_new_file_name, 0777); return $the_new_file_name; } } } function MDP() // Fonction utiliser pour le renommage des fichiers images { $chrs = 6; // Fixe le nombre de caractères $pwd = "" ; mt_srand ((double) microtime() * 1000000); while (strlen($pwd)<$chrs) { $chr = chr(mt_rand (0,255)); if (eregi("^[a-hj-km-np-z2-9]$", $chr)) $pwd = $pwd.$chr; }; return $pwd; } function send_email($to, $subject , $msg , $format ,$bcc="") { global $support; global $wwwroot; /* Création des pieds des messages */ $piedtxt ="\n\n------------------------------------------------------------------------------\n"; $piedtxt .= "Pour vous désinscrire, allez dans Mon compte > Modifier mes paramètres.\n"; $piedhtm = "<br /><br /><br />"; $piedhtm .= "Pour vous désinscrire, allez dans <a href=\"".$wwwroot."/compte.php\">Mon compte > Modifier mes paramètres</a>"; $subject=stripslashes($subject); $msg=stripslashes($msg); //création du header du mail $mail_header = "From: $support\r\n"; $mail_header .= "Reply-To: $support\r\n"; $mail_header .= "Return-Path:".$support."\r\n"; $mail_header .= "Content-Transfer-Encoding: 8bit\r\n"; $mail_header .= "MIME-Version: 1.0\r\n"; $mail_header .= "X-Mailer: PHP/" . phpversion()."\r\n"; if ($format=="text") { $mail_header .= "Content-Type: text/plain; charset=iso-8859-1\r\n"; $msg .= $piedtxt; } else { $mail_header.="Content-Type: text/html; charset=iso-8859-1\r\n"; $msg .= $piedhtm; } if(mail($to ,$subject,$msg,$mail_header)) { return 1; } else { return 0;} } function cree_devis() { // Enregistre la commande dans la base global $site; global $support; global $wwwroot; $sql = " INSERT INTO peel_devis ( email ,id_utilisateur , o_timestamp , montant ) VALUES ( '{$_SESSION['utilisateur']['email']}' ,'{$_SESSION['utilisateur']['id_utilisateur']}' ,now() ,'".$_SESSION['caddie']->total."' )"; $qid = mysql_query($sql); $devisid = mysql_insert_id(); /* ajout des articles à la table commandes_articles */ foreach ($_SESSION['caddie']->articles as $i => $produitid) { $qid = mysql_query("SELECT * FROM peel_produits WHERE id= '$produitid'"); if ($qid) { if (mysql_num_rows($qid) > 0) { $article=mysql_fetch_array($qid); $prix_cat = $article['prix']; $prix_cat_ht = $article['prix'] / (1+$article['tva']/100); $requete = "INSERT INTO peel_devis_articles ( devis_id, produit_id, nom_produit, prix, prix_ht, prix_cat, prix_cat_ht, quantite, promotion, tva, couleur, taille, comment ) VALUES ( '$devisid' ,'".$article['id']."' ,'".addslashes($article['nom_'.$_SESSION['langue'].''])."' ,'". $_SESSION['caddie']->prix[$i]."' ,'". $_SESSION['caddie']->prix_ht[$i]."' ,'".$prix_cat."' ,'".$prix_cat_ht."' ,'".$_SESSION['caddie']->quantite[$i]."' ,'".$_SESSION['caddie']->remise_produit_percent[$i]."' ,'".$_SESSION['caddie']->tva_percent[$i]."' ,'".$_SESSION['caddie']->couleur[$i]."' ,'".$_SESSION['caddie']->taille[$i]."' ,'".addslashes($_SESSION['caddie']->comment[$i])."' )"; mysql_query($requete) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } } } return $devisid; } function email_commande_cb(&$commandeid) { global $wwwroot; global $site; global $support; global $langfile; $result = mysql_query("SELECT email, o_timestamp, montant FROM peel_commandes WHERE id ='".$commandeid."'"); $com = mysql_fetch_object($result); $timestamp = $com->o_timestamp; $montant = $com->montant; mail( $support, "Nouvelle commande par carte bancaire sur votre site web $site", "Une commande portant le numéro $commandeid vient d'être enregistrée sur le site $site.", "FROM:$support"); if (file_exists($langfile)){ require ($langfile); } /* Mail à l'adresse de facturation */ mail($com->email,SUBJECT_EMAIL_BILLING_CB,MSG_EMAIL_BILLING_CB,"FROM:$support"); } function verifier_authentification($email, $mot_passe) { $requete = " SELECT * FROM peel_utilisateurs WHERE email = '$email' AND mot_passe = '".md5($mot_passe)."' "; $qid = mysql_query($requete) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());; if (mysql_num_rows($qid) > 0) { return mysql_fetch_array($qid); } else { return; } } function mydate($format, $publictime) { $sec = substr($publictime, 12, 2); $min = substr($publictime, 10, 2); $hour = substr($publictime, 8, 2); $day = substr($publictime, 6, 2); $month = substr($publictime, 4, 2); $year = substr($publictime, 0, 4); return date($format, mktime($hour, $min, $sec, $month, $day, $year)); } function filtre_pdf($chaine) { $chaine = str_replace("è","è",$chaine); $chaine = str_replace("é","é",$chaine); $chaine = str_replace("é","é",$chaine); $chaine = str_replace("Ã","à",$chaine); $chaine = str_replace("'","'",$chaine); $chaine = str_replace("°","°",$chaine); return $chaine; } function calcul_nbprod_parcat($catid) { $sqlCount = "SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id AND pc.categorie_id = '".intval($catid)."' AND p.etat=1"; $resCount = mysql_query($sqlCount); $Count = mysql_fetch_row($resCount); return $Count[0]; } ?> donc tous doit etre dans ce code ? ;) Merci de votre aide
    • 0
  2. goldorak72 a ajouté un sujet dans Module PEEL Premium pour PEEL SHOPPING   

    Erreur email_commande
    Re Bonjour A tous, apres quelles que mois absence me revoici.
    J'ai un souci a la fin de la commande j'ai ceci : Etape 3. Confirmation de votre demande

    Merci de votre confiance, votre commande a été enregistrée avec succès.
    Fatal error: Call to undefined function: email_commande() in /homepages/9/d142572159/htdocs/boutique/achat/fin_commande.php on line 102

    Une petite idee pour resoudre ce probleme la derniere modif que j'ai fait est a partir de la : http://forum.peel.fr/index.php?showtopic=1...email&st=20 mais tous fonctionner

    Merci de votre aide ;)
    • 1 réponse
    • 1 460 vues

Twitter Advisto ecommerce

Facebook PEEL Shopping