Files

163 lines
6.4 KiB
PHP
Executable File

<?
$titre="Création des poules";include("enTete.php");echo"<body background='images/balle_raquette3.jpg'> ";
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);
//$id_tournoi=$_GET['id_tournoi'];
//echo $id_tournoi;
$id_categorie=$_GET['id_categorie'];
$Debut_tab=$_GET['Debut_tab'];
if ($Debut_tab=='') {
$Debut_tab=18;
}
$Fin_tab=$_GET['Fin_tab'];
if ($Fin_tab=='') {
$Fin_tab=0;
}
$requete="SELECT id_categorie,ref_cat FROM categorie WHERE tournoi='$id_tournoi' order by ref_cat ";
$reponses=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
$nbre=0;
echo"<table border><tr>";
while($rep=mysql_fetch_object($reponses))
{
if($nbre==3){echo "</tr><tr>";$nbre=0;}
echo "<td align='top'>";
$nbre++;
$cat=$rep->ref_cat;
$cat=nom_categorie1($cat);
echo"<table border><tr><td colspan='4' width='200' height='30' bgcolor='#FFD700'><font size=1>";
echo $cat;
echo "</td></tr>";
$nb_inscrit_cat='0';
$i=$Debut_tab;
for ($i;$i>=$Fin_tab;$i=$i-1){
$nb_inscrit[$i]=0;
$nb_inscrit_par_cat[$i]=0;
$indic[$i]=1;
}
$requete2="SELECT joueur FROM inscription WHERE categorie='$rep->id_categorie' AND valider='1'";
$reponse2=mysql_query($requete2,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
while ($inscription=mysql_fetch_object($reponse2)){
$requete3="SELECT classement,nom,prenom FROM joueur WHERE id_joueur='$inscription->joueur'";
$reponse3=mysql_query($requete3,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
$joueur1=mysql_fetch_object($reponse3);
$classement=$joueur1->classement;
$nb_inscrit[$classement]=$nb_inscrit[$classement]+1;
$num=$nb_inscrit[$classement];
$nom_joueur1=strtoupper($joueur1->nom);
$nom_joueur1=$nom_joueur1." $joueur1->prenom";
$c=classement($joueur1->classement);
$nom_joueur1=$nom_joueur1." $c";
//echo $num,$classement;
$nom_joueur[$num][$classement]=$nom_joueur1;
//echo $nom_joueur['2']['18'];
$nb_inscrit_cat=$nb_inscrit_cat+1;
}
echo"<form action='entrer_tableau_match_suite.php' method='GET'>";
echo "<tr><td colspan='4'>";
echo"</td></tr>";
echo"<tr BGCOLOR='#FFDEAD'><td colspan='4'><font size=1>Nb de joueurs : <b>$nb_inscrit_cat</b></td></tr>";
$i=$Debut_tab;
$k=$nb_inscrit_cat;
$entrant=$Qe;
for ($i;$i>=$Fin_tab;$i=$i-1){
$nb_joueur=$_GET['nb_joueur'.$i];
$requete="SELECT nb_categorie_aux FROM tableau WHERE id_categorie='$rep->id_categorie' AND classement='$i'";
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
$nb_categorie_aux=mysql_fetch_object($reponse);
$exist = mysql_numrows($reponse);
$niveau=classement($i);
//echo $exist;
if ($nb_inscrit[$i]!='0') {
echo "<tr BGCOLOR='#FFEFD5'><td>$niveau</td><td><b>".$nb_inscrit[$i]."</b></td></tr>";
}
$requete="SELECT nb_categorie_site,nb_categorie_aux FROM tableau WHERE id_categorie='$rep->id_categorie' AND classement='$i'";
//echo $requete;
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
$nb=mysql_fetch_object($reponse);
$nb=$nb->nb_categorie_aux+$nb->nb_categorie_site;
//echo $nb;
while($nb!=0){
$nb=$nb-1;
//echo "test$i";
//echo $k;
$classement_joueur[$k]=$i;
$k=$k-1;
}
}
//echo "<tr><td>test</td></tr>";
echo"</table></td>";
}
echo "</table>";
function nom_categorie1($ref_cat){
if($ref_cat=='1') {$categorie="Adulte homme seniors";}
else if($ref_cat=='2') {$categorie="Adulte homme +35 ans";}
else if($ref_cat=='3') {$categorie="Adulte homme +40 ans";}
else if($ref_cat=='4') {$categorie="Adulte homme +45 ans";}
else if($ref_cat=='5') {$categorie="Adulte homme +50 ans";}
else if($ref_cat=='6') {$categorie="Adulte homme +55 ans";}
else if($ref_cat=='7') {$categorie="Adulte homme +60 ans";}
else if($ref_cat=='8') {$categorie="Adulte femme seniors";}
else if($ref_cat=='9') {$categorie="Adulte femme +35 ans";}
else if($ref_cat=='10') {$categorie="Adulte femme +40 ans";}
else if($ref_cat=='11') {$categorie="Adulte femme +45 ans";}
else if($ref_cat=='12') {$categorie="Adulte femme +50 ans";}
else if($ref_cat=='13') {$categorie="Adulte femme +55 ans";}
else if($ref_cat=='14') {$categorie="Adulte femme +60 ans";}
else if($ref_cat=='15') {$categorie="Jeune homme -8ans";}
else if($ref_cat=='16') {$categorie="Jeune homme -10ans";}
else if($ref_cat=='17') {$categorie="Jeune homme -12ans";}
else if($ref_cat=='18') {$categorie="Jeune homme -14ans";}
else if($ref_cat=='19') {$categorie="Jeune homme -16ans";}
else if($ref_cat=='20') {$categorie="Jeune homme -18ans";}
else if($ref_cat=='21') {$categorie="Jeune femme -8ans";}
else if($ref_cat=='22') {$categorie="Jeune femme -10ans";}
else if($ref_cat=='23') {$categorie="Jeune femme -12ans";}
else if($ref_cat=='24') {$categorie="Jeune femme -14ans";}
else if($ref_cat=='25') {$categorie="Jeune femme -16ans";}
else if($ref_cat=='26') {$categorie="Jeune femme -18ans";}
else if($ref_cat=='27') {$categorie="Double homme";}
else if($ref_cat=='28') {$categorie="Double femme";}
else if($ref_cat=='29') {$categorie="Double mixte";}
$categorie="Catégorie : ".$categorie;
return $categorie;
}
function classement($classement){
if($classement=='1') {$nom_classement="1/6";}
else if($classement=='2') {$nom_classement="2/6";}
else if($classement=='3') {$nom_classement="3/6";}
else if($classement=='4') {$nom_classement="4/6";}
else if($classement=='5') {$nom_classement="5/6";}
else if($classement=='6') {$nom_classement="15";}
else if($classement=='7') {$nom_classement="15/1";}
else if($classement=='8') {$nom_classement="15/2";}
else if($classement=='9') {$nom_classement="15/3";}
else if($classement=='10') {$nom_classement="15/4";}
else if($classement=='11') {$nom_classement="15/5";}
else if($classement=='12') {$nom_classement="30";}
else if($classement=='13') {$nom_classement="30/1";}
else if($classement=='14') {$nom_classement="30/2";}
else if($classement=='15') {$nom_classement="30/3";}
else if($classement=='16') {$nom_classement="30/4";}
else if($classement=='17') {$nom_classement="30/5";}
else if($classement=='18') {$nom_classement="NC";}
else if($classement=='19') {$nom_classement="Q";}
else if($classement=='0') {$nom_classement="mieux";}
return $nom_classement;
}
include("piedDePage.php");
?>