function db_clmnt($champ, $debut, $fin, $cache) { $nb_requete=0; if($cache=="1"){ mysql_query("DELETE FROM phpl_clmnt_cache WHERE ID_CHAMP='$champ'") or die (mysql_error());} else{ mysql_query("DELETE FROM phpl_clmnt") or die (mysql_error());} $nb_requete++; if (!$fin){$fin=(nb_equipes($champ)*2)-2;} if (!$debut){$debut=1;} // SELECTION DES PARAMETRES $query="SELECT pts_victoire, pts_nul, pts_defaite FROM phpl_parametres WHERE id_champ='$champ'"; $nb_requete++; $result=(mysql_query($query)) or die (mysql_error()) ; while ($row=mysql_fetch_array($result) ) { $pts_victoire=$row['pts_victoire']; $pts_nul=$row['pts_nul']; $pts_defaite=$row['pts_defaite']; } // victoires domicile $query="SELECT dom.id, count(dom.id), phpl_clubs.nom, sum(buts_dom), sum(buts_ext) FROM phpl_equipes as dom, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE dom.id_champ='$champ' AND dom.id_club=phpl_clubs.id AND dom.id=phpl_matchs.id_equipe_dom AND buts_dom > buts_ext AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $nb_requete++; $dom = mysql_query($query) or die (mysql_error()); while($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['GDOM']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSDOMPOUR'])) {$clmnt[$row[2]]['BUTSDOMPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSDOMPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSDOMCONTRE'])) {$clmnt[$row[2]]['BUTSDOMCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSDOMCONTRE']+=$row[4];} } // Defaites domicile $query="SELECT dom.id, count(dom.id), phpl_clubs.nom, sum(buts_dom), sum(buts_ext) FROM phpl_equipes as dom, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE dom.id_champ='$champ' AND dom.id_club=phpl_clubs.id AND dom.id=phpl_matchs.id_equipe_dom AND buts_dom < buts_ext AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $dom = mysql_query($query) or die (mysql_error()); while($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['PDOM']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSDOMPOUR'])) {$clmnt[$row[2]]['BUTSDOMPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSDOMPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSDOMCONTRE'])) {$clmnt[$row[2]]['BUTSDOMCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSDOMCONTRE']+=$row[4];} } // Nuls domicile $query="SELECT dom.id, count(dom.id), phpl_clubs.nom, sum(buts_dom), sum(buts_ext) FROM phpl_equipes as dom, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE dom.id_champ='$champ' AND dom.id_club=phpl_clubs.id AND dom.id=phpl_matchs.id_equipe_dom AND buts_dom = buts_ext AND buts_dom is not null AND buts_ext is not null AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $dom = mysql_query($query) or die (mysql_error()); while($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['NDOM']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSDOMPOUR'])) {$clmnt[$row[2]]['BUTSDOMPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSDOMPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSDOMCONTRE'])) {$clmnt[$row[2]]['BUTSDOMCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSDOMCONTRE']+=$row[4];} } // Resultats à domicile $query="SELECT phpl_clubs.nom FROM phpl_clubs, phpl_equipes, phpl_championnats WHERE phpl_equipes.id_champ=phpl_championnats.id AND phpl_championnats.id='$champ' AND phpl_equipes.id_club=phpl_clubs.id"; $result=mysql_query($query) or die (mysql_error()); // RESULTATS EXTERIEURS : // victoires exterieur $query="SELECT ext.id, count(ext.id), phpl_clubs.nom, sum(buts_ext), sum(buts_dom) FROM phpl_equipes as ext, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE ext.id_champ='$champ' AND ext.id_club=phpl_clubs.id AND ext.id=phpl_matchs.id_equipe_ext AND buts_ext > buts_dom AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $dom = mysql_query($query) or die (mysql_error());; while($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['GEXT']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSEXTPOUR'])) {$clmnt[$row[2]]['BUTSEXTPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSEXTPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSEXTCONTRE'])) {$clmnt[$row[2]]['BUTSEXTCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSEXTCONTRE']+=$row[4];} } // Defaites exterieur $query="SELECT ext.id, count(ext.id), phpl_clubs.nom, sum(buts_ext), sum(buts_dom) FROM phpl_equipes as ext, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE ext.id_champ='$champ' AND ext.id_club=phpl_clubs.id AND ext.id=phpl_matchs.id_equipe_ext AND buts_ext < buts_dom AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $dom=mysql_query($query) or die (mysql_error()); While($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['PEXT']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSEXTPOUR'])) {$clmnt[$row[2]]['BUTSEXTPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSEXTPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSEXTCONTRE'])) {$clmnt[$row[2]]['BUTSEXTCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSEXTCONTRE']+=$row[4];} } // Nuls exterieur $query="SELECT ext.id, count(ext.id), phpl_clubs.nom, sum(buts_ext), sum(buts_dom) FROM phpl_equipes as ext, phpl_clubs, phpl_matchs, phpl_journees, phpl_championnats WHERE ext.id_champ='$champ' AND ext.id_club=phpl_clubs.id AND ext.id=phpl_matchs.id_equipe_ext AND buts_ext = buts_dom AND buts_dom is not null AND buts_ext is not null AND phpl_championnats.id=phpl_journees.id_champ AND phpl_journees.id=phpl_matchs.id_journee AND phpl_journees.numero>='$debut' AND phpl_journees.numero<='$fin' GROUP by phpl_clubs.nom "; $dom=mysql_query($query) or die (mysql_error());; while($row= mysql_fetch_array($dom)) { $clmnt[$row[2]]['NEXT']=$row[1]; if (!isset($clmnt[$row[2]]['BUTSEXTPOUR'])) {$clmnt[$row[2]]['BUTSEXTPOUR']=$row[3];} else{$clmnt[$row[2]]['BUTSEXTPOUR']+=$row[3];} if (!isset($clmnt[$row[2]]['BUTSEXTCONTRE'])) {$clmnt[$row[2]]['BUTSEXTCONTRE']=$row[4];} else{$clmnt[$row[2]]['BUTSEXTCONTRE']+=$row[4];} } // TABLEAU DE CLASSEMENT $query="SELECT phpl_clubs.nom, phpl_equipes.penalite, phpl_equipes.id FROM phpl_clubs, phpl_equipes, phpl_championnats WHERE phpl_equipes.id_champ=phpl_championnats.id AND phpl_championnats.id='$champ' AND phpl_equipes.id_club=phpl_clubs.id"; $result=mysql_query($query) or die (mysql_error()); //mysql_query("LOCK TABLE phpl_clmnt WRITE, phpl_equipes WRITE, phpl_clubs WRITE") or die (mysql_error()); if (mysql_num_rows($result)==0) { $query="SELECT phpl_clubs.nom, phpl_equipes.id FROM phpl_clubs, phpl_equipes, phpl_championnats WHERE phpl_equipes.id_champ=phpl_championnats.id AND phpl_championnats.id='$champ' AND phpl_equipes.id_club=phpl_clubs.id"; $result=mysql_query($query) or die (mysql_error()); } while($row = mysql_fetch_array($result)) { $NOM=$row['nom']; $DOMJOUES=$clmnt[$NOM]['GDOM']+$clmnt[$NOM]['NDOM'] + $clmnt[$NOM]['PDOM']; $EXTJOUES=$clmnt[$NOM]['GEXT']+$clmnt[$NOM]['NEXT'] + $clmnt[$NOM]['PEXT']; $JOUES=$EXTJOUES + $DOMJOUES; $DOMPOINTS=(($clmnt[$NOM]['GDOM'])*$pts_victoire) + (($clmnt[$NOM]['NDOM'])*$pts_nul) + (($clmnt[$NOM]['PDOM'])*$pts_defaite); $EXTPOINTS=(($clmnt[$NOM]['GEXT'])*$pts_victoire) + (($clmnt[$NOM]['NEXT'])*$pts_nul) + (($clmnt[$NOM]['PEXT'])*$pts_defaite); $POINTS= $DOMPOINTS+ $EXTPOINTS + $row['penalite']; $G=($clmnt[$NOM]['GEXT'])+($clmnt[$NOM]['GDOM']); $N=($clmnt[$NOM]['NEXT'])+($clmnt[$NOM]['NDOM']); $P=$clmnt[$NOM]['PEXT'] + $clmnt[$NOM]['PDOM']; $DOMG=($clmnt[$NOM]['GDOM']); $DOMN=($clmnt[$NOM]['NDOM']); $DOMP=$clmnt[$NOM]['PDOM']; $EXTG=($clmnt[$NOM]['GEXT']); $EXTN=($clmnt[$NOM]['NEXT']); $EXTP=$clmnt[$NOM]['PEXT']; $BUTSPOUR=$clmnt[$NOM]['BUTSEXTPOUR'] + $clmnt[$NOM]['BUTSDOMPOUR']; $DOMBUTSPOUR=$clmnt[$NOM]['BUTSDOMPOUR']; $EXTBUTSPOUR=$clmnt[$NOM]['BUTSEXTPOUR']; $BUTSCONTRE=$clmnt[$NOM]['BUTSEXTCONTRE'] + $clmnt[$NOM]['BUTSDOMCONTRE']; $DOMBUTSCONTRE= $clmnt[$NOM]['BUTSDOMCONTRE']; $EXTBUTSCONTRE=$clmnt[$NOM]['BUTSEXTCONTRE'] ; $DIFF=$BUTSPOUR - $BUTSCONTRE; $DOMDIFF=$DOMBUTSPOUR-$DOMBUTSCONTRE; $EXTDIFF=$EXTBUTSPOUR - $EXTBUTSCONTRE; $PEN = $row['penalite']; $NOM=addslashes($row['nom']); $question="INSERT INTO "; if($cache=="1"){$question.="phpl_clmnt_cache ";} else{$question.="phpl_clmnt ";} $question.="SET NOM='$NOM', ID_EQUIPE='$row[id]', ID_CHAMP='$champ', POINTS='$POINTS', DOMPOINTS='$DOMPOINTS', EXTPOINTS='$EXTPOINTS', JOUES= '$JOUES', DOMJOUES= '$DOMJOUES', EXTJOUES= '$EXTJOUES', G='$G', DOMG='$DOMG', EXTG='$EXTG', N='$N', DOMN='$DOMN', EXTN='$EXTN', P='$P', DOMP='$DOMP', EXTP='$EXTP', BUTSPOUR='$BUTSPOUR', DOMBUTSPOUR='$DOMBUTSPOUR', EXTBUTSPOUR='$EXTBUTSPOUR', BUTSCONTRE='$BUTSCONTRE', DOMBUTSCONTRE='$DOMBUTSCONTRE', EXTBUTSCONTRE='$EXTBUTSCONTRE', DIFF='$DIFF', DOMDIFF='$DOMDIFF', EXTDIFF='$EXTDIFF', PEN='$PEN'"; $result2=mysql_query($question) or die(mysql_error()); } if($cache=="1"){$requete="DELETE FROM phpl_clmnt_cache WHERE nom='exempte'" or die (mysql_error());} else{$requete="DELETE FROM phpl_clmnt WHERE nom='exempte'" or die (mysql_error());} $resultat=mysql_query($requete) or die (mysql_error()); //mysql_query("UNLOCK TABLES") or die (mysql_error()); }
<tr> <td align="center" class=phpl6 colspan="4"><b><?php echo ADMIN_RENS_8; ?> </b></td> </tr> <td class=phpl3 colspan="2"><form method="post" action=""><?php echo ADMIN_EQUIPE_4; ?> <b><?php affich_champ($champ); ?> </b> : <?php equipes_menu($champ); print nb_equipes($champ); ?> clubs</td> <td class=phpl3 align=right colspan="3"> <?php $value = ADMIN_RENS_8; echo "<input type=\"submit\" value=\"{$value}\">"; ?> <input type="hidden" name="action3" value="supp"> <input type="hidden" name="action" value="equipes"> <input type="hidden" name="page" value="championnat"> <?php echo "<input type=\"hidden\" name=\"champ\" value=\"{$champ}\">"; ?> </form>
// $x++; //} } ?> <table class=phpl width="80%"> <tr> <td class=phpl2 align="center" colspan="3"><? echo ADMIN_DATES_TITRE." "; affich_champ ($champ); ?></td><td class=phpl2 align="right"><a href="#" onclick="window.open('Assistant_fr/dates.htm','Assistant','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,width=512,height=512');return false;"><img border="0" alt="Assistant" src="aide.gif"></a></td> </tr> <form method="post" action=""> <? $nb_equipes=nb_equipes ($champ); if ($nb_equipes==0) { echo "<tr><td align=\"center\">".ADMIN_DATES_5." <a href=\"?page=championnat&action=equipes&champ=$champ\">".TEAM."</td></tr></table>"; } elseif (($nb_equipes%2)!==0) { echo "<tr><td align=\"center\">".ADMIN_DATES_3."</td></tr></table>"; } else { $requete="SELECT * FROM phpl_journees WHERE id_champ='$champ'";
$nb_journees=(nb_equipes($champ)*2)-2; $x=1; while($x<=$nb_journees) { $query=" SELECT sum(phpl_matchs.id_equipe_dom), sum(phpl_matchs.id_equipe_ext) FROM phpl_matchs, phpl_journees WHERE phpl_matchs.id_journee=phpl_journees.id AND phpl_journees.id_champ='$champ' AND phpl_journees.numero='$x' "; $result=mysql_query($query); $sum=mysql_fetch_array($result); $sum_day=$sum[0]+$sum[1]; echo "<small>MATCH_SUM = ".$sum_day." </small>"; $query="SELECT count(DISTINCT phpl_matchs.id_equipe_dom), count(DISTINCT phpl_matchs.id_equipe_ext) FROM phpl_matchs, phpl_journees WHERE phpl_matchs.id_journee=phpl_journees.id AND phpl_journees.id_champ='$champ' AND phpl_journees.numero='$x' "; $result=mysql_query($query); while( $row = (mysql_fetch_array($result)) ) { if($row[0]==$row[1] and $row[0]==nb_equipes($champ)/2 and ($sum[0]+$sum[1]==$sumsum) ) { echo ADMIN_COHERENCE_MSG2." "; echo "$x"; echo ADMIN_COHERENCE_MSG3; echo "<br />"; $incoherent="0"; } else { echo ADMIN_COHERENCE_MSG2." "; echo "$x "; echo ADMIN_COHERENCE_MSG4; $incoherent="1"; echo "<br />";
if (isset($typemini)) { // RAPPEL DES PARAMETRES du CHAMPIONNAT $result=mysql_query("SELECT * FROM phpl_parametres WHERE id_champ='$champmini'"); while ($row=mysql_fetch_array($result)) { $accessionmini = $row['accession']; $barragemini = $row['barrage'] + $accessionmini; $id_equipe_fetiche=$row['id_equipe_fetiche']; $relegation = $row['relegation']; } $requete = "SELECT * FROM phpl_equipes, phpl_clubs WHERE phpl_clubs.id=phpl_equipes.id_club AND id_champ='$champmini' AND phpl_clubs.nom='exempte'"; $resultats=mysql_query($requete); $exempte=mysql_num_rows($resultats); if ($exempte=='1') {$relegationmini = nb_equipes($champmini)- $relegation-1;} else {$relegationmini = nb_equipes($champmini)- $relegation;} //$relegationmini = nb_equipes($champmini)- $row[relegation]; $legendemini=''; echo "<div style=\"margin-top:1px;padding-top:3px;\" align=\"center\">"; echo "Type : <select onChange=\"$('#pronos_classement').load('http://".$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'],'/'))."/../consult/miniseul.php?champmini=".$champmini."&typemini='+this.options[this.selectedIndex].value+'&presentationmini=1&lienmini=non&classmini=1');\">"; echo "<option value=\"General\""; if($typemini=="General") { echo "selected"; } echo ">General</option>"; echo "<option value=\"Domicile\""; if($typemini=="Domicile") { echo "selected"; } echo ">Domicile</option>"; echo "<option value=\"Extérieur\""; if($typemini=="Extérieur") { echo "selected"; }
+---------------------------------------------------------------------+ */ if (eregi("block_stats.php", $_SERVER['PHP_SELF'])) { die("You cannot open this page directly"); } global $config, $s_joueur, $s_theme; global $strStatistiques, $strJoueurs, $strInscrits, $strTournois, $strNews, $strLiens, $strDownloads, $strPagesVues; global $compteur; theme_openblock("<img src=\"themes/{$s_theme}/images/icon_stats.gif\" align=\"absmiddle\" alt=\"stats\"> {$strStatistiques}"); $nbnews = nb_news(); $nbdownloads = nb_downloads(); $nbliens = nb_liens(); $nbjoueurs = nb_joueurs(); $nbplaces = $config['places']; $nbinscrits = nb_joueurs_inscrit(); $nbequipes = nb_equipes(); $nbtournois = nb_tournois(); echo "<dl><li class=\"lib\">{$strJoueurs} : {$nbjoueurs}</li>"; echo "<li class=\"lib\">{$strInscrits} : {$nbinscrits}/{$nbplaces}</li>"; affiche_bar($nbinscrits, $nbplaces, 100); echo "<li class=\"lib\">{$strTournois} : {$nbtournois}</li>"; echo "<li class=\"lib\">{$strEquipes} : {$nbequipes}</li>"; if ($config['news']) { echo "<li class=\"lib\">{$strNews} : {$nbnews}</li>"; } if ($config['liens']) { echo "<li class=\"lib\">{$strLiens} : {$nbliens}</li>"; } if ($config['download']) { echo "<li class=\"lib\">{$strDownloads} : {$nbdownloads}</li></dl>"; }
} else { // Insertion des paramètres dans la bdd $requete="INSERT INTO phpl_parametres (id_champ, pts_victoire, pts_nul, pts_defaite, accession, barrage, relegation,id_equipe_fetiche, fiches_clubs, estimation) VALUES ('$champ', '$pts_victoire', '$pts_nul', '$pts_defaite', '$accession', '$barrage', '$relegation', '$id_equipe_fetiche', '$fiches_clubs', '$estimation')"; $resultats = mysql_query ($requete)or die (mysql_error()); if (!$resultats) die (mysql_error()); } } if ($malus) { $y=nb_equipes($champ); $x=0; while($x<$y) { mysql_query("UPDATE phpl_equipes SET penalite = '$malus[$x]' WHERE id = '$id_equipe[$x]'") or die(mysql_error()); $x++; } } ?> <table class=phpl width="80%"> <tr> <td class=phpl2 align="center" colspan="3"><? echo ADMIN_PARAM_TITRE." "; affich_champ ($champ); ?></td> </tr> <tr>
<td align="center"> <?php include "tps1.php3"; $query1 = "SELECT id FROM phpl_equipes WHERE id_champ='{$champ}'"; $result1 = mysql_query($query1); while ($row1 = mysql_fetch_array($result1)) { $query = "DELETE FROM phpl_clmnt_graph WHERE phpl_clmnt_graph.id_equipe='{$row1['0']}'"; mysql_query($query) or die(mysql_error()); } $debut = 0; $fin = 1; $result = mysql_query("SELECT accession, barrage, relegation FROM phpl_parametres WHERE id_champ='{$champ}'"); while ($row = mysql_fetch_array($result)) { $accession = $row['accession']; $barrage = $row['barrage'] + $accession; $relegation = nb_equipes($champ) - $row['relegation']; } $legende = CONSULT_CLMNT_MSG4 . $debut . CONSULT_CLMNT_MSG5 . $fin; $query = "SELECT max(phpl_journees.numero) FROM phpl_journees, phpl_matchs WHERE phpl_journees.id=phpl_matchs.id_journee AND buts_dom is not NULL and phpl_journees.id_champ='{$champ}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $max = $row[0]; while ($fin <= $max) { @db_clmnt($champ, $debut, $fin, 0); $query = "SELECT * FROM phpl_clmnt ORDER BY POINTS DESC, DIFF DESC, BUTSPOUR DESC, BUTSCONTRE ASC, NOM"; $result = mysql_query($query) or die(mysql_error()); $pl = 1; while ($row = mysql_fetch_array($result)) { $x = 0; $id_equipe = $row["ID_EQUIPE"]; $query = "INSERT INTO phpl_clmnt_graph (id_equipe, fin, classement) VALUES ('{$id_equipe}','{$fin}', '{$pl}')";