<?php

	session_start();
	
	$_SESSION['database']="local";
	
	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";
	 }
	 
         $connexion = mysql_connect($db_host,$db_user,$db_pass); 
   	 mysql_select_db($db_name, $connexion);
   	 
   	 $email = $_GET['email'];
	 $nom = $_GET['nom'];
	 $prenom = $_GET['prenom'];
	 
	 $requete = "SELECT * FROM commandes WHERE email='$email' ";
	 $result = mysql_query($requete);
	 
	 $client = $prenom ." " .$nom ;
	 
?>	 


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

<title>Administration :: Patrice Delpy</title>

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

</head>

<body>

<div id="header"><h1>Administration</h1>

<div class="membre">Vous êtes connecté en tant qu'<b>admin</b></div>
</div>

			
		<div class="heading">Liste des commandes de <?php echo $client ; ?></div>
		<div id="list">
		<table class="list">
	        <tr>
	        <th align="center" width="1%">&nbsp;</th>
		<th width="*%" align="left">Client</th>
		<th width="*%" align="left">Montant total</th>
		<th width="*%" align="left">Date de commande</th>
		<th width="*%" align="left">Num Commande</th>
		<th width="*%" align="left">Paiement</th>
		
		<th width="1%">&nbsp;</th>
		</tr>
        

<?php

		while($data = mysql_fetch_assoc($result))
		     {
		     	
		     	$id = $data['id'];
			$infos = $data['date']. " " .$data['heure'];
			$montant = $data['total_ttc'];
		     	$reglement = $data['reglement'];
		     	
		     	
		   	echo "	
		       		<tr class=\"row2\" onmouseover=\"this.className='highlight'\" onmouseout=\"this.className='row2'\">
		       		<td align=\"center\"><a href=\"visu2.php?email=$email&id=$id\"><img src=\"view.png\" border=\"0\" alt=\"View\" title=\"Voir le detail des commandes\" /></a></td>

		       		
		       		<td align=\"left\" nowrap=\"nowrap\">$client</td>
		       		<td align=\"left\" nowrap=\"nowrap\">$montant</td>
		       		<td align=\"left\" nowrap=\"nowrap\">$infos</td>
		       		<td align=\"left\" nowrap=\"nowrap\">$reglement</td>
		       				       		
		       		
		       		<td align=\"left\" nowrap=\"nowrap\">&nbsp;a&nbsp;</td>
		       		<td align=\"left\" nowrap=\"nowrap\">&nbsp;a&nbsp;</td>
		       		<td align=\"center\" nowrap=\"nowrap\">
		       		<b class=\"blue\">Activ&eacute;</b></td>
		       		<td class=\"center\" width=\"1%\">
		       		<a href=\"?C1=CL&C2=CL&C3=delete_confirm&ID_Customer=168\">
		       		<img src=\"./images/delete.png\" alt=\"Effacer\" title=\"Effacer\" /></a>
		       		</td>
		       		</tr>  ";
		     }

			  
?>              
             
              </table>
		</div>

              
        


</body>
</html>