File "historique.php"

Full Path: /home/analogde/www/Bookmarks/CHESS_ON/historique.php
File size: 10.74 KB
MIME-type: text/x-php
Charset: utf-8

<?php
	session_start();
	 
	include('correlation.php');
	
	/*if(!isset($_SESSION['logged']) )
	{		header ('Location: interdiction.php');
	}
	
	if($_SESSION['logged']== "no")
	{
		header ('Location: interdiction.php');
	}*/
	
/******** eviter des soumission intempestives lors d'un reload de la page F5  ************************************/	
	if(!empty($_POST) )
	{
		$_SESSION['sauvegarde_formulaire'] = $_POST ;
     
		$page_actuelle = $_SERVER['PHP_SELF'] ;
		if(!empty($_SERVER['QUERY_STRING']))
		{
			$page_actuelle .= '?' . $_SERVER['QUERY_STRING'] ;
		}
     
		header('Location: ' . $page_actuelle);
		exit;
	}
	
	if(isset($_SESSION['sauvegarde_formulaire']))
	{
		$_POST = $_SESSION['sauvegarde_formulaire'] ;
		unset($_SESSION['sauvegarde_formulaire']);		
	}	
/************************************************************************/	
	  
?>
  
<!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>



<!--
en php
header("Cache-Control: no-cache, must-revalidate"); 
-->

<!---------------------------------------------------------->	
<?php
		include('include_css_template_commun.php');
		include('include_css.php');
		include('css_tools_skill.php');
		include('include_javascript.php');

?> 

<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<style type="text/css">
#bloc_table_forum { float: left;
					width: 831px; 
					padding: 50px 50px 25px 50px;
					}	
					
#navigation_tournoi{
					float: left;
					width: 910px; // 870
					padding: 10px 0px 0px 10px;
					text-align: center;
		}
					
.marge {
    margin: auto;
    width: 60%;
    padding: 10px ;
	}
	
label {
		display:block;
		float:left;
		width:100px;
	  }

}					
					
</style>

<script type="text/javascript">
function call_update()
{
			//ajax_routine(); 
			scruter();
			setTimeout("call_update()", 1000); //appelle la fonction 1 fois par  seconde
}

function scruter()
{
			var xhr = getXhr()

			xhr.onreadystatechange = function()
			{
				// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200)
					{
						//alert(xhr.responseText);
						retour = xhr.responseText;
						
						if(retour == 0)
						{  	
		
							$(function()
							{
									$( "#message_expiration" ).dialog({
									modal: true,
									title: "Infos",
									buttons: {
												Ok: function()
												{
													$( this ).dialog( "close" );
													 document.location.href = "logout_expire.php";
												}
											 }
										});
							});
						}
					}
			}
					
			xhr.open("GET","session_timeout.php",true);
			xhr.send(null);
}

function getXhr()
{
			var xhr = null; 
	
			if(window.XMLHttpRequest) // Firefox et autres
				xhr = new XMLHttpRequest(); 
			else if(window.ActiveXObject)
			{ // Internet Explorer 
				try 
				{
					xhr = new ActiveXObject("Msxml2.XMLHTTP");
				} 
				catch (e) 
				{
					xhr = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			
			else 
			{ 	// XMLHttpRequest non supporté par le navigateur 
					alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
					xhr = false; 
			} 

			return xhr;
}

</script>

<!---------------------------------------------------------->	
</head>

<body>
<!---------------------------------------------------------->	
	<div class="main"> <!-- main -->
<!---------------------------------------------------------->	

          <div class="header">
                <div class="balise_titre">Patoche</div>
                <div class="balise_citation">
                &quot;Etre conscient que l'on est ignorant est un grand pas vers le savoir&quot;
                </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_partie_tag"><a href="partie.php" title="aller à la section">Duel</a></li>
				<li class="tournoi_simulation_tag"><a href="simulation.php" title="aller à la section">Sim</a></li>
				<li class="tournoi_classement_tag"><a href="classement02.php" title="aller à la section">ELO</a></li>
				<li class="tournoi_master_tag"><a href="on_chess_master02.php" title="aller à la section">Master</a></li>
				<li class="tournoi_liste_joueurs_tag"><a href="joueurs_echec.php" title="aller à la section">Players</a></li>
				<li class="tournoi_stats_tag_selected"><a href="historique.php" title="aller à la section">Games</a></li>
				<li class="tournoi_reglement_tag"><a href="reglement.php" title="aller à la section">Rules</a></li>
				<li class="tournoi_securite_tag"><a href="admin.php" title="aller à la section">Admin</a></li>
				</ul>
			</div>
			
			<div id="bloc_historique">
			<br/>
			<br/>
			<br/>
			<br/>
				
<?php			
			//$sql = "SELECT * FROM parties"; //  ORDER by date desc"; //asc 
			$sql = "SELECT * FROM " .$_SESSION['parties']; //  ORDER by date desc"; //asc 
			$results = mysql_query($sql);
			$number = mysql_num_rows($results);
			echo "<p align=center>$number parties.</p><br>";
								
			$item = 0;
					
			while($row = mysql_fetch_assoc($results))
			{
						$store = array();
					
						$blanc = $row['w_name'];
						$noir = $row['b_name'];
						$date = $row['date'];
						$resultat = $row['result'];
						$date_partie = date('d/m/Y', $date);

						//$w_apres_elo1 = $row['w_arating'];
						$w_avant_elo1 = $row['w_arating'];
						//$b_apres_elo1 = $row['b_arating'];
						$b_avant_elo2 = $row['b_arating'];

						
						//$w_apres_elo1 = $row['w_arating'];
						//$w_avant_elo1 = $row['w_arating'];
						//$b_apres_elo1 = $row['b_arating'];
						//$b_avant_elo2 = $row['b_arating'];
						
						if($resultat == 1)
						{
							$score = "1 - 0";
						}
						if($resultat == 2)
						{
							$score = "0 - 1";
						}
						if($resultat == 3)
						{
							$score = "0.5 - 0.5";
						}
						
						$store[0] = $item;
						$store[1] = $blanc;
						$store[2] = $w_avant_elo1;
						$store[3] = $noir;
						$store[4] = $b_avant_elo2;
						$store[5] = $score;
						$store[6] = $date_partie;
						
						$donnee[] = $store;
						
						$item = $item + 1;
			}
					
					
			echo "<table border=1 align=center width='90%'>
 				  <tr>
				  <th>ID</th>
				  <th>Blanc</th>
				  <th>Elo</th>
				  <th>Noir</th>
				  <th>Elo</th>
				  <th>Score</th>
				  <th>Date</th>";
			if($_SESSION['logged'] == "ok")			
			{
				echo "<th colspan = '3'>Action</th>";
			}
			echo "</tr>";
					
			// affichage des enregistrements
				
			$indice = $number -1;
			
			$reversed = array_reverse($donnee);
				
			for ($i=0; $i < count($reversed) ; $i++)
			{
				$tmp = $reversed[$i];
					
				// echo "<tr> 
				// <td align=center width='20'>  $item </td> 
				// <td align=center width='180'> $blanc </td> 
				// <td align=center width='550'> $w_avant_elo1 </td> 
				// <td align=center width='180'> $noir </td>
				// <td align=center width='550'> $b_avant_elo2 </td>  
				// <td align=center width='550'> $score </td> 
				// <td align=center width='600'> $date_partie </td>";

				$id = $tmp[0]+1;		
				echo "<tr> 
					  <td align=center width='20'>  $id </td> 
					  <td align=center width='180'> $tmp[1] </td> 
					  <td align=center width='550'> $tmp[2] </td> 
					  <td align=center width='180'> $tmp[3] </td>
					  <td align=center width='550'> $tmp[4] </td>  
					  <td align=center width='550'> $tmp[5] </td> 
					  <td align=center width='600'> $tmp[6] </td>";	  

				if($_SESSION['logged'] == "ok")			
				{	
					// echo "	
					// <td align=center width='500'><a href='edition_partie.php?id=$indice&J1=$blanc&J2=$noir&score= $score&&date= $date_partie'>Edition</a></td> 
					// <td align=center width='500'><a href='effacer_partie.php?id=$indice&J1=$blanc&J2=$noir&score= $score&&date= $date_partie'>Effacer</a></td>
					// <td align=center width='500'><a href='inserer_partie.php?id=$indice&J1=$blanc&J2=$noir&score= $score&&date= $date_partie'>Insérer</a></td>"; 	
							  
					echo "	
					<td align=center width='500'><a href='edition_partie.php?id=$indice&J1= $tmp[1]&J2= $tmp[3]&score= $tmp[5]&date= $tmp[6]'>Edition</a></td> 
					<td align=center width='500'><a href='effacer_partie.php?id=$indice&J1= $tmp[1]&J2= $tmp[3]&score= $tmp[5]&date= $tmp[6]'>Effacer</a></td>
					<td align=center width='500'><a href='inserer_partie.php?id=$indice&J1= $tmp[1]&J2= $tmp[3]&score= $tmp[5]&date= $tmp[6]'>Insérer</a></td>"; 			  
					
				}
						
				$indice = $indice - 1;		
			} 	

			echo "</table>";

			mysql_close();

?>

			<div id="message_expiration" style="display: none">
			<p>
			<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
			La session a expiré. veuillez vous reconnecter.
			</p>

			</div>
			
			<br/>
			<br/>
			<br/>
			<br/>
			<br/>

<!---------------------------------------------------------->	
<?php			
    include('include_pied_page.php');
	include('include_publicite.php');
	
	//echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>';
	
?>
<!---------------------------------------------------------->	
			</div>  <!-- contenu -->
<!---------------------------------------------------------->	
	</div>   <!-- main -->
<!---------------------------------------------------------->	

	<script type="text/javascript">
		call_update();
	</script>

</body>
</html>