HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/frenchy/refonte2023/wordpress/evenements/paiement3.php
<?php
//ini_set('display_errors', 1);
require_once("_mysql.php");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'admin/PHPMailer/src/Exception.php';
require 'admin/PHPMailer/src/PHPMailer.php';
require 'admin/PHPMailer/src/SMTP.php';
setlocale (LC_TIME, 'fr_FR.utf8','fra');
if (isset($_POST['email']) && $_POST['email'] != "")
{
  die("Robot");
}
$erreur = '';
if (isset($_POST['id_evenement']))
{
  $id_evenement = $_POST['id_evenement'];
  $req = mysqli_query($link_bdd, "select * from evenements where id_evenement = ".$id_evenement." and date_debut_evenement <= '".date("Y-m-d")."' and date_fin_evenement >= '".date("Y-m-d")."'");
  if (mysqli_num_rows($req) != 0)
  {
    $line = mysqli_fetch_array($req);
  }
  else
  {
    die ("Aucun evenement ne correspond");
  }
}
else
{
  die ("Aucun evenement ne correspond");
}
if (isset($_POST['envoiForm']))
{
  $type_paiement = 'NON PAYE PAYPAL';
  if ($_POST['type_paiement'] == 'CHEQUE')
  {
    $type_paiement = 'CHEQUE';
  }
  if ($_POST['type_paiement'] == 'AUCUN')
  {
    $type_paiement = 'AUCUN';
  }
  $montant = $_POST['montant_total'];
  if ($montant == 0)
  {
    $type_paiement ='AUCUN';
  }
  $membre_contact = 'N/A';

  $choix_diner = "";
  $checkbox_diner = "";
  $nb_diner = "";
  $code_reduction='';
  $mtt_reduction = 0;
  
  $choix_diner = $_POST['radio_diner'];
  if ($_POST['radio_diner'] == '750individuel')
  {
    $checkbox_diner = $_POST['hnombretotal750personneindividuel'];
    $nb_diner = $_POST['nombre750personneindividuel'];
  }
  if ($_POST['radio_diner'] == '1000individuel')
  {
    $checkbox_diner = $_POST['hnombretotal1000personneindividuel'];
    $nb_diner = $_POST['nombre1000personneindividuel'];
  }
  if ($_POST['radio_diner'] == '1500individuel')
  {
    $checkbox_diner = $_POST['hnombretotal1500personneindividuel'];
    $nb_diner = $_POST['nombre1500personneindividuel'];
  }
  if ($_POST['radio_diner'] == '12000table')
  {
    $checkbox_diner = $_POST['hnombretotal12000personneindividuel'];
    $nb_diner = $_POST['nombre12000personneindividuel'];
  }
  if ($_POST['radio_diner'] == '25000table')
  {
    $checkbox_diner = $_POST['hnombretotal25000personneindividuel'];
    $nb_diner = $_POST['nombre25000personneindividuel'];
  }
  if ($_POST['montant_code_reduction'] != 0)
  {
    $mtt_reduction = $_POST['montant_code_reduction'];
    $code_reduction = $_POST['saisie_code_reduction'];
  }
  
  
  $don_sup = "";
  if (isset($_POST['checkbox_don']))
  {
    if (isset($_POST['don_sup']) && $_POST['don_sup'] != '' && is_numeric($_POST['don_sup']))
    {
      $don_sup = $_POST['don_sup'];
    }
  }
  
  $choix = $choix_diner.'-'.$nb_diner.'-'.$checkbox_diner."-".$code_reduction. "|".$don_sup;
  
  mysqli_query($link_bdd, "INSERT INTO `contacts3` ( `civilite_contact`, `prenom_contact`, `nom_contact`, `fonction_contact`, `entreprise_contact`, `telephone_contact`, `portable_contact`, `email_contact`, `adresse_entreprise_contact`, `code_postal_entreprise_contact`, `ville_entreprise_contact`, `membre_contact`, `id_evenement`, `montant_paiement`, `top_paiement`, `choix`) VALUES
                                      ( '".mysqli_real_escape_string($link_bdd, $_POST['civilite_contact'])."', '".mysqli_real_escape_string($link_bdd, $_POST['prenom_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['nom_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['fonction_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['entreprise_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['telephone_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['portable_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['email_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['adresse_entreprise_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['code_postal_entreprise_contact'])."','".mysqli_real_escape_string($link_bdd, $_POST['ville_entreprise_contact'])."','".mysqli_real_escape_string($link_bdd, $membre_contact)."',".$id_evenement.",'".mysqli_real_escape_string($link_bdd, $montant)."','".$type_paiement."','".$choix."')");

  $id_contact = mysqli_insert_id($link_bdd);

  // Gestion email Cheque
  if ($type_paiement =='CHEQUE' || $type_paiement =='AUCUN' || $montant == 0)
  {
    // Specifique Facture
    $Specifique = "";
    
    // On envoi un mail
    $subject = "Confirmation inscription : ".html_entity_decode($line['libelle_evenement'])." ".strftime("%A %d %B %Y", strtotime($line['date_evenement']));
    $fd = fopen("mailconfirmation2.htm", "r");
    $message = fread($fd, filesize('mailconfirmation2.htm'));
    fclose($fd);
    
    $ligne1 = "<td width='50%'>".$line['libelle_evenement']."</td><td width='50%'>&nbsp;</td>";
    
    $ligne2 = "<td width='50%'>";
    if ($checkbox_diner != '')
    {
      $Specifique .=".";
      if ($_POST['radio_diner'] == '750individuel')
      {
        $ligne2 .= $nb_diner." X Dîner de Gala 750&euro; Individuel<br />";
      }
      if ($_POST['radio_diner'] == '1000individuel')
      {
        $ligne2 .= $nb_diner." X Dîner de Gala 1000&euro; Individuel<br />";
      }
      if ($_POST['radio_diner'] == '1500individuel')
      {
        $ligne2 .= $nb_diner." X Dîner de Gala 1500&euro; Individuel<br />";
      }
      if ($_POST['radio_diner'] == '12000table')
      {
        $ligne2 .= $nb_diner." X Dîner de Gala 12000&euro; Table 12 personnes<br />";
      }
      if ($_POST['radio_diner'] == '25000table')
      {
        $ligne2 .= $nb_diner." X Dîner de Gala 25000&euro; Table 12 personnes<br />";
      }
    }
    if ($don_sup != '')
    {
      $Specifique .="";
      $ligne2 .= "Je souhaite faire un don<br />";
    }
    if ($code_reduction != '')
    {
      mysqli_query($link_bdd, "update bon_reductions set nb_utilisation = nb_utilisation - 1 where upper(code_bon) = '".strtoupper($code_reduction)."'");
      $reqBon = mysqli_query($link_bdd, "select * from bon_reductions where upper(code_bon) = '".strtoupper($code_reduction)."'");
      $lineBon = mysqli_fetch_array($reqBon);
      $libelle_reduction = $lineBon['libelle_bon'];
      $ligne2 .= $libelle_reduction."<br />";
    }
    $ligne2 .= "</td>";
    $ligne2 .= "<td width='50%'>";
    if ($checkbox_diner != '')
    {
      $ligne2 .= number_format($checkbox_diner, 2, ',', ' ')."&euro;<br/>";
    }
    if ($don_sup != '')
    {
      $ligne2 .= number_format($don_sup, 2, ',', ' ')."&euro;<br/>";
    }
    if ($code_reduction != '')
    {
      $ligne2 .= "-".number_format($mtt_reduction, 2, ',', ' ')."&euro;<br/>";
    }
    $ligne2 .= "</td>";
    if ($montant != 0)
    {
      $ligne3 = "<td width='50%'><b>Total &agrave; payer</b></td><td width='50%'><b>".number_format($montant, 2, ',', ' ')."&euro;</b></td>";
    }
    else
    {
      $ligne3 = "";
    }
    $message = str_replace("%LIGNEPAIEMENT%", "", $message);
    if ($montant != 0)
    {
      $message = str_replace("%FACTUREJOINTE%", "Vous trouverez en pi&egrave;ce jointe votre facture".$Specifique, $message);
      $message = str_replace("%MESSAGE1%", "<p>Merci d'envoyer votre r&egrave;glement par ch&egrave;que libell&eacute; &agrave; l'ordre de la French-American Foundation - France, 18 bis boulevard Arago, 75013 Paris <br />Votre inscription sera confirm&eacute;e d&egrave;s r&eacute;ception de votre r&egrave;glement.</p>", $message);
    }
    else
    {
      $message = str_replace("%FACTUREJOINTE%", "&nbsp;", $message);
      $message = str_replace("%MESSAGE1%", "&nbsp;", $message);
    }
    $message = str_replace("%DATEEVENEMENT%", strftime("%A %d %B %Y", strtotime($line['date_evenement'])), $message);
    $message = str_replace("%LIGNE1%", $ligne1, $message);
    $message = str_replace("%LIGNE2%", $ligne2, $message);
    $message = str_replace("%LIGNE3%", $ligne3, $message);
    $message = str_replace("%LIBELLEEVENEMENT%", $line['libelle_evenement'], $message);
    $message = str_replace("%ENTETENOM%", stripcslashes($_POST['civilite_contact'] . " " . $_POST['prenom_contact'] . " " . $_POST['nom_contact']), $message);
    // Envoi de la copie du pdf
    $reqContact = mysqli_query($link_bdd, "select * from contacts3 where id_contact=".$id_contact);
    $lineContact = mysqli_fetch_array($reqContact);
    $type_paiement = 'CHEQUE';
    $designation = html_entity_decode($line['libelle_evenement'])." ".strftime("%A %d %B %Y", strtotime($line['date_evenement']));
    if ($montant !=0)
    {
      require_once("admin/pdf/genepdf3.php");
    }
    // PHP Mailer
    $mail = new PHPmailer();
    $mail->IsSMTP();                                  // send via SMTP
    $mail->Mailer = "smtp";                           // Mode d'acces
    $mail->Host = "smtp.outlook.office365.com";       // SMTP servers
    $mail->SMTPAuth = true;                           // turn on SMTP authentification
    $mail->Username = "sendmail@french-american.org";   // SMTP username
    $mail->Password = "SE4848+1";                      // SMTP password
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    $mail->IsHTML(true);
    $mail->Sender = "contact@french-american.org";
    $mail->From="contact@french-american.org";
    $mail->FromName="French-american.org";
    $mail->AddReplyTo("contact@french-american.org");
    if ($montant !=0)
    {
      $mail->AddAttachment("admin/pdf/factures/".$nompdf);
    }
    $mail->Subject=$subject;
    $mail->Body=utf8_decode($message);
    $mail->ClearAddresses();
    $mail->AddAddress($_POST['email_contact']);
    if ($line['confirmation'] != 'non')
    {
      if (!$mail->Send())
      {
        echo '<script>document.location.href="http://www.french-american.org/evenements/merci.php?id_evenement='.$id_evenement.'&top=ko";</script>';
      }
    }
    
    if ($montant !=0)
    {
      // PHP Mailer
      $mail2 = new PHPmailer();
      $mail2->IsSMTP();                                  // send via SMTP
      $mail2->Mailer = "smtp";                           // Mode d'acces
      $mail2->Host = "smtp.outlook.office365.com";       // SMTP servers
      $mail2->SMTPAuth = true;                           // turn on SMTP authentification
      $mail2->Username = "sendmail@french-american.org";   // SMTP username
      $mail2->Password = "SE4848+1";                      // SMTP password
      $mail2->SMTPSecure = 'tls';
      $mail2->Port = 587;
      $mail2->IsHTML(true);
      $mail2->Sender = "contact@french-american.org";
      $mail2->From="contact@french-american.org";
      $mail2->FromName="French-american.org";
      $mail2->AddReplyTo("contact@french-american.org");
      $mail2->AddAttachment("admin/pdf/factures/".$nompdf);
      $mail2->Subject='Commande par Cheque Formulaire French American Foundation';
      $mail2->Body=utf8_decode($message);
      $mail2->ClearAddresses();
      //$mail2->AddAddress('magali.durand@french-american.org');
      $mail2->AddAddress('stephane.didier@live.fr');
      if (!$mail2->Send())
      {
        echo '<script>document.location.href="http://www.french-american.org/evenements/merci.php?id_evenement='.$id_evenement.'&top=ko";</script>';
      }
      @unlink("admin/pdf/factures/".$nompdf);
    }
    
    header('location:http://www.french-american.org/evenements/merci.php?id_evenement='.$id_evenement); 
    
  }
}

if ($id_evenement == '')
{
  die ("Aucun evenement ne correspond");
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html;charset=UTF-8" http-equiv="content-type"/>
<title>Evenement <?=$line['libelle_evenement']?> - Merci de votre inscription</title>
<style type="text/css">
/* General styles */
body { margin: 0; padding: 0; font: 80%/1.5 Arial,Helvetica,sans-serif; color: #111; background-color: #FFF; }
a:hover{
    color:#0172b6;
} 
a{
    color:#0172b6;
} 
a:visited{
    color:#0172b6;
} 
h2 { margin: 0px; padding: 10px; font-family: Georgia, "Times New Roman", Times, serif; font-size: 200%; font-weight: normal; color: #FFF; background-color: #CCC; border-bottom: #BBB 2px solid; }

/* Form styles */
div.form-container {margin: auto; padding: 5px;}

p.legend { margin-bottom: 1em; }
p.legend em { color: #C00; font-style: normal; }

div.form-container form p { margin: 0; }
div.form-container form p.note { margin-left: 170px; font-size: 90%; color: #333; }
div.form-container form fieldset { margin: 10px 0; padding: 10px; border: #DDD 1px solid; }
div.form-container form legend { font-weight: bold; color: #666; }
div.form-container form fieldset div { padding: 0.25em 0; }
div.form-container label, 
div.form-container span.label { margin-right: 10px; padding-right: 10px; width: 150px; display: block; float: left; text-align: right; position: relative; }
div.form-container label em, 
div.form-container span.label em { position: absolute; right: 0; font-size: 120%; font-style: normal; color: #C00; }
div.form-container input:focus,
div.form-container textarea:focus {	background-color: #FFC; border-color: #FC6; }
div.form-container div.controlset label, 
div.form-container div.controlset input { display: inline; float: none; }
div.form-container div.controlset div { margin-left: 170px; }
div.form-container div.buttonrow { margin: auto; text-align:center;}
#divAdhesion { margin: auto; text-align:center; border-width:2px; border-style:solid; border-color:#000000;}
#messageNonMembre { text-align:center; font-size: 12px; font-weight: bold;color:#FF0000;}
#checkboxMembre { font-size: 14px; font-weight: bold;}
</style>
</head>
<body>
<div id="header" style="border: 1px solid #8a959b; width: 752px; margin: auto;">
<table width="100%" cellspacing="0" cellpaddin="0">
<tr>
<td width="50%">
  <img src="/evenements/images/logo_faf.jpg" alt="logo FAF" style="float: left; margin: 30px;" width="300">
</td>
<td width="50%">
  <p style="font-size: 24px;font-weight:bold; color:#0172b6; text-align:right; margin: 30px;">Inscription</p>
</td>
</tr>

<tr>
<td colspan="2" style="background-color:#0172b6; width: 100%;">
      <div style="text-align: center; color:#ffffff; font-size: 20px;"><b><?=utf8_encode(html_entity_decode($line['libelle_evenement']))?></b></div>
  <?php
  if ($line['descriptif_evenement'] != '')
  {
  ?>
      <div style="text-align: center; color:#ffffff; font-size: 14px;"><b><?=nl2br($line['descriptif_evenement'])?></b></div>
  <?php
  }
  ?>
      <div style="text-align: center; color:#ffffff; font-size: 18px;"><b>18-19 novembre 2011</b></div>
</td>
</tr>
<tr>
<td colspan="2">
<?php
/* Debut de paiement Paypal */
echo '<font face=Verdana size=2><center><br><br>
Merci.<br /><br />Pour finaliser votre inscription, nous vous invitons à effectuer votre paiement en ligne d\'un montant de <b>'.($montant).' &euro;</b> par carte bancaire via Paypal.<br>
<br><br>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type=hidden name="amount" value="'.number_format($montant, 2, '.', '').'">
<input type=hidden name="cmd" value="_xclick">
<input name="return" type="hidden" value="http://www.french-american.org/evenements/merci.php?id_evenement='.$id_evenement.'">
<input name="cancel_return" type="hidden" value="http://www.french-american.org/evenements/annule.php?id_evenement='.$id_evenement.'">
<input name="notify_url" type="hidden" value="http://www.french-american.org/evenements/ipn_paypal3.php?id_commande='.$id_contact.'">
<input type=hidden name="email" value="'.$_POST['email_contact'].'">
<input type=hidden name="currency_code" value="EUR">
<input type=hidden name="no_shipping" value="1">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="business_dev" value="'.'franck_1300481920_biz@netcourrier.com'.'">
<input type="hidden" name="business" value="'.'hugues.derevel@french-american.org'.'">
<input type=hidden name="item_name" value="Evenement '.$line['libelle_evenement'].'">
<input type=hidden name="no_note" value="1">
<input name="custom" type="hidden" value="'.$id_contact.'" />
<input type=submit name=submit value="Proc&eacute;der au paiement s&eacute;curis&eacute; par CB &gt;&gt;">
</form>
<br><br>';
/* Fin de paiement Paypal */
?>
</td>
</tr>
</table>
</div>
</body></html>