<?php
	session_start();
	error_reporting(0);
	include('database.php');
	DB_connexion(); 
	
	ini_set( 'display_errors', '0');
	error_reporting( 0 );
	
	/*if(!isset($_SESSION['logged']) )
	{		header ('Location: interdiction.php');
	}
	
	if($_SESSION['logged']== "no")
	{
		header ('Location: interdiction.php');
	}*/
	
////////////////////////////////////////////////////////////////	
	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']);		
	}	
////////////////////////////////////////////////////////////////	

	$score_defaut = 1000;
	
	if( isset($_POST['valide_form']) && $_POST['valide_form'] == "ok" )
	  {
			if (!empty($_POST["liste"]))
			{	$score_defaut = $_POST["score_defaut"];
				$tableau = $_POST["liste"];
				foreach ( $tableau as $key )
				{   $sql = "UPDATE joueurs SET score = '".$score_defaut."' WHERE nom = '".$key."' " ;
					$res = mysql_query($sql);
					//echo $key." - ";
				}
				$_SESSION['message'] = "ok";
			}
			
			$score_defaut = $_POST['score_defaut'];
	  }
	
?>
  
<!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_gestion { float: left;
					width: 831px; 
					padding: 50px 50px 25px 50px;
					}	
					
#navigation_tournoi{
					float: left;
					width: 910px; //885
					padding: 10px 0px 0px 10px;
		}

label
{   
	display: block;
	width: 150px;
	float: left;
	//padding: 28px;
}

select
{
width: 100px;
display: inline-block;
}

input {
 display: inline-block;
		}
		
</style>

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

function active_sauver()
{
	document.getElementById('send').disabled = false;
	document.getElementById('valide_form').value="ok";
}


/*function reponse(form4) {
if ( (form4.check1.checked) == true && (form4.check2.checked) == true && (form4.check3.checked) == false && (form4.check4.checked) == true)
{ alert("C'est la bonne réponse! ") }
else
{alert("Désolé, continuez à chercher.")}
} */

function setButtonState()
{
   
	var etat = document.getElementById("option").checked;
	
	if(etat == true)
	  { document.getElementById('send').disabled = false;
		document.getElementById('valide_form').value="ok";
	  }
	if(etat == false)
	  { document.getElementById('send').disabled = true;
		document.getElementById('valide_form').value="";
	  }  
	  
	
	var xmlhttp;
	if(window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				document.getElementById("bloc_selection").innerHTML=xmlhttp.responseText;
				
			}
		}
		
	url='validate.php?statut='+etat;
	//xmlhttp.open("GET","validate.php",true);
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
 
}


var mois = new Array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre");
var jours = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
date_du_jours = new Date () ;
annee = date_du_jours.getYear();
if (annee < 1000)
annee+=1900
Date = date_du_jours.getDate();

function setdate()
{
document.title="Patoche WEBSITE - 2014 - site en cours de développemment ...bienvenue le : "+jours[date_du_jours.getDay()]+" "+Date+" "+mois[date_du_jours.getMonth()]+" "+annee+""
}
if (document.all)
setdate()
else if (document.getElementById)
window.onload=setdate


</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_joueur_tag"><a href="ajouter_joueur.php" title="aller à la section">Nouveau</a></li>
				<li class="tournoi_partie_tag"><a href="partie.php" title="aller à la section">Partie</a></li>
				<li class="tournoi_classement_tag"><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="historique.php" title="aller à la section">Historique</a></li>
				<li class="tournoi_securite_tag_selected"><a href="admin.php" title="aller à la section">Admin</a></li>
				</ul>
			</div>
			
			
			<div id="bloc_gestion"> 
			
			
			<form method="POST" action="import_csv.php" enctype="multipart/form-data">
			<!-- On limite le fichier à 100Ko -->
			<input type="hidden" name="MAX_FILE_SIZE" value="100000">
			Fichier : <input type="file" name="fichier" size="30">
			<br>
			<br>
			<input type="submit" name="envoyer" value="Envoyer le fichier">
			<br>
			<br>
			<!--
			<select name="selection_algo"  >
			<option>Type 1</option>
			<option>Type 2</option>
			<option>Type 3</option>
			</select>
			-->
			</form>
			
			</div>

<!--			
			<div id="bloc_gestion"> 
			reset des scores
			
			<form name ="action" method="post" action="admin.php">
			<input type="hidden" name="valide_form" id="valide_form" value="" />
			Tous<input type="checkbox" id="option" name="option" value="valeur" onchange="setButtonState();" />
			
			<div id="bloc_selection">
			<select name='liste[]'  id='selection_multi' multiple onchange='active_sauver()' > <!-- onchange='gggggo()' -->
			<!--<option value="Australia" selected="selected">Australia</option> -->
			<?php
			/*
							$sql = "SELECT * FROM joueurs";
							$res = mysql_query($sql);
							while($val = mysql_fetch_array($res)) 
							{
								//echo "<option>".$val["nom"]."selected='selected'</option>\n";
								//echo '<option selected="selected">'.$val["nom"].'</option>\n';
								echo "<option>".$val["nom"]."</option>\n";
							}*/
			?>
<!--			
			</select>
			</div>
			
			Score par défaut: <input type="text" id="score_defaut" name="score_defaut" value = "<?php echo $score_defaut; ?>"><br>

			
			<div>
					<input id="send" name="send" type="submit" disabled value="Enregistrer"/>
			</div>
-->	

	
			<?php
				if($_SESSION['message'] == "ok")
				{	echo '<div id="message_traitement" style="display:block">Remise à 0 des scores .</div>';
					$_SESSION['message'] = "none";
				}
			?>		
			
			</form>
 
			</div>	
			
			<br/>
			<br/>
			<br/>
			<br/>
			<br/>

<!---------------------------------------------------------->	
<?php			
    include('include_pied_page.php');
	include('include_publicite.php');
?>
<!---------------------------------------------------------->	
			</div>  <!-- contenu -->
<!---------------------------------------------------------->	
	</div>   <!-- main -->
<!---------------------------------------------------------->	
	
	<script type="text/javascript">
		call_update()
	</script>

</body>
</html>


