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

101 lines
2.8 KiB
PHP

<?php
include('include/entete.php');
include('config/config.inc.php');
include('config/lib.inc.php');
if(isset($_GET['id']) && !empty($_GET['id'])){
$id=$_GET['id'];
$query = 'update inscriptions_pro set statut=1 where id_pro=:id_pro';
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':id_pro', $id, PDO::PARAM_INT );
$queryRequest->execute();
// Envoi de la notification au professionnel
$query2="
SELECT * from inscriptions_pro
WHERE id_pro=:id_pro
";
$db2 = connect_base();
$queryRequest2 = $db2->prepare( $query2 );
$queryRequest2->bindParam( ':id_pro', $id, PDO::PARAM_INT );
$queryRequest2->execute();
$dataPro=$queryRequest2->fetchAll();
$countPro = $queryRequest2->rowCount();
if($countPro!=1){ //Pro introuvable
header('location:./');
exit();
}
$maCleDeCryptage = getCleDeCryptage();
$nomEtaPro = decrypter($maCleDeCryptage,$dataPro[0]['etablissement_pro']);
$nomPro = decrypter($maCleDeCryptage,$dataPro[0]['nom_pro']);
$prenomPro = decrypter($maCleDeCryptage,$dataPro[0]['prenom_pro']);
$emailPro = decrypter($maCleDeCryptage,$dataPro[0]['email_pro']);
//Envoi d'un email au pro
require 'config/class.phpmailer.php';
require 'config/phpmailer.settings.php';
$to=$emailPro;
$objet="Demande d'inscription validée";
$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">Votre inscription dans le cadre de l\'évènement Déciday! a été validée.</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']='Le professionnel est validé, un email de notification lui a été adressé.';
header('location:suivi-pro-adm.php');
exit();
}