<?php

	session_start();
	include('config_inc.php'); 	
	include('menu.php'); 
	
	
	if($_SESSION['database']=="local")
	  {
	     $db_host    = "localhost";
	     $db_user   = "root";
	     $db_pass   = "";
     	     $db_name   = "boutique";

	 }
	
	if($_SESSION['database']=="public")
	  {
  	     $db_host    = "sql2";
   	     $db_user   = "analogde";
 	     $db_pass   = "rainbow";
    	     //$db_type   = "mysql";
	     $db_name   = "analogde";
	 }


	//$trouve_moi = ".";
  	// cherche la postion du '.'  
	//$position = strpos($image, $trouve_moi);
  	// enleve tout ce qui se trouve apres le '.' 
  	//$fichier_sans_extension = substr($image, 0, $position);

	  if( isset($_POST['selection_fichier']) && !empty($_POST['selection_fichier']) ) 
	   {    $nom = $_POST['selection_fichier'];
	   	 echo $nom ." boite";
	   	 //echo "<script>initialize($nom)</script>";
	   	 header("Location: dfsdfdf.php");
	   }	


?>

<script type="text/javascript" src="ajax_select.js"></script>
<script type="text/javascript" src="dynamic_select.js"></script>

<!--
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
		<html dir="ltr" lang="en">

		<head>

		<title>Administration - En cours de développement</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

  
		<link rel="stylesheet" href="default.css" type="text/css">

		<script type="text/javascript" src="ajax_select.js"></script>
		<script type="text/javascript" src="dynamic_select.js"></script>
  
		</head>
		
		<body>

		<div id="header"><h1>Administration</h1>
		<div class="membre">Vous Ãªtes connectÃ© en tant que <b><?php echo "cretin"; ?> </b></div>
		</div>		

-->		
		
		<div class="heading">Création d'une catégorie :</div>
		<div id="list">
		<table class="list">
	        <tr>
	        
	        <th align="center" width="1%">&nbsp;</th>
	        <th align="center" width="1%">&nbsp;</th>
	        <th align="center" width="1%">&nbsp;</th>
		<th width="*%" align="left">Nom du fichier</th>
		</tr>

<?php		
		$folder = "./";
		$dossier = opendir($folder);
	
		while($fichier = readdir($dossier))
	     	{
  	      		if($fichier != "." && $fichier != "..")
  	       		  {     
  	       		  	$extension=strrchr($fichier,'.');
				$extension=substr($extension,1) ;   
  	       		  	
  	       		  	if($extension == "txt")
    		 		  {	//$nomFichier = $folder."/".$Fichier;
    		 			//echo $nomFichier."<BR>";
		 			//echo $fichier."<BR>";
		 		
		 			echo "	
		       				<tr class=\"row2\" onmouseover=\"this.className='highlight'\" onmouseout=\"this.className='row2'\">
		       		
						<td align=\"center\">
						<a href=\"#\" onclick=\"initialize('$fichier')\">
						<img src=\"images/charger.png\" border=\"0\" alt=\"Charger\" title=\"Charger\" />
						</a>		
						</td>

						<td align=\"center\">
						<a href=\"edition.php\">
						<img src=\"images/update.png\" border=\"0\" alt=\"Editer\" title=\"Editer\" />
						</a>
						</td>
		
						<td align=\"center\">
						<a href=\"envoi_email.php\">
						<img src=\"images/delete.png\" border=\"0\" alt=\"Effacer\" title=\"Effacer\" />
						</a>
						</td>

		 				<td align=\"left\" nowrap=\"nowrap\">$fichier</td> " ;
		 		}
  	       		  }
            	}
		
		
		
?>		
		
<?php
//		<div class="menu">
//		<img src="./images/add.png" alt="" title="" width="12" height="12" />&nbsp;
//		<a href="">Cr&eacute;er une cat&eacute;gorie</a>&nbsp;
//		<a href="?C1=CA&C2=CA&C3=insert">Editer une cat&eacute;gorie</a>&nbsp;
?>		
		
		</div>

		<form id="dynsel" name="dynsel" method="post" action="creer_categorie.php">

  		<table width="743" border="0" cellspacing="0" cellpadding="8">
    		
		<br />
		<hr />
    		
    		<tr>
      		<td width="223">
        	<div align="center">
        	
          	<select name="select1" if="toolist"   size="10"  style="width:380px" style="height:250px"multiple onchange="selectoption();" >
            	<option></option>
          	</select>
        	</div></td>
		<td width="488">
         
		<input name="title" type="text" id="title"  value="" size="24"  />
		<input type="button" name="clear" value="X"  onclick='document.dynsel.title.value="";'  />
		<input type="button" name="add"  style="width:140px" value="Ajouter au select" onclick="addoption()"  />
		<br />
		<br  />
 
		<input type="button" name="del"  style="width:120px" value="Supprimer" onclick="deloption()"  />
		<span  style="margin-left:16px" >Supprimer l'option s&eacute;lectionn&eacute;e </span>

		<br />
		<br />

		<input type="button" name="del2"  style="width:120px" value="Remonter" onclick="moveup()"  />
		<span  style="margin-left:16px" >Remonter l'option dans la liste </span>
            
            	<br />
		<br />
            
		Nom du fichier :
		<input name="nom_fichier" type="text" id="nom_fichier"  value="" size="24"  /> 
		<br />
		<br  />
		
		Nom du la catégorie :
		<input name="nom_categorie" type="text" id="nom_categorie"  value="" size="24"  /> 
		<br />
		<br  />
		

		</td>
		</tr>
		
		
		</table>

  		<p>
  		<div align="center">
    		<input type="button" name="soumettre" value="Sauver" title="sauver" onclick="savelist(this)" />
    		</div>
  		</p>



		</form>

		<br />
		<hr />


</body></html>