pv_project/site/contact-eta-actions.php
2025-07-17 10:15:19 +02:00

130 lines
4.1 KiB
PHP

<?php
include('include/entete.php');
include('config/config.inc.php');
include('config/lib.inc.php');
if(isset($_POST['action']) && $_POST['action']=='contactEta'){
foreach($_POST as $cle=>$val){
echo $cle." => ".$val."<br />";
$$cle=$val;
}
$query="
SELECT * from eta
WHERE id_eta=:num_eta
";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':num_eta', $ncfa, PDO::PARAM_INT );
$queryRequest->execute();
$dataCfa=$queryRequest->fetchAll();
$countCfa = $queryRequest->rowCount();
if($countCfa!=1){ //CFA introuvable
header('location:./');
exit();
}
$maCleDeCryptage = getCleDeCryptage();
$nomEta = decrypter($maCleDeCryptage,$dataCfa[0]['nom_eta']);
$emailEta = decrypter($maCleDeCryptage,$dataCfa[0]['email_ref']);
require 'config/class.phpmailer.php';
require 'config/phpmailer.settings.php';
$to=$emailEta;
$objet="Demande de contact sur le site DECIDAY";
$affich='';
$affich.='<table cellpadding="3" style="font-family:ARIAL; width:600px;">';
$affich.='<tr>';
$affich.='<td colspan="2"><img src="" /></td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2"><img src="cid:bando" alt="" width="600" height="150" border="0" /></td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">&nbsp;</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">Bonjour,</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">&nbsp;</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">Dans le cadre de l\'évènement Déciday !, un coll&egrave;ge souhaite prendre contact avec vous.</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">&nbsp;</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right" width="297">Etablissement : </td><td>'.$etaCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Nom : </td><td>'.$nomCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Pr&eacute;nom : </td><td>'.$prenomCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Fonction : </td><td>'.$fonctionCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Ligne directe : </td><td>'.$telCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">E-mail : </td><td>'.$emlCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Adresse 1 : </td><td>'.$adresse1CoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Adresse 2 : </td><td>'.$adresse2CoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Code postal : </td><td>'.$cpCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Ville : </td><td>'.$villeCoLy.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Nombre de classes : </td><td>'.$nbClasses.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right">Nombre total d\'&eacute;l&egrave;ves concern&eacute;s : </td><td>'.$nbEleves.'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td align="right" valign="top">Commentaires : </td><td>'.nl2br($commentCoLy).'</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">&nbsp;</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">Cordialement.</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">&nbsp;</td>';
$affich.='</tr>'."\n";
$affich.='<tr>';
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
$affich.='</tr>'."\n";
$affich.='</table>';
$mail->IsHTML(true);
$mail->AddEmbeddedImage('images/bandeau-contact.jpg', 'bando', 'bandeau-contact.jpg');
$mail->Subject = utf8_decode($objet);
$mail->Body = utf8_decode($affich);
$mail->AddAddress($to);
$mail->AltBody = "/-------//--------/";
$mail->send();
$_SESSION['msg']='Votre demande a bien été envoyée.';
header('location:contact-eta.php');
exit();
}
?>