$val){ $$cle=$val; //echo $cle.' => '.$val.'
'; } $etaCoLy = crypter($maCleDeCryptage,$etaCoLy); $nomCoLy = crypter($maCleDeCryptage,$nomCoLy); $prenomCoLy = crypter($maCleDeCryptage,$prenomCoLy); $fonctionCoLy = crypter($maCleDeCryptage,$fonctionCoLy); $telCoLy = crypter($maCleDeCryptage,$telCoLy); $emlCoLy = crypter($maCleDeCryptage,$emlCoLy); $adresse1CoLy = crypter($maCleDeCryptage,$adresse1CoLy); $adresse2CoLy = crypter($maCleDeCryptage,$adresse2CoLy); $cpCoLy = crypter($maCleDeCryptage,$cpCoLy); $villeCoLy = crypter($maCleDeCryptage,$villeCoLy); $commentCoLy = crypter($maCleDeCryptage,$commentCoLy); if($mycreneau == 'am'){ $creneau1 = 'am1'; $creneau2 = 'am2'; $nomCreneau = "Matin"; } if($mycreneau == 'pm'){ $creneau1 = 'pm1'; $creneau2 = 'pm2'; $nomCreneau = "Après-midi"; } //pour tester /*$mydate = '2019-01-28'; $creneau1 = 'am1'; $creneau2 = 'am2';*/ $db = connect_base(); //Mémorise les infos du CFA par défaut dans le cas où aucun capitaine n'est trouvé $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(); } $emlReferrent = decrypter($maCleDeCryptage,$dataCfa[0]['email_ref']); $nomEta = decrypter($maCleDeCryptage,$dataCfa[0]['nom_eta']); $idCapitaine = 0; $lastAction = 'ref'; //Vérifie si le créneau est libre pour un des jours suivants $query=" SELECT * FROM capitaines INNER JOIN eta ON id_eta=num_eta INNER JOIN agenda ON id_cap = numCap WHERE id_eta=:id_eta AND jour=:jour AND (creneau=:creneau1 || creneau=:creneau2) AND numCoLy=0 AND statut='libre' ORDER BY id_cap"; $queryRequest = $db->prepare( $query ); $queryRequest->bindParam( ':id_eta', $ncfa, PDO::PARAM_INT ); $queryRequest->bindParam( ':jour', $mydate, PDO::PARAM_STR ); $queryRequest->bindParam( ':creneau1', $creneau1, PDO::PARAM_STR ); $queryRequest->bindParam( ':creneau2', $creneau2, PDO::PARAM_STR ); $queryRequest->execute(); $count = $queryRequest->rowCount(); if($count>0){ $data=$queryRequest->fetchAll(); $emlCapitaine = decrypter($maCleDeCryptage,$data[0]['email_cap']); $idCapitaine = $data[0]['id_cap']; $lastAction = 'cap'; } //echo $emlCapitaine;echo $emlReferrent;exit(); $dateCreate = date('Y-m-d'); $provenance = 'sollicitation'; if(!empty($ncfa)){ //Insertion de l'établissement $query=" INSERT INTO sollicitations (etaCoLy, nomCoLy, prenomCoLy, fonctionCoLy, telCoLy, emlCoLy, adresse1CoLy, adresse2CoLy, cpCoLy, villeCoLy, nbClasses, nbEleves, commentCoLy, dateCreate, chxNumEta, provenance, chxJour, chxCreneau, idCapitaine, lastAction) VALUES (:etaCoLy, :nomCoLy, :prenomCoLy, :fonctionCoLy, :telCoLy, :emlCoLy, :adresse1CoLy, :adresse2CoLy, :cpCoLy, :villeCoLy, :nbClasses, :nbEleves, :commentCoLy, :dateCreate, :chxNumEta, :provenance, :chxJour, :chxCreneau, :idCapitaine, :lastAction)"; $queryRequest = $db->prepare( $query ); $queryRequest->bindParam( ':etaCoLy', $etaCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':nomCoLy', $nomCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':prenomCoLy', $prenomCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':fonctionCoLy', $fonctionCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':telCoLy', $telCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':emlCoLy', $emlCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':adresse1CoLy', $adresse1CoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':adresse2CoLy', $adresse2CoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':cpCoLy', $cpCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':villeCoLy', $villeCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':nbClasses', $nbClasses, PDO::PARAM_INT ); $queryRequest->bindParam( ':nbEleves', $nbEleves, PDO::PARAM_INT ); $queryRequest->bindParam( ':commentCoLy', $commentCoLy, PDO::PARAM_STR ); $queryRequest->bindParam( ':dateCreate', $dateCreate, PDO::PARAM_STR ); $queryRequest->bindParam( ':chxNumEta', $ncfa, PDO::PARAM_INT ); $queryRequest->bindParam( ':provenance', $provenance, PDO::PARAM_INT ); $queryRequest->bindParam( ':chxJour', $mydate, PDO::PARAM_INT ); $queryRequest->bindParam( ':chxCreneau', $mycreneau, PDO::PARAM_INT ); $queryRequest->bindParam( ':idCapitaine', $idCapitaine, PDO::PARAM_INT ); $queryRequest->bindParam( ':lastAction', $lastAction, PDO::PARAM_INT ); $queryRequest->execute(); //Envoi d'un email au capitaine ou référrent require 'config/class.phpmailer.php'; $mail = new PHPMailer; // Configuration du SMTP $mail->IsSMTP(); $mail->Host = 'smtp-in.oximailing.com'; $mail->Port = 587; $mail->SMTPAuth = true; $mail->Username = 'BNCx6kLkQZxXYRAZrYVw'; $mail->Password = 'xoSAgSV6MrP568KqC3FM'; $mail->SMTPSecure ='tls'; // Entête de l'email $mail->From = 'inscriptions@deciday.fr'; $mail->FromName = utf8_decode("DECIDAY!"); if(!empty($emlCapitaine)) $to=$emlCapitaine; else $to=$emlReferrent; $objet="Nouvelle sollicitation DECIDAY !"; $adresseCL = $_POST['adresse1CoLy']; if(!empty($adresse1CoLy)) $adresseCL .= '
'.$_POST['adresse2CoLy']; $adresseCL .= '
'.$_POST['cpCoLy'].' '.$_POST['villeCoLy']; $affich=''; $affich.=''; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; $affich.=''; $affich.=''; $affich.=''."\n"; echo $affich.='
 
Bonjour,
 
Dans le cadre de l\'évènement Déciday !, une sollicitation a été effectuée par un établissement pour la venue d\'un trinôme au sein de ses locaux.
 
Récapitulatif de la sollicitation :
 
Jour : '.MysqlToDateFr($mydate).'
Créneau : '.$nomCreneau.'
 
Etablissement demandeur : '.$_POST['etaCoLy'].'
Adresse : '.$adresseCL.'
Nom : '.$_POST['prenomCoLy'].' '.mb_strtoupper($_POST['nomCoLy']).'
Fonction : '.$_POST['fonctionCoLy'].'
Téléphone : '.$_POST['telCoLy'].'
email : '.$_POST['emlCoLy'].'
 
Commentaires : '.nl2br($_POST['commentCoLy']).'
 
Nombre de classes : '.$nbClasses.'
Nombre d\'élèves : '.$nbEleves.'
 
Etablissement demandé : '.$nomEta.'
 
Vous pouvez traiter vos sollicitations en vous connectant sur votre espace.
 
Me connecter
sur Deciday !
 
Cordialement.
 
L\'équipe DECIDAY.
'; $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(); /* copie de controle*/ $mail2 = new PHPMailer; // Configuration du SMTP $mail2->IsSMTP(); $mail2->Host = 'smtp-in.oximailing.com'; $mail2->Port = 587; $mail2->SMTPAuth = true; $mail2->Username = 'BNCx6kLkQZxXYRAZrYVw'; $mail2->Password = 'xoSAgSV6MrP568KqC3FM'; $mail2->SMTPSecure ='tls'; // Entête de l'email $mail2->From = 'inscriptions@deciday.fr'; $mail2->FromName = utf8_decode("DECIDAY!"); $affich2 = $affich.$to; $mail2->IsHTML(true); $mail2->AddEmbeddedImage('images/bandeau-contact.jpg', 'bando', 'bandeau-contact.jpg'); $mail2->Subject = utf8_decode($objet); $mail2->Body = utf8_decode($affich2); $mail2->AddAddress('s.descamps@fafih.com'); $mail2->AddBCC('tech@pointvirgule.net'); $mail2->AltBody = "/-------//--------/"; $mail2->send(); /* confirmation enseignant*/ $mail3 = new PHPMailer; // Configuration du SMTP $mail3->IsSMTP(); $mail3->Host = 'smtp-in.oximailing.com'; $mail3->Port = 587; $mail3->SMTPAuth = true; $mail3->Username = 'BNCx6kLkQZxXYRAZrYVw'; $mail3->Password = 'xoSAgSV6MrP568KqC3FM'; $mail3->SMTPSecure ='tls'; // Entête de l'email $mail3->From = 'inscriptions@deciday.fr'; $mail3->FromName = utf8_decode("DECIDAY!"); $affich3=''; $objet2="Votre sollicitation DECIDAY !"; $affich3.=''; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.=''; $affich3.=''; $affich3.=''."\n"; $affich3.='
 
Bonjour,
 
Votre sollicitation a bien été transmise.
 
Récapitulatif de votre sollicitation :
 
Jour : '.MysqlToDateFr($mydate).'
Créneau : '.$nomCreneau.'
 
Etablissement demandé : '.$nomEta.'
 
Nous vous remercions pour votre participation à Deciday! Un kit pédagogique est à votre disposition pour préparer votre classe à la venue du trinôme.
Veuillez trouver ci-dessous les liens de téléchargement du kit pédagogique.
 
'; $tFilesBao = listFilesBao('kitPedago'); foreach($tFilesBao as $k=>$v){ $affich3 .= ''.$v['title'].'
'; } $affich3.='
 
Cordialement.
 
L\'équipe DECIDAY.
'; $to = $_POST['emlCoLy']; $mail3->IsHTML(true); $mail3->AddEmbeddedImage('images/bandeau-contact.jpg', 'bando', 'bandeau-contact.jpg'); $mail3->Subject = utf8_decode($objet2); $mail3->Body = utf8_decode($affich3); $mail3->AddAddress($to); $mail3->AltBody = "/-------//--------/"; $mail3->send(); $_SESSION['msg']='Votre sollicitation a bien été transmise.'; }else{ $_SESSION['msg']='Le créneau n\'a pas pu être réservé car il n\'est pas disponible.'; } header('location:index.php'); exit(); } header('location:index.php?err=1'); exit(); ?>