581 lines
21 KiB
PHP
581 lines
21 KiB
PHP
<?php
|
|
include('include/entete.php');
|
|
include('include/entete_cfa.php');
|
|
include('config/config.inc.php');
|
|
include('config/lib.inc.php');
|
|
|
|
//Le référent créé un trinôme en désignant un capitaine
|
|
if(isset($_POST['action']) && $_POST['action']=='go_aj'){
|
|
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
$mdp=Password(8,0);
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
$nom_cap2=crypter($maCleDeCryptage,$nom_cap);
|
|
$prenom_cap2=crypter($maCleDeCryptage,$prenom_cap);
|
|
$email_cap2=crypter($maCleDeCryptage,$email_cap);
|
|
|
|
//Récupère l'email du référent (le référent peut décider d'être lui-même capitaine dans un de ses trinômes)
|
|
/*
|
|
$actualEml = '';
|
|
$query="select * from eta where id_eta=:id_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
if($queryRequest->rowCount()==0){
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
$dataActual=$queryRequest->fetchAll();
|
|
$actualEml = decrypter($maCleDeCryptage,$dataActual[0]['email_ref']);
|
|
*/
|
|
|
|
//Impossible de créer un capitaine si un autre capitaine possède le même email
|
|
$query="select * from capitaines where email_cap=:email_cap";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//Impossible pour le référent de créer un capitaine avec un email utilisé pour un référent (Le référent a le droit de créer un compte capitaine avec son email dans un de ses trinômes)
|
|
$query="select * from eta where email_ref=:email_cap AND id_eta!=:id_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
$query = 'insert into capitaines (num_eta,nom_cap,prenom_cap,email_cap,mdp_cap) values (:num_eta,:nom_cap,:prenom_cap,:email_cap,:mdp_cap)';
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':num_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':nom_cap', $nom_cap2, PDO::PARAM_STR);
|
|
$queryRequest->bindParam( ':prenom_cap', $prenom_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mdp_cap', md5($mdp), PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$id_cap=$db->lastInsertId();
|
|
|
|
include('include/agenda.inc.php');
|
|
foreach($arrWeek as $kw=>$vw){
|
|
foreach($vw as $vDay){
|
|
if(!empty($vDay)){
|
|
foreach($arrCreneaux as $va){
|
|
if($vDay==$theGreatDay) $statut='libre';
|
|
else $statut='bloque';
|
|
$numCoLy=0;
|
|
$query2 = "insert into agenda (numCap,numCoLy,numEta,jour,creneau,statut,dateLastUpdate) values (:numCap,:numCoLy,:numEta,:jour,:creneau,:statut,:dateLastUpdate)";
|
|
$db2 = connect_base();
|
|
$queryRequest2 = $db2->prepare( $query2 );
|
|
$queryRequest2->bindParam( ':numCap', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest2->bindParam( ':numCoLy', $numCoLy, PDO::PARAM_INT );
|
|
$queryRequest2->bindParam( ':numEta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest2->bindParam( ':jour', $vDay, PDO::PARAM_STR );
|
|
$queryRequest2->bindParam( ':creneau', $va, PDO::PARAM_STR );
|
|
$queryRequest2->bindParam( ':statut', $statut, PDO::PARAM_STR );
|
|
$queryRequest2->bindParam( ':dateLastUpdate', date('Y-m-d'), PDO::PARAM_STR );
|
|
$queryRequest2->execute();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
$query = 'insert into equipes (num_eta,num_capitaine) values (:num_eta,:num_capitaine)';
|
|
$db = connect_base();
|
|
$queryRequest3 = $db->prepare( $query );
|
|
$queryRequest3->bindParam( ':num_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest3->bindParam( ':num_capitaine', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest3->execute();
|
|
|
|
include('config/class.phpmailer.php');
|
|
|
|
$to=$email_cap;
|
|
$from = 'inscriptions@deciday.fr';
|
|
$objet="Votre compte 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"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bonjour,</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Dans le cadre de l\'évènement Déciday !, le référent de votre établissement a créé votre compte d\'accès "Capitaine" pour <b>gérer votre trinôme</b>.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Vous pouvez : </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Renseigner les membres de votre trinôme</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Accéder à la boite à outils Deciday</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Organiser votre agenda Deciday</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Voici vos paramètres de connexion :</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right" width="297">Votre identifiant : </td><td>'.$email_cap.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Votre mot de passe : </td><td>'.$mdp.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2" align="center"><table style="width:200px;background-color: #674B64;border: 1px solid #371B34;padding: 4px 6px;"><tr><td align="center"><a href="http://www.deciday.fr/connexion-cfa.php" style="color: #FFF;text-decoration: none;text-transform: uppercase; font-family:ARIAL;"><strong>Connectez-vous</strong></a></td></tr></table></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Cordialement.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
|
|
$affich.='</table>';
|
|
|
|
|
|
$mail = new PHPMailer();
|
|
$mail->From = $from;
|
|
$mail->FromName=utf8_decode("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->AddBCC('deciday@fafih.com');
|
|
|
|
$mail->AltBody = "/-------//--------/";
|
|
$mail->send();
|
|
|
|
$_SESSION['msg']='Le trinôme a bien été créé. Un email a été envoyé au capitaine avec ses informations de connexion.';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
|
|
}
|
|
|
|
//Le référent modifie un capitaine
|
|
if(isset($_POST['action']) && $_POST['action']=='go_mo'){
|
|
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
if(!isset($id_cap) || empty($id_cap)){
|
|
header('location:index_cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//Teste si l'item capitaine à modifier existe
|
|
$actualEml = '';
|
|
$query="select * from capitaines where id_cap=:id_cap and num_eta=:num_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':id_cap', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':num_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
if($queryRequest->rowCount()==0){
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}else{
|
|
$dataActual=$queryRequest->fetchAll();
|
|
$actualEml = $dataActual[0]['email_cap'];
|
|
}
|
|
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
$nom_cap2=crypter($maCleDeCryptage,$nom_cap);
|
|
$prenom_cap2=crypter($maCleDeCryptage,$prenom_cap);
|
|
$email_cap2=crypter($maCleDeCryptage,$email_cap);
|
|
|
|
//Teste si l'email correspond déjà à un compte capitaine
|
|
$query="select * from capitaines where email_cap=:email_cap and id_cap!=:id_cap";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_cap', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//Teste si l'email correspond à une compte référent d'établissement (Le référent a le droit d'avoir un compte capitaine avec son email dans un de ses trinômes)
|
|
$query="select * from eta where email_ref=:email_cap AND id_eta!=:id_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//envoi des nouveaux paramètres de connexion si l'email du capitaine a été changé
|
|
if($actualEml!=$email_cap2){ //if(decrypter($maCleDeCryptage,$actualEml)!=decrypter($maCleDeCryptage,$email_cap2))
|
|
|
|
include('config/class.phpmailer.php');
|
|
|
|
$mdp=Password(8,0);
|
|
$to=$email_cap;
|
|
|
|
$from = 'inscriptions@deciday.fr';
|
|
$objet="Votre compte 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"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bonjour,</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Dans le cadre de l\'évènement Déciday !, le référent de votre établissement a créé votre compte d\'accès "Capitaine" pour <b>gérer votre trinôme</b>.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Vous pouvez : </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Renseigner les membres de votre trinôme</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Accéder à la boite à outils Deciday</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Organiser votre agenda Deciday</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Voici vos paramètres de connexion :</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right" width="297">Votre identifiant : </td><td>'.$email_cap.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Votre mot de passe : </td><td>'.$mdp.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2" align="center"><table style="width:200px;background-color: #674B64;border: 1px solid #371B34;padding: 4px 6px;"><tr><td align="center"><a href="http://www.deciday.fr/connexion-cfa.php" style="color: #FFF;text-decoration: none;text-transform: uppercase; font-family:ARIAL;"><strong>Connectez-vous</strong></a></td></tr></table></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Cordialement.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
|
|
$affich.='</table>';
|
|
|
|
$mail = new PHPMailer();
|
|
$mail->From = $from;
|
|
$mail->FromName=utf8_decode("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->AddBCC('deciday@fafih.com');
|
|
$mail->AltBody = "/-------//--------/";
|
|
$mail->send();
|
|
|
|
$query='update capitaines set nom_cap=:nom_cap, prenom_cap=:prenom_cap, email_cap=:email_cap, mdp_cap=:mdp_cap where id_cap=:id_cap';
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':nom_cap', $nom_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':prenom_cap', $prenom_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mdp_cap', md5($mdp), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_cap', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
$_SESSION['msg']='Le trinôme a bien été modifié. Un email a été envoyé au capitaine avec ses informations de connexion.';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
|
|
}else{
|
|
|
|
$query='update capitaines set nom_cap=:nom_cap, prenom_cap=:prenom_cap, email_cap=:email_cap where id_cap=:id_cap';
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':nom_cap', $nom_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':prenom_cap', $prenom_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_cap', $id_cap, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
$_SESSION['msg']='Le trinôme a bien été modifié.';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Le référent modifie son profil
|
|
|
|
if(isset($_POST['action']) && $_POST['action']=='go_mo_ref'){
|
|
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
if(!isset($id_eta) || empty($id_eta)){
|
|
header('location:index_cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//Teste si l'item référent à modifier existe
|
|
$actualEml = '';
|
|
$query="select * from eta where id_eta=:id_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
if($queryRequest->rowCount()==0){
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
$dataActual=$queryRequest->fetchAll();
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
|
|
$actualEml = $dataActual[0]['email_ref'];
|
|
|
|
$nom_ref2=crypter($maCleDeCryptage,$nom_ref);
|
|
$tel_ref2=crypter($maCleDeCryptage,$tel_ref);
|
|
$email_ref2=crypter($maCleDeCryptage,$email_ref);
|
|
|
|
//Teste si l'email correspond déjà à un compte référent d'établissement
|
|
$query="select * from eta where email_ref=:email_ref and id_eta!=:id_eta";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_ref', $email_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//Teste si l'email correspond à un compte capitaine
|
|
$query="select * from capitaines where email_cap=:email_ref";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_ref', $email_ref2, PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
echo $_SESSION['msg']='Cet email est déjà enregistré';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
//envoi des nouveaux paramètres de connexion si l'email du référent a été changé
|
|
if($actualEml!=$email_ref2){
|
|
|
|
include('config/class.phpmailer.php');
|
|
|
|
$mdp=Password(8,0);
|
|
$to=$email_ref;
|
|
|
|
$from = 'inscriptions@deciday.fr';
|
|
$objet="Votre compte 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"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bonjour,</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Dans le cadre de l\'évènement Déciday !, le responsable de votre établissement vous a nommé référent.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Vous pouvez ainsi : </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Déclarer et suivre vos trinômes</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Superviser leurs agendas</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Accéder à la boite à outils Deciday</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> - Renseigner vos dates de portes ouvertes</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Voici vos paramètres de connexion :</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right" width="297">Votre identifiant : </td><td>'.$email_ref.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Votre mot de passe : </td><td>'.$mdp.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2" align="center"><table style="width:200px;background-color: #674B64;border: 1px solid #371B34;padding: 4px 6px;"><tr><td align="center"><a href="http://www.deciday.fr/connexion-cfa.php" style="color: #FFF;text-decoration: none;text-transform: uppercase; font-family:ARIAL;"><strong>Connectez-vous</strong></a></td></tr></table></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Cordialement.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
|
|
$affich.='</table>';
|
|
|
|
$mail = new PHPMailer();
|
|
$mail->From = $from;
|
|
$mail->FromName=utf8_decode("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->AddBCC('deciday@fafih.com');
|
|
$mail->AltBody = "/-------//--------/";
|
|
$mail->send();
|
|
|
|
$query='update eta set nom_ref=:nom_ref, tel_ref=:tel_ref, email_ref=:email_ref, mdp_ref=:mdp_ref where id_eta=:id_eta';
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':nom_ref', $nom_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':tel_ref', $tel_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_ref', $email_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mdp_ref', md5($mdp), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
//Le Référent transmet ses pouvoirs à une autre personne. Déconnexion automatique.
|
|
header('location:deco.php');
|
|
exit();
|
|
|
|
}else{
|
|
|
|
$query='update eta set nom_ref=:nom_ref, tel_ref=:tel_ref, email_ref=:email_ref where id_eta=:id_eta';
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':nom_ref', $nom_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':tel_ref', $tel_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_ref', $email_ref2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
$_SESSION['msg']='Vos données ont bien été modifiées.';
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
?>
|