114 lines
6.0 KiB
PHP
Executable File
114 lines
6.0 KiB
PHP
Executable File
<?php
|
|
$titre="Resultats de matchs";include("enTete.php");
|
|
echo "<center><table><tr><th align=center><h2><u>Liste des matchs qui dont on connait les joueurs mais pas le resultat.</u></h2></th><tr></table></center><p>";
|
|
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);
|
|
//////////////////////////////////////////////////RECHERCHE INFO SUR LA CATEGORIE////////////////////////////////////
|
|
$requete="SELECT avencement, type FROM `categorie` WHERE id_categorie = '$categorie' ;";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$reptab=mysql_fetch_array($reponse);
|
|
$avencement=$[''];
|
|
if ($['']=='double' or $['']=='mixte') $double=1; else $double=0;
|
|
//////////////////////////////////////////RECHERCHE DES MATCH DE LA CATEGORIE QUI N'ONT PAS DE GAGNANT///////////////
|
|
$requete="SELECT avencement, tour FROM `match` WHERE categorie = '$categorie' AND avencement >= '$avencement' AND vainqueur IS NULL GROUP BY avencement, tour ORDER BY avencement DESC, tour ASC;";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$i=0;
|
|
while($reptab=mysql_fetch_array($reponse)){
|
|
$list_tour[$i][tour]=$[''];
|
|
$list_tour[$i][avencement]=$[''];
|
|
$i++;
|
|
}
|
|
$tab_classement=array("0 ou mieux","1/6","2/6","3/6","4/6","5/6","15","15/1","15/2","15/3","15/4","15/5","30","30/1","30/2","30/3","30/4","30/5","NC");
|
|
for($i=0;$i<count($list_tour);$i++){
|
|
$requete="SELECT * FROM `match` WHERE categorie='".$categorie."' AND avencement = '".$list_tour[$i][avencement]."' AND tour='".$list_tour[$i][tour]."' AND vainqueur IS NULL ORDER BY avencement DESC, tour ASC;";
|
|
$reponse=mysql_query($requete,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
while ($reptab=mysql_fetch_array($reponse)){
|
|
if ($[''][0]!='Q') $joueur1=$[''];
|
|
else {
|
|
$no_match=explode("Q",$['']);$no_match=$no_match[1];
|
|
$requete2="SELECT vainqueur FROM `match` WHERE id_match='".$no_match."'";
|
|
$reponse2=mysql_query($requete2,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$reptab2=mysql_fetch_array($reponse2);
|
|
$joueur1=$[''];
|
|
}
|
|
if ($[''][0]!='Q') $joueur2=$[''];
|
|
else {
|
|
$no_match=explode("Q",$['']);$no_match=$no_match[1];
|
|
$requete2="SELECT vainqueur FROM `match` WHERE id_match='".$no_match."'";
|
|
$reponse2=mysql_query($requete2,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$reptab2=mysql_fetch_array($reponse2);
|
|
$joueur2=$[''];
|
|
|
|
}
|
|
//echo "****".$['']."****<br>";
|
|
$match="";
|
|
if ($joueur1 and $joueur2){
|
|
$requete2="SELECT nom, prenom, classement, id_inscription FROM `inscription`,`joueur` WHERE inscription.id_inscription = '$joueur1'AND inscription.joueur=joueur.id_joueur;";
|
|
$reponse2=mysql_query($requete2,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$reptab2=mysql_fetch_array($reponse2);
|
|
$texte1=$['']." ".$['']." : ".$tab_classement[$['']];
|
|
$requete2="SELECT nom, prenom, classement, id_inscription FROM `inscription`,`joueur` WHERE inscription.id_inscription = '$joueur2'AND inscription.joueur=joueur.id_joueur;";
|
|
$reponse2=mysql_query($requete2,$db_connection) or die ("Erreur no".mysql_errno()." : ".mysql_error()."<br>");
|
|
$reptab2=mysql_fetch_array($reponse2);
|
|
$texte2=$['']." ".$['']." : ".$tab_classement[$['']];
|
|
$list_match[$i][id_match][]=$[''];
|
|
$list_match[$i][joueur1][]=$texte1;$list_match[$i][inscription1][]=$joueur1;
|
|
$list_match[$i][joueur2][]=$texte2;$list_match[$i][inscription2][]=$joueur2;
|
|
}
|
|
}
|
|
}
|
|
echo "<form action=enregistrementScore.php method=post>";
|
|
echo "<center><table border=2 width= 85%>";
|
|
echo "<tr><td></td><td>";
|
|
echo "<table width =100%><tr><th width=60%>Joueurs</th><th width=20%>Score</th><th width=20%>Vainqueur</th></tr></table>";
|
|
echo "</td></tr>";
|
|
$ext=0;
|
|
for($i=0;$i<count($list_tour);$i++){
|
|
if (count($list_match[$i])){
|
|
if (!$double) echo "<tr><th>Tranche ".$tab_classement[$list_tour[$i][avencement]].",<br> Tour ".$list_tour[$i][tour]."</th>";
|
|
else echo "<tr><th>Tranche ".$list_tour[$i][avencement].", <br>Tour ".$list_tour[$i][tour]."</th>";
|
|
echo "<td valign=top>";
|
|
echo "<table width=100%>";
|
|
for ($j=0;$j<count($list_match[$i][id_match]);$j++){
|
|
echo "<tr><td width =60%><font size=2>".$list_match[$i][joueur1][$j]." (".$list_match[$i][inscription1][$j].") Vs (".$list_match[$i][inscription2][$j].") ".$list_match[$i][joueur2][$j]."</font></td>";
|
|
echo "<td width =20% align=right><input type=text size=11 maxlength=11 name=list_match[score][] value='".$[''][$ext]."'>";
|
|
echo "<td width =20% align=right>";
|
|
if ($[''][$ext]==$list_match[$i][inscription1][$j])
|
|
{ $selected_insc1="selected"; $selected_insc2="";/*echo "**1**";*/}
|
|
else if ($[''][$ext]==$list_match[$i][inscription2][$j])
|
|
{ $selected_insc2="selected"; $selected_insc1="";/*echo "**2**";*/}
|
|
else
|
|
{ $selected_insc2="";$selected_insc1="";/*echo "**0**";*/}
|
|
echo "<select name=list_match[vainqueur][]>";
|
|
echo "<option value=0> Choisir...";
|
|
echo "<option ".$selected_insc1.">".$list_match[$i][inscription1][$j];
|
|
echo "<option ".$selected_insc2.">".$list_match[$i][inscription2][$j]."</select>";
|
|
echo "</td></tr>";
|
|
$ext++;
|
|
}
|
|
echo "</table>";
|
|
echo "</td></tr>";
|
|
}
|
|
}
|
|
echo "</table><p>";
|
|
echo "<INPUT TYPE=SUBMIT VALUE=Continuer>";
|
|
echo "<INPUT TYPE=RESET VALUE=Annuler>";
|
|
echo $erreur;$erreur="";
|
|
echo "</center>";
|
|
for($i=0;$i<count($list_tour);$i++){
|
|
for ($j=0;$j<count($list_match[$i][id_match]);$j++){
|
|
echo "<input type=hidden name=list_match[id_match][] value=".$list_match[$i][id_match][$j].">";
|
|
echo "<input type=hidden name=list_match[inscription1][] value=".$list_match[$i][inscription1][$j].">";
|
|
echo "<input type=hidden name=list_match[inscription2][] value=".$list_match[$i][inscription2][$j].">";
|
|
}
|
|
}
|
|
echo "<input type=hidden name=categorie value=".$categorie.">";
|
|
echo "</form>";
|
|
mysql_close($db_connection);
|
|
include("piedDePage.php");
|
|
?>
|
|
|