File: /home/frenchy/refonte2023/wordpress/evenements/index.php
<?php
require_once("_mysql.php");
setlocale (LC_TIME, 'fr_FR.utf8','fra');
$id_evenement = '';
$blnFull = false;
if (isset($_GET['id_evenement']) || isset($_GET['id']))
{
if (isset($_GET['id_evenement']))
{
$id_evenement = $_GET['id_evenement'];
}
else
{
$id_evenement = $_GET['id'];
}
$req = mysqli_query($link_bdd, "select * from evenements where id_evenement = ".$id_evenement);
if (mysqli_num_rows($req) == 0)
{
die ("Aucun evenement ne correspond");
}
else
{
$line = mysqli_fetch_array($req);
if($line['nb_max_place'] != 0)
{
$reqContact = mysqli_query($link_bdd, "select count(*) nb from contacts where id_evenement = ".$id_evenement." and top_paiement in ('CHEQUE', 'PAYE PAYPAL', 'AUCUN')");
$lineContact = mysqli_fetch_array($reqContact);
if($lineContact['nb'] >= $line['nb_max_place'])
{
$blnFull = true;
}
}
}
}
else
{
die ("Aucun evenement ne correspond");
}
$req2 = mysqli_query($link_bdd, "select * from evenements where id_evenement = ".$id_evenement." and date_debut_evenement <= '".date("Y-m-d")."' and date_fin_evenement >= '".date("Y-m-d")."'");
$topTrouve = true;
if (mysqli_num_rows($req2) == 0)
{
$topTrouve = false;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html;charset=UTF-8" http-equiv="content-type"/>
<title>Evenement <?=$line['libelle_evenement']?></title>
<script type="text/javascript">
function verification()
{
if(document.frmSubmit.email_contact.value == "")
{
alert("Merci d'indiquer votre adresse e-mail");
document.frmSubmit.email_contact.focus();
return false;
}
if(document.frmSubmit.email_contact.value.indexOf('@') == -1)
{
alert("Adresse e-mail invalide");
document.frmSubmit.email_contact.focus();
return false;
}
if(document.frmSubmit.civilite_contact.value == "")
{
alert("Merci d'indiquer votre Civilité");
document.frmSubmit.civilite_contact.focus();
return false;
}
if(document.frmSubmit.prenom_contact.value == "")
{
alert("Merci d'indiquer votre Prénom");
document.frmSubmit.prenom_contact.focus();
return false;
}
if(document.frmSubmit.nom_contact.value == "")
{
alert("Merci d'indiquer votre Nom");
document.frmSubmit.nom_contact.focus();
return false;
}
if(document.frmSubmit.telephone_contact.value == "")
{
alert("Merci d'indiquer votre Téléphone");
document.frmSubmit.telephone_contact.focus();
return false;
}
/*if(document.frmSubmit.entreprise_contact.value == "")
{
alert("Merci d'indiquer votre Entreprise");
document.frmSubmit.entreprise_contact.focus();
return false;
}*/
if(document.frmSubmit.fonction_contact.value == "" && !document.frmSubmit.autre_contact.checked)
{
alert("Merci d'indiquer votre fonction dans l'entreprise");
document.frmSubmit.fonction_contact.focus();
return false;
}
if(document.frmSubmit.adresse_entreprise_contact.value == "")
{
alert("Merci d'indiquer l'adresse de votre entreprise");
document.frmSubmit.adresse_entreprise_contact.focus();
return false;
}
if(document.frmSubmit.code_postal_entreprise_contact.value == "")
{
alert("Merci d'indiquer le code postal de votre entreprise");
document.frmSubmit.code_postal_entreprise_contact.focus();
return false;
}
if(document.frmSubmit.ville_entreprise_contact.value == "")
{
alert("Merci d'indiquer la ville de votre entreprise");
document.frmSubmit.ville_entreprise_contact.focus();
return false;
}
return true
}
</script>
<style type="text/css">
/* General styles */
body { margin: 0; padding: 0; font: 80%/1.5 Arial,Helvetica,sans-serif; color: #111; background-color: #FFF; }
a:hover{
color:#0172b6;
}
a{
color:#0172b6;
}
a:visited{
color:#0172b6;
}
h2 { margin: 0px; padding: 10px; font-family: Georgia, "Times New Roman", Times, serif; font-size: 200%; font-weight: normal; color: #FFF; background-color: #CCC; border-bottom: #BBB 2px solid; }
/* Form styles */
div.form-container {margin: auto; padding: 5px;}
p.legend { margin-bottom: 1em; }
p.legend em { color: #C00; font-style: normal; }
div.form-container form p { margin: 0; }
div.form-container form p.note { margin-left: 170px; font-size: 90%; color: #333; }
div.form-container form fieldset { margin: 10px 0; padding: 10px; border: #DDD 1px solid; }
div.form-container form legend { font-weight: bold; color: #000000; }
div.form-container form fieldset div { padding: 0.25em 0; }
div.form-container label,
div.form-container span.label { margin-right: 10px; padding-right: 10px; width: 150px; display: block; float: left; text-align: right; position: relative; }
div.form-container label em,
div.form-container span.label em { position: absolute; right: 0; font-size: 120%; font-style: normal; color: #C00; }
div.form-container input:focus,
div.form-container textarea:focus { background-color: #FFC; border-color: #FC6; }
div.form-container div.controlset label,
div.form-container div.controlset input { display: inline; float: none; }
div.form-container div.controlset div { margin-left: 170px; }
div.form-container div.buttonrow { margin: 4px;; text-align:center;}
#divAdhesion { margin: auto; text-align:center; border-width:2px; border-style:solid; border-color:#000000;}
#messageNonMembre { text-align:center; font-size: 12px; font-weight: bold;color:#FF0000;}
#libelleMembre { font-size: 12px; font-weight: bold;}
#checkboxMembre { font-size: 14px; font-weight: bold;}
#prix { font-size: 16px; font-weight: bold;}
#radio_proposer_cotisation { font-size: 14px; font-weight: bold;}
#cotisation { font-size: 16px; font-weight: bold;}
#total { font-size: 16px; font-weight: bold;}
</style>
</head>
<body>
<div id="header" style="border: 1px solid #8a959b; width: 752px; margin: auto;">
<table width="100%" cellspacing="0" cellpaddin="0">
<tr>
<td width="50%">
<img src="/evenements/images/logo_faf.jpg" alt="logo FAF" style="float: left; margin: 30px;" width="300">
</td>
<td width="50%">
<p style="font-size: 24px;font-weight:bold; color:#0172b6; text-align:right; margin: 30px;">Inscription</p>
</td>
</tr>
<tr>
<td colspan="2" style="background-color:#0172b6; width: 100%;">
<div style="text-align: center; color:#ffffff; font-size: 20px;"><b><?=(html_entity_decode($line['libelle_evenement']))?></b></div>
<?php
if ($line['descriptif_evenement'] != '')
{
?>
<div style="text-align: center; color:#ffffff; font-size: 14px;"><b><?=nl2br($line['descriptif_evenement'])?></b></div>
<?php
}
?>
<div style="text-align: center; color:#ffffff; font-size: 18px;"><b><?=strftime("%A %d %B %Y", strtotime($line['date_evenement']))?></b></div>
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<?php
if($blnFull == true)
{
?>
<p style="text-align:center;color:red;font-weight:bold;"><br /><br />« Aucune place disponible pour l'évènement <?=$line['libelle_evenement']?> - <?=strftime("%A %d %B %Y", strtotime($line['date_evenement']))?>. »<br /><br /></p>
<?php
}
else if ($topTrouve == true)
{
?>
<div class="form-container">
<form action="/evenements/paiement.php" method="post" name="frmSubmit" onSubmit="return verification()">
<input type="hidden" name="id_evenement" value="<?=$id_evenement?>">
<fieldset>
<legend>Contact</legend>
<table width="100%">
<tr>
<td>
<div><label for="email_contact">Email <em>*</em></label> <input id="email_contact" title="Votre email" name="email_contact" style="width:200px;" type="text"><input id="email" name="email" type="hidden" value="" /></div>
</td>
</tr>
<tr>
<td>
<div><label for="civilite_contact">Civilité <em>*</em></label> <select name="civilite_contact" title="Votre civilité" id="civilite_contact"><option value="Madame">Madame</option><option value="Monsieur">Monsieur</option></select></div>
</td>
</tr>
<tr>
<td>
<div><label for="prenom_contact">Prénom <em>*</em></label> <input id="prenom_contact" title="Votre prénom" name="prenom_contact" style="width:200px;" type="text"></div>
</td>
</tr>
<tr>
<td>
<div><label for="nom_contact">Nom <em>*</em></label> <input id="particule_contact" title="La particule de votre nom" style="display:none;visibility:hidden;" name="particule_contact" style="width:30px;" type="text"><input id="nom_contact" name="nom_contact" title="votre nom" style="width:200px;" type="text"></div>
</td>
</tr>
<tr>
<td>
<div><label for="telephone_contact">Téléphone portable <em>*</em></label> <input id="telephone_contact" title="Votre téléphone portable" style="width:200px;" name="telephone_contact" type="text"></div>
</td>
</tr>
<tr style="display:none;visibility:hidden;">
<td>
<div><label for="portable_contact">Téléphone portable</label> <input id="portable_contact" title="Votre téléphone portable" style="width:200px;" name="portable_contact" type="text"></div>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend></legend>
<table width="100%">
<tr>
<td>
<div><label for="entreprise_contact">Entreprise</label> <input id="entreprise_contact" title="Votre entreprise" name="entreprise_contact" style="width:200px;" type="text"> Autre<input type="checkbox" id="autre_contact" name="autre_contact" onclick="if (this.checked == false) { document.getElementById('obligatoire').innerHTML='*'; } else { document.getElementById('obligatoire').innerHTML=''; }" /></div>
</td>
</tr>
<tr>
<td>
<div><label for="fonction_contact">Fonction <em><span id="obligatoire">*</span></em></label> <input id="fonction_contact" title="Fonction dans l'entreprise" name="fonction_contact" style="width:200px;" type="text"></div>
</td>
</tr>
<tr>
<td>
<div><label for="adresse_entreprise_contact">Adresse <em>*</em></label> <input id="adresse_entreprise_contact" title="Adresse de votre entreprise" name="adresse_entreprise_contact" style="width:200px;" type="text"></div>
</td>
</tr>
<tr>
<td>
<div><label for="code_postal_entreprise_contact">Code Postal <em>*</em></label> <input id="code_postal_entreprise_contact" title="Code postal de votre entreprise" name="code_postal_entreprise_contact" style="width:200px;" type="text"></div>
</td>
</tr>
<tr>
<td>
<div><label for="ville_entreprise_contact">Ville <em>*</em></label> <input id="ville_entreprise_contact" title="Ville de votre entreprise" name="ville_entreprise_contact" style="width:200px;" type="text"></div>
</td>
</tr>
</table>
</fieldset>
<table width="100%">
<tr>
<td colspan="3">
<?php
if ($line['proposition_cotisation'] == 'oui')
{
$reqCotisation = mysqli_query($link_bdd, "select * from inscriptions where lower(libelle_inscription) like ('%membre actif%')");
if (mysqli_num_rows($reqCotisation) > 0 && $reqCotisation)
{
$lineCotisation = mysqli_fetch_assoc($reqCotisation);
}
}
if ($line['ligne_info'] !='')
{
echo '<div id="messageNonMembre">'.$line['ligne_info'].'</div>';
}
?>
</td>
</tr>
<tr>
<td align="left" width="26%">
<div id="prix">
<?php
if ($line['prix_non_membre'] != 0 || $line['prix_membre'] !=0)
{
if ($line['proposition_cotisation'] == 'oui')
{
echo '<span style="float:left;display:block;width:115px;">TARIF : </span><span style="color:#0172b6;">'.number_format($line['prix_non_membre'],2,".", " ").' €</span>';
}
else
{
echo '<span style="float:left;display:block;width:115px;">TARIF : </span><span style="color:#0172b6;">'.number_format($line['prix_non_membre'],2,".", " ").' €</span>';
}
}
else
{
echo '<span style="float:left;display:block;width:115px;">TARIF : </span><span style="color:#0172b6;">GRATUIT</span>';
}
?>
</div>
</td>
<td align="left" width="24%">
<?php
if ($line['top_membres'] == 'DISTINCTION MEMBRES / NON MEMBRES')
{
?>
<div id="checkboxMembre"><center>Etes-vous membre ? <em>*</em></center></div>
<?php
}
?>
</td>
<td align="left" width="50%">
<?php
if ($line['top_membres'] == 'DISTINCTION MEMBRES / NON MEMBRES')
{
?>
<?php
if ($line['proposition_cotisation'] == 'oui')
{
?>
<div id="checkboxMembre" style="float:left;margin-left:20px;">OUI<INPUT type=radio name="membre_contact" value="O" onclick="document.frmSubmit.proposer_cotisation.checked = false; document.getElementById('ligne_proposer_cotisation').style.display='none'; document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>';" /></div>
<div id="checkboxMembre" style="float:left;margin-left:20px;">NON<INPUT type=radio name="membre_contact" checked value="N" onclick="document.frmSubmit.proposer_cotisation.checked = false; document.getElementById('ligne_proposer_cotisation').style.display=''; document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_non_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_non_membre'],2,".", " ").' €'; } else { echo "GRATUIT"; }?></span>'; document.getElementById('cotisation').innerHTML='<span style=\'float:left;display:block;width:115px;\'>COTISATION : </span><span style=\'color:#0172b6;\'><?php echo number_format(0,2,".", " ").' €';?></span>';" /></div>
<?php
}
else
{
?>
<div id="checkboxMembre" style="float:left;margin-left:20px;">OUI<INPUT type=radio name="membre_contact" value="O" onclick="document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>';" /></div>
<div id="checkboxMembre" style="float:left;margin-left:20px;">NON<INPUT type=radio name="membre_contact" checked value="N" onclick="document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_non_membre'] !=0) { echo number_format($line['prix_non_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_non_membre'] !=0) { echo number_format($line['prix_non_membre'],2,".", " ").' €'; } else { echo 'GRATUIT'; }?></span>';" /></div>
<?php
}
?>
<?php
}
else
{
?>
<?php
}
?>
</td>
</tr>
<?php
if ($line['proposition_cotisation'] == 'oui')
{
?>
<tr id="ligne_proposer_cotisation">
<td>
<div id="cotisation">
<?php
echo '<span style="float:left;display:block;width:115px;">COTISATION : </span><span style="color:#0172b6;">'.number_format(0,2,"."," ").' €</span>';
?>
</div>
</td>
<td colspan="2">
<div id="radio_proposer_cotisation" style="float:left;margin-left:5px;"><INPUT type=checkbox name="proposer_cotisation" id="proposer_cotisation" value="<?=$lineCotisation['montant_inscription']?>" onclick="if (document.frmSubmit.proposer_cotisation.checked== true) { document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_non_membre'] !=0) { echo $line['prix_membre'].' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('cotisation').innerHTML='<span style=\'float:left;display:block;width:115px;\'>COTISATION : </span><span style=\'color:#0172b6;\'><?php echo number_format($lineCotisation['montant_inscription'],2,"."," ").' €'; ?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_membre'] !=0) { echo number_format($line['prix_membre'] + $lineCotisation['montant_inscription'],2,"."," ").' €'; } else { echo number_format($lineCotisation['montant_inscription'],2,"."," ").' €'; }?></span>'; } else { document.getElementById('cotisation').innerHTML='<span style=\'float:left;display:block;width:115px;\'>COTISATION : </span><span style=\'color:#0172b6;\'><?php echo '0.00 €'; ?></span>'; document.getElementById('total').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TOTAL : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_non_membre'] !=0) { echo $line['prix_non_membre'].' €'; } else { echo 'GRATUIT'; }?></span>'; document.getElementById('prix').innerHTML='<span style=\'float:left;display:block;width:115px;\'>TARIF : </span><span style=\'color:#0172b6;\'><?php if ($line['prix_non_membre'] !=0) { echo $line['prix_non_membre'].' €'; } else { echo 'GRATUIT'; }?></span>'; }" /> Je souhaite régler ma cotisation tout de suite</div>
</td>
</tr>
<?php
}
?>
<tr>
<td>
<div id="total">
<?php
if ($line['prix_non_membre'] != 0 || $line['prix_membre'] !=0)
{
if ($line['proposition_cotisation'] == 'oui')
{
echo '<span style="float:left;display:block;width:115px;">TOTAL : </span><span style="color:#0172b6;">'.number_format($line['prix_non_membre'],2,"."," ").' €</span>';
}
else
{
echo '<span style="float:left;display:block;width:115px;">TOTAL : </span><span style="color:#0172b6;">'.number_format($line['prix_non_membre'],2,"."," ").' €</span>';
}
}
else
{
echo '<span style="float:left;display:block;width:115px;">TOTAL : </span><span style="color:#0172b6;">GRATUIT</span>';
}
?>
</div>
</td>
<td colspan="3">
<?php
if ($line['ligne_tableau'] !='')
{
echo '<div id="divAdhesion">'.utf8_encode(html_entity_decode($line['ligne_tableau'])).'</div>';
}
?>
</td>
</tr>
<tr>
<td align="left" width="20%" colspan="3">
<div id="prix">
<?php
if ($line['mode_paiement'] == 'CHEQUE+PAYPAL')
{
echo '<table width="70%">';
echo '<tr>';
echo '<td width="40%">';
echo 'Mode de règlement';
echo '</td>';
echo '<td">';
echo " ";
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo 'Paiement en ligne';
echo '</td>';
echo '<td>';
echo '<INPUT type=radio name="type_paiement" checked onclick="document.getElementById(\'messageCheque\').style.display=\'none\';" value="PAYPAL" /><br />';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo 'Chèque';
echo '</td>';
echo '<td>';
echo '<INPUT type=radio name="type_paiement" onclick="document.getElementById(\'messageCheque\').style.display=\'block\';" value="CHEQUE" />';
echo '</td>';
echo '</tr>';
echo '</table>';
}
else
{
echo '<INPUT type=hidden name="type_paiement" value="'.$line['mode_paiement'].'" />';
}
?>
</div>
</td>
</tr>
<?php
if ($line['mode_paiement'] == 'CHEQUE')
{
?>
<tr>
<td align="left" width="20%" colspan="3">
<div id="messageCheque" style="display:block;">
« Les chèques bancaires sont à libeller à l’ordre de la <strong>French-American Foundation – France</strong>, 18 bis boulevard Arago, 75013 Paris. »
</div>
</td>
</tr>
<?php
}
?>
<?php
if ($line['mode_paiement'] == 'CHEQUE+PAYPAL')
{
?>
<tr>
<td align="left" width="20%" colspan="3">
<div id="messageCheque" style="display:none;">
« Les chèques bancaires sont à libeller à l’ordre de la <strong>French-American Foundation – France</strong>, 18 bis boulevard Arago, 75013 Paris. »
</div>
</td>
</tr>
<?php
}
?>
</table>
<div class="buttonrow">
<input value="Valider Votre Inscription" style="height: 30px; width: 170px;" name="envoiForm" type="submit">
</div>
</form>
</div>
<?php
}
else
{
?>
<p style="text-align:center;color:red;font-weight:bold;"><br /><br />« Les inscriptions pour l'évènement <?=$line['libelle_evenement']?> - <?=strftime("%A %d %B %Y", strtotime($line['date_evenement']))?> sont désormais closes. »<br /><br /></p>
<?php
}
?>
</td>
</tr>
</table>
</div>
</body>
</html>