File "stats.php"
Full Path: /home/analogde/www/Bookmarks/CHESS_ON/stats.php
File size: 9.5 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
include('database.php');
DB_connexion();
ini_set( 'display_errors', '0');
error_reporting( 0 );
//SELECT * FROM users WHERE CONCAT(first_name, ' ', last_name) LIKE '%keywords%';
//$tab_projet= array();
$ligne_par_page = 8;
$selection = false;
if( !isset($_POST['statut']) && !isset($_GET['position']) )
{
$statut = "tous";
$requete = "SELECT * FROM partie";
$result = mysql_query($requete);
$nb_enregistrement = mysql_num_rows($result);
if($nb_enregistrement > $ligne_par_page)
{ $nombre_pages = ceil($nb_enregistrement/$ligne_par_page);
}
if($nb_enregistrement <= $ligne_par_page)
{ $nombre_pages = 1;
}
$pageActuelle=1;
$premiereEntree=($pageActuelle-1)*$ligne_par_page;
}
/* if( isset($_GET['page']) )
{
$requete = "SELECT * FROM projet";
$result = mysql_query($requete);
$nb_enregistrement = mysql_num_rows($result);
if($nb_enregistrement > $ligne_par_page)
{ $nombre_pages = ceil($nb_enregistrement/$ligne_par_page);
}
if($nb_enregistrement <= $ligne_par_page)
{ $nombre_pages = 1;
}
$pageActuelle = $_GET['page'];
$premiereEntree=($pageActuelle-1)*$ligne_par_page;
}
*/
if( isset($_GET['nom_joueur'] ) && $_GET['mot'] != "" )
{ $nom_joueur = $_GET['mot'];
$nombre_pages = 1;
$pageActuelle=1;
$premiereEntree=($pageActuelle-1)*$ligne_par_page;
$selection = true;
}
if( isset($_GET['nom_joueur'] ) && $_GET['mot'] == "" )
{ if( $_GET['nom_joueur'] == "--[ Tous ]--")
{ $nom_joueur = $_GET['nom_joueur'];
}
else {
$nom_joueur = $_GET['nom_joueur'];
$nombre_pages = 1;
$pageActuelle=1;
$premiereEntree=($pageActuelle-1)*$ligne_par_page;
$selection = true;
}
}
?>
<!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" xml:lang="fr" lang="fr" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Site perso,cours,ouvrages" />
<meta name="Keywords" content="WEBSITE perso " />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="" />
<meta http-equiv="Content-Language" content="fr" />
<meta name="rating" content="general" />
<meta name="author" content="Patrice DELPY" />
<meta name="copyright" content="Copyright 2013" />
<meta name="generator" content="Patoche" />
<title>Patoche WEBSITE - 2013 - Template du site - en cours de développemment ...</title>
<?php
include('include_css_template_commun.php');
include('include_css.php');
include('css_tools_skill.php');
include('include_javascript.php');
?>
<style type="text/css">
#bloc_classement_joueur { float: left;
width: 831px;
padding: 50px 50px 25px 50px;
}
#navigation_tournoi{
float: left;
width: 850px;
padding: 10px 0px 0px 10px;
}
</style>
<script type="text/javascript">
function call_update()
{
ajax_routine();
setTimeout("call_update()", 1000); //appelle la fonction 1 fois par seconde
}
</script>
</head>
<body>
<div class="main"> <!-- main -->
<!---------------------------------------------------------->
<div class="header">
<div class="balise_titre">Patoche</div>
<div class="balise_citation">
"Etre conscient que l'on est ignorant est un grand pas vers le savoir"
</div>
</div>
<div class="banniere"></div>
<!---------------------------------------------------------->
<?php
/* include("include_barre_login.php");
echo '<div id="box_icon">';
include("debug_connexion_membre.php");
echo '</div>';
include("include_menu.php");*/
echo '<div id="box_infos">';
include("include_menu.php");
echo '<div id="box_icon2">';
include("connexion_membre.php");
echo '</div>';
echo '<div id="box_icon3">';
include("include_barre_login.php");
echo '</div>';
echo '</div>';
$_SESSION['page_active'] = basename (__FILE__ );
?>
<!---------------------------------------------------------->
<div class="contenu"> <!-- contenu -->
<!---------------------------------------------------------->
<div class="barre_vide"></div>
<div id="navigation_tournoi">
<ul id="menu_horiz">
<li class="tournoi_joueur_tag"><a href="ajouter_joueur.php" title="aller à la section">Ajouter joueur</a></li>
<li class="tournoi_partie_tag"><a href="partie.php" title="aller à la section">Partie</a></li>
<li class="tournoi_classement_tag_selected"><a href="classement.php" title="aller à la section">classement</a></li>
<li class="tournoi_liste_joueurs_tag"><a href="liste_joueurs.php" title="aller à la section">Joueurs</a></li>
<li class="tournoi_stats_tag"><a href="stats_joueurs.php" title="aller à la section">stats</a></li>
</ul>
</div>
<!--<div class="heading">Liste des matchs</div><br> -->
<form action="" method="GET" name="form_stats">
<!--Choix : -->
<?php
echo " <select name=\"nom_joueur\" size=\"1\" onChange=\"submit()\" id=\"\"> ";
if($nom_joueur != "")
{
echo "<option selected=\"selected\" value=\"--[ Tous ]--\">$nom_joueur</option> ";
echo "<option value=\"--[ Tous ]--\">--[ Tous ]--</option> ";
}
if($nom_joueur == "")
{
echo "<option selected=\"selected\" value=\"--[ Tous ]--\">--[ Tous ]--</option> ";
}
$sql = "SELECT * FROM joueurs";
$req = mysql_query($sql);
while($resultat = mysql_fetch_row($req))
{ //$tab_projet[]= $resultat[1];
echo '<option value="'.$resultat[1].'">'.$resultat[1];
echo '</option>';
}
echo '</select>';
echo " <input type=\"text\" name=\"mot\" value=\"\" size=\"15\"> ";
?>
<input type="submit" value="Rechercher" alt="Lancer la recherche!">
</form>
<br/>
<br/>
<br/>
<div id="list">
<table border=1 align=center width='80%'><tr>
<th class="center" width="30">Joueur 1</th>
<th align="center" width="30">Joueur 2</th>
<th align="center" width="50">Résultat</th>
<th align="center" width="50">Date</th>
<th align="center" width="50">Heure</th>
</tr>
<?php
if($selection == true)
{
// fonctionne (SELECT matable_1.colonne FROM matable_1) union (SELECT matable_2.colonne FROM matable_2)
$sql = "SELECT * FROM partie where joueur1 = '$nom_joueur'";
$retour1 = mysql_query($sql);
$sql = "SELECT * FROM partie where joueur2 = '$nom_joueur'";
$retour2 = mysql_query($sql);
while($data = mysql_fetch_assoc($retour1))
{
$J1 = $data['joueur1'];
$J2 = $data['joueur2'];
$resultat_partie = $data['resultat_partie'];
$date = $data['date_partie'];
$heure = $data['heure_partie'];
echo "<tr>
<td align=center width='20'> $J1 </td>
<td align=center width='20'> $J2 </td>
<td align=center width='60'> $resultat_partie </td>
<td align=center width='60'> $date </td>
<td align=center width='60'> $heure </td>
</tr>";
}
while($data = mysql_fetch_assoc($retour2))
{
$J1 = $data['joueur1'];
$J2 = $data['joueur2'];
$resultat_partie = $data['resultat_partie'];
$date = $data['date_partie'];
$heure = $data['heure_partie'];
echo "<tr>
<td align=center width='20'> $J2 </td>
<td align=center width='20'> $J1 </td>
<td align=center width='60'> $resultat_partie </td>
<td align=center width='60'> $date </td>
<td align=center width='60'> $heure </td>
</tr>";
}
}
if($selection == false)
{
$sql = "SELECT * FROM partie ORDER BY id DESC LIMIT $premiereEntree, $ligne_par_page ";
$retour = mysql_query($sql);
while($data = mysql_fetch_assoc($retour))
{
$J1 = $data['joueur1'];
$J2 = $data['joueur2'];
$resultat_partie = $data['resultat_partie'];
$date = $data['date_partie'];
$heure = $data['heure_partie'];
echo "<tr>
<td align=center width='20'> $J1 </td>
<td align=center width='20'> $J2 </td>
<td align=center width='60'> $resultat_partie </td>
<td align=center width='60'> $date </td>
<td align=center width='60'> $heure </td>
</tr>";
}
}
echo " </tbody>
</table>
</div> ";
echo '<p align="center">Page : ';
for($i=1; $i<=$nombre_pages; $i++)
{
if($i==$pageActuelle) //Si il s'agit de la page actuelle...
{
echo ' [ '.$i.' ] ';
}
else {
echo ' <a href="lister_projet.php?position='.$statut.'&page='.$i.'">'.$i.'</a> ';
}
}
echo '</p>';
?>
<?php
include('include_pied_page.php');
include('include_publicite.php');
?>
<!---------------------------------------------------------->
</div> <!-- contenu -->
<!---------------------------------------------------------->
</div> <!-- main -->
<!---------------------------------------------------------->
<script type="text/javascript">
call_update()
</script>
</body>
</html>