197 lines
8.8 KiB
PHP
197 lines
8.8 KiB
PHP
<?php
|
|
include('include/entete.php');
|
|
include('config/config.inc.php');
|
|
include('config/lib.inc.php');
|
|
|
|
|
|
|
|
if(isset($_POST['action']) && $_POST['action']=='rec_pro'){
|
|
$captcha = $_POST['g-recaptcha-response'];
|
|
if (verifCaptcha($captcha))
|
|
{
|
|
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
|
|
foreach($_POST as $cle=>$val){
|
|
echo $cle." => ".$val."<br />";
|
|
$$cle=$val;
|
|
}
|
|
|
|
if(isset($recevoirJeunes ) && $recevoirJeunes=='on') $recevoirJeunes =1;
|
|
else $recevoirJeunes=0;
|
|
if(isset($faireEquipe ) && $faireEquipe=='on') $faireEquipe =1;
|
|
else $faireEquipe=0;
|
|
if(isset($recevoirStage ) && $recevoirStage=='on') $recevoirStage =1;
|
|
else $recevoirStage=0;
|
|
|
|
|
|
$add=$adr1. " ". $ville." ".$cp;
|
|
$url_gmap = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode(utf8_encode($add)) . '&sensor=false&key=AIzaSyAD8dr4sS_iFafcU_AowzS9p9B306iQEZQ';
|
|
echo $url_gmap;
|
|
$json = json_decode(file_get_contents($url_gmap), true);
|
|
$coord = $json['results']['0']['geometry']['location'];
|
|
|
|
$query="insert into inscriptions_pro (recevoirJeunes,faireEquipe,recevoirStage,etablissement_pro,siret_pro,nom_pro,prenom_pro,adr1_pro,adr2_pro,cp_pro,ville_pro,mobile_pro,fixe_pro,email_pro,comment_pro,lat_pro,lon_pro,date_insert) values (:recevoirJeunes,:faireEquipe,:recevoirStage,:etablissement_pro,:siret_pro,:nom_pro,:prenom_pro,:adr1_pro,:adr2_pro,:cp_pro,:ville_pro,:mobile_pro,:fixe_pro,:email_pro,:comment_pro,:lat_pro,:lon_pro,:date_insert)";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
|
|
$queryRequest->bindParam( ':recevoirJeunes', $recevoirJeunes, PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':faireEquipe', $faireEquipe, PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':recevoirStage', $recevoirStage, PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':etablissement_pro', crypter($maCleDeCryptage,$etablissement ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':siret_pro', crypter($maCleDeCryptage,$siret ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':nom_pro', crypter($maCleDeCryptage,$nom ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':prenom_pro', crypter($maCleDeCryptage,$prenom ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':adr1_pro', crypter($maCleDeCryptage,$adr1 ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':adr2_pro', crypter($maCleDeCryptage,$adr2 ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':cp_pro', crypter($maCleDeCryptage,$cp ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':ville_pro', crypter($maCleDeCryptage,$ville ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mobile_pro', crypter($maCleDeCryptage,$mobile ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':fixe_pro', crypter($maCleDeCryptage,$fixe ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_pro', crypter($maCleDeCryptage,$email ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':comment_pro', crypter($maCleDeCryptage,$comment ), PDO::PARAM_STR );
|
|
|
|
$queryRequest->bindParam( ':lat_pro', $coord['lat'] , PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':lon_pro', $coord['lng'], PDO::PARAM_STR );
|
|
|
|
$queryRequest->bindParam( ':date_insert', date('Y-m-d'), PDO::PARAM_STR );
|
|
|
|
$queryRequest->execute();
|
|
|
|
|
|
$_SESSION['msg']='Votre inscription a bien été enregistrée.';
|
|
header('location:inscriptionPro.php');
|
|
exit();
|
|
} else {
|
|
$_SESSION['msg']='Erreur : reCAPTCHA non validé';
|
|
header('location:.');
|
|
exit();
|
|
}
|
|
}
|
|
|
|
if(isset($_POST['myAction']) && $_POST['myAction']=='proContact'){
|
|
|
|
$captcha = $_POST['g-recaptcha-response'];
|
|
if (verifCaptcha($captcha))
|
|
{
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
|
|
foreach($_POST as $cle=>$val){
|
|
echo $cle." => ".$val."<br />";
|
|
$$cle=$val;
|
|
}
|
|
if(isset($id_proP) && !empty($id_proP)){
|
|
$id_pro=$id_proP;
|
|
$type_pro="parent";
|
|
}
|
|
if(isset($id_proJ) && !empty($id_proJ)){
|
|
$id_pro=$id_proJ;
|
|
$type_pro="jeune";
|
|
}
|
|
|
|
$query="insert into contact_pro (nom_cp,prenom_cp,age_cp,classe_cp,email_cp,comment_cp,num_pro,type_pro,date_cp) values (:nom_cp,:prenom_cp,:age_cp,:classe_cp,:email_cp,:comment_cp,:num_pro,:type_pro,:date_cp)";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':nom_cp', crypter($maCleDeCryptage,$nom_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':prenom_cp', crypter($maCleDeCryptage,$prenom_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':age_cp', crypter($maCleDeCryptage,$age_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':classe_cp', crypter($maCleDeCryptage,$classe_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':email_cp', crypter($maCleDeCryptage,$email_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':comment_cp', crypter($maCleDeCryptage,$comment_pro ), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':num_pro', $id_pro, PDO::PARAM_INT );
|
|
$queryRequest->bindParam( ':type_pro', crypter($maCleDeCryptage,$type_pro), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':date_cp', date('Y-m-d'), PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
|
|
$query="select * from inscriptions_pro where id_pro=:id_pro";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':id_pro', $id_pro, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$data=$queryRequest->fetchAll();
|
|
$to=decrypter($maCleDeCryptage,$data[0]['email_pro']);
|
|
|
|
include('config/class.phpmailer.php');
|
|
include('config/phpmailer.settings.php');
|
|
|
|
|
|
$objet="Demande du 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"> </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">Un '.$type_pro.' souhaite venir vous rencontrer.<br /> Veuillez trouver ci-dessous les informations qu\'il a transmises sur le site www.deciday.fr.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Nom : </td><td>'.$nom_pro.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Prénom : </td><td>'.$prenom_pro.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Age : </td><td>'.$age_pro.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Classe : </td><td>'.$classe_pro.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">E-mail : </td><td>'.$email_pro.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right" valign="top">Commentaires : </td><td>'.nl2br($comment_pro).'</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>';
|
|
|
|
$destinataire3="deciday@fafih.com";
|
|
|
|
|
|
$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 ("campagnes@pointvirgule.net");
|
|
$mail->AddBCC ($destinataire3);
|
|
$mail->AltBody = "/-------//--------/";
|
|
$mail->send();
|
|
|
|
$_SESSION['msg']='Votre demande a bien été envoyée.';
|
|
header('location:index.php');
|
|
exit();
|
|
} else {
|
|
$_SESSION['msg']='Erreur : reCAPTCHA non validé';
|
|
header('location:contact-pro.php');
|
|
exit();
|
|
}
|
|
} |