<?php
	
/**********************************************/
function str_to_noaccent($str)
{
    $tmp = $str;
    $tmp = preg_replace('#Ç#', 'C', $tmp);
    $tmp = preg_replace('#ç#', 'c', $tmp);
    $tmp = preg_replace('#è|é|ê|ë#', 'e', $tmp);
    $tmp = preg_replace('#È|É|Ê|Ë#', 'E', $tmp);
    $tmp = preg_replace('#à|á|â|ã|ä|å#', 'a', $tmp);
    $tmp = preg_replace('#@|À|Á|Â|Ã|Ä|Å#', 'A', $tmp);
    $tmp = preg_replace('#ì|í|î|ï#', 'i', $tmp);
    $tmp = preg_replace('#Ì|Í|Î|Ï#', 'I', $tmp);
    $tmp = preg_replace('#ð|ò|ó|ô|õ|ö#', 'o', $tmp);
    $tmp = preg_replace('#Ò|Ó|Ô|Õ|Ö#', 'O', $tmp);
    $tmp = preg_replace('#ù|ú|û|ü#', 'u', $tmp);
    $tmp = preg_replace('#Ù|Ú|Û|Ü#', 'U', $tmp);
    $tmp = preg_replace('#ý|ÿ#', 'y', $tmp);
    $tmp = preg_replace('#Ý#', 'Y', $tmp);
    return ($tmp);
}
/**********************************************/
function mise_en_forme_date($date)
{
		list($jour, $mois, $annee) = explode('/', $date);
		$timestamp = mktime (0, 0, 0, $mois, $jour, $annee);
		return($timestamp);
}
/***********************************************/
function stockage_joueurs_DB($donnees)
{
			$nb_ligne =  count($donnees);
			
			for ($i=0; $i < $nb_ligne; $i++)
			{

				$prenom = $donnees[$i];
				$partie = 0;
				$prior = 0;
			
				if($prenom == "henrique")
				{
					$elo = 1300;
				}
				if($prenom == "fabien")
				{
					$elo = 1300;
				}
				if($prenom == "dominique")
				{
					$elo = 1100;
				}
				if($prenom == "remy")
				{
					$elo = 1100;
				}
				if($prenom == "stephaner")
				{
					$elo = 1000;
				}
				if($prenom == "laurent")
				{
					$elo = 1200;
				}
				if($prenom == "damien")
				{
					$elo = 1000;
				}
				if($prenom == "franckdc")
				{
					$elo = 1000;
				}
				if($prenom == "franckv")
				{
					$elo = 1000;
				}
				if($prenom == "bordi")
				{
					$elo = 1000;
				}
				if($prenom == "amokrane")
				{
					$elo = 1050;
				}
				if($prenom == "olivier")
				{
					$elo = 1250;
				}
				if($prenom == "stephaneb")
				{
					$elo = 1000;
				}
				if($prenom == "patrick")
				{
					$elo = 1000;
				}
				if($prenom == "bertrand")
				{
					$elo = 950;
				}
				if($prenom == "emile")
				{
					$elo = 850;
				}
				if($prenom =="joel")
				{
					$elo = 950;
				}
				if($prenom == "alexandre")
				{
					$elo = 750;
				}
				
				$sql = " INSERT INTO classement ";
				$sql = $sql . " (joueur, elo, parties, prior, initial) VALUES ";
				$sql = $sql . " ('$prenom', '$elo','$partie','$prior', '$elo') ";
				//echo $sql;
				//echo "<br>";
				$result = mysql_query($sql);
				if (!$result)
				{ 
					echo("ERROR: " . mysql_error() . "\n$SQL\n");	
				}
					
			}	
}		

/***********************************************/

?>

