<?php
	session_start();
	include('database.php');
	DB_connexion(); 
	
	/*if(!isset($_SESSION['logged']) )
	{		header ('Location: interdiction.php');
	}
	
	if($_SESSION['logged']== "no")
	{
		header ('Location: interdiction.php');
	}*/
	
	/*if(!empty($_POST) )
	{
		$_SESSION['sauvegarde_formulaire'] = $_POST ;
		$_SESSION['sauvegarde_metadata'] = $_FILES ;
		$page_actuelle = $_SERVER['PHP_SELF'] ;
		if(!empty($_SERVER['QUERY_STRING']))
		{
			$page_actuelle .= '?' . $_SERVER['QUERY_STRING'] ;
		}
     
		header('Location: ' . $page_actuelle);
		exit;
		
		//header ('Location: aaainterdiction.php');
	}

	if(isset($_SESSION['sauvegarde_formulaire']))
	{
				$_POST = $_SESSION['sauvegarde_formulaire'] ;
				$_FILES = $_SESSION['sauvegarde_metadata'] ;
				unset($_SESSION['sauvegarde_formulaire']);
				unset($_SESSION['sauvegarde_metadata']);
				
	}	*/
	
	
	
	/*$fichier = basename($_FILES['avatar']['name']);
			
	echo $fichier;
	$dossier = 'Avatar/';
	
	$fichier = strtr($fichier,
		'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
		'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy'); 
 
		//Expression régulière qui remplace tout ce qui n'est pas une lettre non accentuées ou un chiffre
		//dans $fichier par un tiret "-" et qui place le résultat dans $fichier.
		$fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier); 
	 
		//Si la fonction renvoie TRUE, c'est que ça a fonctionné...
		move_uploaded_file($_FILES['avatar']['tmp_name'], $dossier . $fichier) */
				
	$login = $_SESSION['login']; 
	$sql = "SELECT * FROM membres WHERE login = '".$login."' ";
 	$requete = mysql_query($sql);
	$result = mysql_fetch_assoc($requete);
		
	$champ_avatar = $result['avatar'];
		
					
				
	
?>

<!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">
<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_avatar{ display: inline;
			float: left;
			width: 932px;
		    height: 400px;
			/*background: #f8dbdb;*/
}

#bloc_menu_avatar{ 
				float: left;
				width: 320px;
				/*height: 350px;*/
				margin: 0px 0 0 0px;
				/*background: #38dbdb;*/
}

#bloc_change_avatar{ 
				float: left;
				width: 400px;
				height: 450px;
				/*height: 350px;*/
				margin: 0px 0px 0px 60px;
				/*background: #18dbdb;*/
}



	
</style>

<!-- diaporama -->
<link href="diaporama/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="diaporama/js/jquery.jDiaporama.js"></script>
<script type="text/javascript" src="diaporama/js/script.js"></script>

<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">
                &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 -->
<!---------------------------------------------------------->	
			
				<h2 class="retrait">Editer mes données personnelles </h2>
				
				
				<div id= "bloc_avatar">
				
							<div id= "bloc_menu_avatar">
									<div id="bloc_menu">
									<div id="leftcolumn">
									<div class="titlebar" style="margin-top: 12px">Menu</div>
									<ul class="ddmarkermenu">
									<li class="acceuil_tag"><a href="compte.php" title="aller à la section">Acceuil</a></li>
									<li class="information_tag"><a href="information.php" title="aller à la section">Informations</a></li>
									<li class="password_tag"><a href="password.php" title="aller à la section"> Mot de passe</a></li>
									<li class="avatar_tag_selected"><a href="avatar.php" title="aller à la section">Avatar</a></li>
									<li class="signature_tag"><a href="signature.php" title="aller à la section">Signature</a></li>
									</ul>
									</div>
									</div>
							</div>	
				
							
							<div id= "bloc_change_avatar">
							
									<div id="form_avatar">
						<!-- onsubmit="return valider_avatar(this)" -->  	
									<form method="post" enctype="multipart/form-data" id="form" action="upload.php"  onsubmit="return valider_avatar(this)" >
						 
									<h1>Changer votre Avatar</h1>
							
									<input type="hidden" name="valide_form" id="valide_form" value="" />
									<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
							
									<div>
									<label for="avatar">Choisir un avatar</label>
									<input type="file" name="fichier_choisi" id="fichier_choisi" /> 
									<!--<input type="file" name="avatar"> -->
									
									<span id="statut_avatar"></span>
									</div>

									<div>
									<label for="avatar">Avatar actif</label>
<?php	
									if($champ_avatar == '')
									{ echo '<img src="images/no_avatar.jpg">';
									}
									else { 
											$image = "Avatar/" .$champ_avatar;
?>						
									<img src="<?php echo $image; ?>";
<?php						
									}
?>
									<span id="statut_image_avatar"></span>
									</div>							
				
			
									<div>
									<input id="send" name="send" type="submit" value="Modifier"  />
									</div>
<?php
			if($_SESSION['message'] == "ok")
			   {	echo '<div id="message_traitement" style="display:block">Votre nouvel avatar est sauvegardé.</div>';
					$_SESSION['message'] = "none";
			   }
?>	
									</form>
							
									</div>		
						
							</div>
		

				</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>
