330 lines
11 KiB
PHP
Executable File
330 lines
11 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
/* test si une session joueur est lancée */
|
|
if((isset($_SESSION['Id_joueur'])==true) && ($_SESSION['Id_joueur']!=0))
|
|
{
|
|
$id_tournoi=$_GET['id_tournoi'];
|
|
echo"<body background='images/balle_raquette3.jpg'>";
|
|
$id_joueur=$_SESSION['Id_joueur'];
|
|
include("top.php");
|
|
$ok=1; /* indique si le joueur peut jouer au tournoi (notion de tournoi interne) */
|
|
$annee_en_cours = date("Y") ;
|
|
$titre="Inscription à un tournoi";
|
|
include("enTete.php");
|
|
|
|
include("conf.php");
|
|
include("mysql_compat.php");
|
|
include("conf.php");
|
|
$db_connection=mysql_connect($db_host,$db_user,$password);
|
|
mysql_select_db($db_name,$db_connection);
|
|
$requete="SELECT annee,sexe FROM joueur WHERE id_joueur='$id_joueur';";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$joueur=mysql_fetch_object($reponse);
|
|
$annee=$joueur->annee;
|
|
$sexe=$joueur->sexe;
|
|
|
|
/***************************************************************/
|
|
/***************** TEST SI TOURNOI INTERNE *********************/
|
|
$requete="SELECT id_club, interne, prix_2tableaux, prix_jeune_senior FROM tournoi WHERE id_tournoi='$id_tournoi'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$tournoi=mysql_fetch_object($reponse);
|
|
|
|
|
|
$requete="SELECT statut FROM compte WHERE id_club='$club->id_club' AND id_joueur='$id_joueur'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$compte=mysql_fetch_object($reponse);
|
|
|
|
if($tournoi->interne=='oui') {
|
|
if(utf8_encode("MembreLicencié")==$compte->statut) {
|
|
$ok=1;
|
|
}
|
|
else {
|
|
$ok=0;
|
|
}
|
|
}
|
|
/***************************************************************/
|
|
|
|
/* Affichage des categories possibles et des tarifs */
|
|
if($ok==1) {
|
|
$requete="SELECT id_categorie, prix FROM categories_par_tournoi WHERE categories_par_tournoi.id_tournoi=$id_tournoi";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
echo"<center><H4>Inscription possible dans les catégories suivantes :</H4><table border bgcolor='#FFFFFF'><tr><td>Catégories</td>";
|
|
$prix_senior=0;
|
|
$prix_jeune=0;
|
|
$prix_js=$tournoi->prix_jeune_senior;
|
|
$prix_2tab=$tournoi->prix_2tableaux;
|
|
$prix_double=0;
|
|
while($categorie=mysql_fetch_object($reponse))
|
|
{
|
|
if ($categorie->id_categorie ==1)
|
|
{
|
|
$Categorie='Adulte homme seniors';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==2)
|
|
{
|
|
$Categorie='Adulte femme seniors';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==3)
|
|
{
|
|
$Categorie='jeune homme -12ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==4)
|
|
{
|
|
$Categorie='jeune femme -12ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==5)
|
|
{
|
|
$Categorie='jeune homme -14ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==6)
|
|
{
|
|
$Categorie='jeune femme -14ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==7)
|
|
{
|
|
$Categorie='Adulte homme +35ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==8)
|
|
{
|
|
$Categorie='Adulte femme +35ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==9)
|
|
{
|
|
$Categorie='Adulte homme +40 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==10)
|
|
{
|
|
$Categorie='Adulte femme +40 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==11)
|
|
{
|
|
$Categorie='Adulte homme +45ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==12)
|
|
{
|
|
$Categorie='Adulte femme +45 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==13)
|
|
{
|
|
$Categorie='Adulte homme +50 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==14)
|
|
{
|
|
$Categorie='Adulte femme +50 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==15)
|
|
{
|
|
$Categorie='Adulte homme +55 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==16)
|
|
{
|
|
$Categorie='Adulte femme +55 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==17)
|
|
{
|
|
$Categorie='Adulte homme +60 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==18)
|
|
{
|
|
$Categorie='Adulte femme +60 ans';
|
|
$prix_senior=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==19)
|
|
{
|
|
$Categorie='Jeune homme -8ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==20)
|
|
{
|
|
$Categorie='Jeune femme -8ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==21)
|
|
{
|
|
$Categorie='Jeune homme -10ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==22)
|
|
{
|
|
$Categorie='Jeune femme -10ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==23)
|
|
{
|
|
$Categorie='Jeune homme -16ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==24)
|
|
{
|
|
$Categorie='Jeune femme -16ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==25)
|
|
{
|
|
$Categorie='Jeune homme -18ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==26)
|
|
{
|
|
$Categorie='Jeune femme -18ans';
|
|
$prix_jeune=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==27)
|
|
{
|
|
$Categorie='Double homme';
|
|
$prix_double=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==28)
|
|
{
|
|
$Categorie='Double femme';
|
|
$prix_double=$categorie->prix;
|
|
}
|
|
if ($categorie->id_categorie ==29)
|
|
{
|
|
$Categorie='Double mixte';
|
|
$prix_double=$categorie->prix;
|
|
}
|
|
|
|
echo"<tr><td><ul><img src='images/tenball2.gif' />$Categorie</ul></td>";
|
|
}
|
|
|
|
echo"</tr></table></center>";
|
|
echo "<br /><br />";
|
|
?>
|
|
<table border="1" align="center" width="50 %" bgcolor='#FFFFFF'>
|
|
<th>Prix jeune</th><th>Prix jeune sénior</th><th>Prix sénior</th><th>Prix doubles</th><th>Prix pour 2 tableaux</th>
|
|
<tr>
|
|
<?php
|
|
echo"<td align='center'>$prix_jeune €</td><td align='center'>$prix_js €</td>";
|
|
echo"<td align='center'>$prix_senior €</td>";
|
|
echo"<td align='center'>$prix_double €</td><td align='center'>$tournoi->prix_2tableaux €</td>";
|
|
?>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
$age=date('Y')-$annee;
|
|
$requete="SELECT c.id_categorie, c.nom, c.type, c.sexe, c.age_min, c.age_max FROM categorie c, categories_par_tournoi ct WHERE ct.id_tournoi='$id_tournoi' AND ct.id_categorie=c.id_categorie AND (c.sexe='$sexe' OR c.sexe='mixte')";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$nb=mysql_num_rows($reponse);
|
|
if($nb > 0) {
|
|
|
|
echo"<form action='inscription_tournoi.php' method='post'>";
|
|
echo "<p><center><table width=60%>";
|
|
|
|
echo "<tr><td>Dans quelle categorie souhaitez vous vous inscrire ?</td>";
|
|
|
|
/* Affichage des categories */
|
|
|
|
echo "<td>";
|
|
echo "<select name='categorie'>";
|
|
$senior=0;
|
|
while ($reptab=mysql_fetch_object($reponse)){
|
|
/* Jeunes */
|
|
if($age<18) {
|
|
if($reptab->age_min>=0 and $reptab->age_max<=18 and $reptab->age_max!=0) {
|
|
echo "<option value='$reptab->id_categorie'>$reptab->nom</option>";
|
|
}
|
|
if($sexe == 'f' and $senior==0 and $age >= 15) {
|
|
echo "<option value='2'>Adulte femme sénior</option>";
|
|
$senior=1;
|
|
}
|
|
else if($sexe == 'm' and $senior==0 and $age >= 15) {
|
|
echo "<option value='1'>Adulte homme sénior</option>";
|
|
$senior=1;
|
|
}
|
|
}
|
|
/* Adultes */
|
|
else {
|
|
if($reptab->age_min>=15 and $reptab->age_min<=$age)
|
|
echo "<option value='$reptab->id_categorie'>$reptab->nom</option>";
|
|
}
|
|
}
|
|
/* Doubles Mixtes*/
|
|
$requete="SELECT id_categorie FROM categories_par_tournoi WHERE id_tournoi='$id_tournoi' AND id_categorie='29'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$double_mixte=mysql_num_rows($reponse);
|
|
if($double_mixte>0) {
|
|
echo "<option value='29'>Double Mixte</option>";
|
|
}
|
|
/* Doubles dames*/
|
|
$requete="SELECT id_categorie FROM categories_par_tournoi WHERE id_tournoi='$id_tournoi' AND id_categorie='28'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$doubles_dames=mysql_num_rows($reponse);
|
|
if($double_dames>0 and $sexe=='f') {
|
|
echo "<option value='28'>Double Dames</option>";
|
|
}
|
|
/* Doubles Messieurs*/
|
|
$requete="SELECT id_categorie FROM categories_par_tournoi WHERE id_tournoi='$id_tournoi' AND id_categorie='27'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$double_mr=mysql_num_rows($reponse);
|
|
if($double_mr>0 and $sexe=='m') {
|
|
echo "<option value='27'>Double Messieurs</option>";
|
|
}
|
|
echo "</select></tr>";
|
|
echo "<input type=hidden name='id_tournoi' value='$id_tournoi'>";
|
|
/* Telephone portable si dispo sinon un autre */
|
|
$requete="SELECT numero FROM telephone WHERE id_joueur='$id_joueur' AND type='portable'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$existe=mysql_num_rows($reponse);
|
|
if($existe == 0) {
|
|
$requete="SELECT numero FROM telephone WHERE id_joueur='$id_joueur' AND type<>'portable'";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
}
|
|
$telephone=mysql_fetch_object($reponse);
|
|
echo "<input type=hidden name='telephone' value='$telephone->numero'>";
|
|
echo "<tr>";
|
|
echo "<td>Travaillez-vous durant le tournoi ?</td>";
|
|
echo "<td><select name='travaille'><option value='oui'>Oui<option value='non'>Non<option value='nsp'>Ne se prononce pas</select></td>";
|
|
echo "</tr>";
|
|
echo "<tr>";
|
|
echo "<td>Commentaires : </td>";
|
|
echo "<td><textarea name='comm' rows='3' cols='40'></textarea></td>";
|
|
echo "</tr>";
|
|
echo "<tr>";
|
|
echo "<td><input type='submit' value='Valider'><input type=reset value='Annuler'></td>";
|
|
echo "</tr>";
|
|
echo "</table>";
|
|
echo "</form>";
|
|
|
|
}
|
|
else {
|
|
echo "<br /><br />";
|
|
echo "<center><font size='3'><b>Vous ne pouvez pas vous inscrire à ce tournoi.<br />Aucune catégorie d'inscription disponible par rapport à votre age et votre sexe.</b></font>";
|
|
}
|
|
mysql_close($db_connection);
|
|
echo "<br /><br />";
|
|
echo "<a href='inscrire_tournoi.php'>Retour à la liste</a></center>";
|
|
include("piedDePage.php");
|
|
/* sinon si la personne n'est pas autorisé la renvoyer àla page de login */
|
|
}
|
|
else {
|
|
echo "<p>Le tournoi selectionné est un tournoi interne au club. Vous ne pouvez donc pas y jouer. Désolé.</p>";
|
|
|
|
echo "<a href='inscrire_tournoi.php'>Retour à la liste</a></center>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo("Non autorisé - Redirection vers la page d'identification dans 2 secondes");
|
|
sleep(2);
|
|
include("connexion.php");
|
|
}
|
|
?>
|