<?php	session_start(); 

		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";
	 	}

		//$email = "patrice.delpy@sfr.fr";
	
			// supprimer le condtion	
			$_SESSION['validation_commande'] = "non";
		
 			$var = $_GET['indice'];
		
		
			if($var == "1")
			  {	// echo '<body onLoad="alert(\'Element 1\')">'; 
				$email = $_SESSION['email'];
				//$connexion = mysql_connect("localhost", "root", "");
			        $connexion = mysql_connect($db_host,$db_user,$db_pass);
			        mysql_select_db($db_name, $connexion);
		 		$requete = "SELECT * FROM clients WHERE email='$email' ";
	   		        $result = mysql_query($requete);
		                $adr_facturation=mysql_fetch_array($result);
				$titre = "adresse de facturation";
				$nom = $adr_facturation['nom'];
				$votre_prenom = $adr_facturation['prenom'];
				$adresse = $adr_facturation['adresse'];
			  	$complement = $adr_facturation['complement'];
			  	$cp = $adr_facturation['cp'];
			        $ville = $adr_facturation['ville'];
			     
			     	$requete = "SELECT * FROM adresses_livraison WHERE email='$email' ";
	   		        $result = mysql_query($requete);
		                $data=mysql_fetch_array($result);
		  	  }
		
			

			if($var == "2")
			  {	// echo '<body onLoad="alert(\'Element 1\')">'; 
				$email = $_SESSION['email'];
				//$connexion = mysql_connect("localhost", "root", "");
			        $connexion = mysql_connect($db_host,$db_user,$db_pass);
			        mysql_select_db($db_name, $connexion);
		 		$requete = "SELECT * FROM adresses_livraison WHERE email='$email' ";
	   		        $result = mysql_query($requete);
		                $data=mysql_fetch_array($result);
				$titre = $data['titre1'];
				$nom = $data['nom1'];
				$votre_prenom = $data['prenom1'];
				$adresse = $data['adresse1'];
			  	$complement = $data['complement1'];
			  	$cp = $data['cp1'];
			        $ville = $data['ville1'];
		  	  }

		        if($var == "3")
		          {	//echo '<body onLoad="alert(\'Element 2\')">'; 
			    $email = $_SESSION['email'];
			    //$connexion = mysql_connect("localhost", "root", "");
			    $connexion = mysql_connect($db_host,$db_user,$db_pass);
			    mysql_select_db($db_name, $connexion);
		 	    $requete = "SELECT * FROM adresses_livraison WHERE email='$email' ";
	   		    $result = mysql_query($requete);
		            $data=mysql_fetch_array($result);
			    $titre = $data['titre2'];
			    $nom = $data['nom2'];
			    $votre_prenom = $data['prenom2'];
			    $adresse = $data['adresse2'];
			    $complement = $data['complement2'];
			    $cp = $data['cp2'];
			    $ville = $data['ville2'];
		          }
		 
		 
		        if($var != "1" && $var != "2" && $var != "3" )
		          {
		            //if(!isset($var))
		            //{   echo '<body onLoad="alert(\'Pas de selection\')">'; 
		
			    $titre = "";
			    $nom = "";
			    $votre_prenom = "";
			    $adresse = "";
		  	    $complement = "";
		  	    $cp = "";
		          $ville = "";

			  $email = $_SESSION['email'];			 
			  //$connexion = mysql_connect("localhost", "root", "");
		 	  $connexion = mysql_connect($db_host,$db_user,$db_pass);
		 	  mysql_select_db($db_name, $connexion);

			  $requete = "SELECT * FROM adresses_livraison WHERE email='$email' ";
			  $result = mysql_query($requete);
		          $data=mysql_fetch_array($result);
			  
			  /*if( $data['titre1'] == null && $data['titre2'] == null )
			    { $combinaison = 1;
			      echo '<body onLoad="alert(\'Combinaison : 1\')">'; 
			    }	
			  if( $data['titre1'] != null && $data['titre2'] == null )
			    { $combinaison = 12;
      			      echo '<body onLoad="alert(\'Combinaison : 13\')">'; 

			    }	  
  			  if( $data['titre1'] == null && $data['titre2'] != null )
			    { $combinaison = 13;
     			      echo '<body onLoad="alert(\'Combinaison : 13\')">'; 
	
			    }	  
   			  if( $data['titre1'] != null && $data['titre2'] != null )
			    { $combinaison = 123;
     			      echo '<body onLoad="alert(\'Combinaison : 123\')">'; 
	
			    }	  */
			
		       }    

	


		
	if(isset($_POST['valide']))
		 {  
				  //echo '<body onLoad="alert(\'un...\')">'; 
				  $_SESSION['choix_adresse_livraison'] =  $_POST['adresse'];
				  //print_r($_SESSION);
				  header('location: ../commande/livraison.php');
		 }

	


			    
			    
		


?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml" lang="fr"><head>

	
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Patrice Delpy</title>

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


<style type="text/css">
	.FormNormal { margin-top:10px; color:#444444; }	
	.FormMandatory { margin-top:10px; color:#B91900; }	
	.Formfield { width:180px; }	
	.AdrList td { height:30px; border-bottom:1px dotted #D4D4D4; color:#3E76BA; font-weight:bold; }
</style>


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




</head>

<body class="gecko">
		
        	<div id="page">

        
			<!-- header -->
            <div id="header">
				<h1><a name="top" href="/">Materiel.net</a></h1>
			</div>

                        
			<!-- nav -->
			
            <div id="nav">
				<div class="GHeadMenu">

<ul class="nav-line">

<li class=""><a href="../acceuil.php" style="" title="Accueil"><span>Accueil</span></a></li>

<li class="Bonnes affaires"><a href="../catalogue/affaires.php" style="background-image:url(/live/97759.gif);" title="Bonnes affaires"><span>affaires</span></a></li>

<li class="Gros menager"><a href="../catalogue/gros_menager.php" style="background-image:url(/live/97760.gif);" title="Gros menager"><span>Gros Ménager</span></a></li>

<li class="Petit menager"><a href="../catalogue/petit_menager.php" style="background-image:url(/live/97761.gif);" title=" Petit ménager"><span>PEtit Menager</span></a></li>

<li class="Images"><a href="../catalogue/image.php" style="background-image:url(/live/97762.gif);" title="Images"><span>Images</span></a></li>

<li class="Son"><a href="../catalogue/son.php" style="background-image:url(/live/97763.gif);" title="SON"><span>SON</span></a></li>

<li class="Video"><a href="../catalogue/video.php" style="background-image:url(/live/97764.gif);" title="Video"><span>Video</span></a></li>

<li class="Photo et camescope"><a href="../catalogue/photo_camescope.php" style="background-image:url(/live/97769.gif);" title="Photo / cam&eacute;scopes">Photo / cam&eacute;scopes</a></li>

<li class="Telephonie"><a href="../catalogue/telephonie.php" style="background-image:url(/live/97770.gif);" title="T&eacute;l&eacute;phonie">T&eacute;l&eacute;phonie </a></li>

</ul>
<ul class="nav-line">

<li class="art de la table"><a href="../catalogue/art_de_la_table.php" style="background-image:url(/live/97766.gif);" title="Art de la table"><span>Art de la table</span></a></li>

<li class="Accessoires"><a href="../catalogue/accessoires.php" style="background-image:url(/live/97767.gif);" title="Accessoires &amp;Consommables"><span>accessoires &amp;consommables</span></a></li>

<li class="Chauffage & clim"><a href="../catalogue/chauffage_clim.php" style="background-image:url(/live/97768.gif);" title="Chauffage &amp; Clim"><span>chauffage &amp; clim</span></a></li>

<li class="Automobiles"><a href="../catalogue/automobile.php" style="background-image:url(/live/97769.gif);" title="Automobiles"><span>Automobiles</span></a></li>

<li class="GPS"><a href="../catalogue/gps.php" style="background-image:url(/live/97770.gif);" title="GPS"><span> GPS</span></a></li>

<li class="MP3"><a href="../catalogue/mp3.php" style="background-image:url(/live/97771.gif);" title="AUDIO / MP3 / MP4"><span>AUDIO / MP3 / MP4</span></a></li></ul>
			  </div>
				<!--cached-->			</div>

            
            
            
            <!-- section :content -->
		  <div id="section">
	

<div id="pm-address">



<div style="float: left; width: 745px; margin-left: 5px; padding: 0px; display: inline;">

<table class="BskTitle" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<th align="left" height="40" valign="bottom" width="689">Adresse de livraison<hr></th>

<td rowspan="2" width="56">
<img src="AdrHeaderIco.gif" alt="" height="56" width="60"></td>
</tr>
<tr>

<td height="26" valign="top">
<a href="../acceuil.php">Accueil &gt;</a></td>
</tr>
</tbody></table>


<table style="margin-bottom: 10px;" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>

<td><img src="CmdProcessStart.gif" alt="" border="0" height="62" width="89"></td>
<td><img src="CmdProcess1On.gif" alt="" border="0" height="62" width="95"></td>

<td><a href="bravo.php">
<img src="CmdProcess2On.gif" alt="" border="0" height="62" width="98"></a></td>


<td><img src="CmdProcess3Off.gif" alt="" border="0" height="62" width="113"></td>
<td><img src="CmdProcess4Off.gif" alt="" border="0" height="62" width="115"></td>

<td><img src="CmdProcess5Off.gif" alt="" border="0" height="62" width="98"></td>

<td><img src="CmdProcessEnd.gif" alt="" border="0" height="62" width="30"></td>

</tr>
</tbody>
</table>

<form name="selection" action="choix_adresse.php" method="post" onsubmit="return verif();">
<table class="ToolBox2" border="0" cellpadding="0" cellspacing="0" width="730">
<tbody><tr>

<th width="5"><img src="../images/PromoBoxLeft.gif" alt="" height="22" width="5"></th>

<th align="left" width="720">Livraison de ma commande  
<img src="../images/PromoBoxArrow.gif" alt="" style="display: inline;" height="11" width="8"></th>

<th width="5"><img src="../images/PromoBoxRight.gif" alt="" height="22" width="5"></th>
</tr>

<tr>
                
<td class="Inner" colspan="3" align="center" valign="top" width="720">
<table style="margin-top: 10px;" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
					
<td style="padding: 5px 10px 10px;" align="left" valign="top">
<div>Si vous êtes un particulier vous avez également la possibilité, si vous le souhaitez, de vous faire livrer sur votre lieu 
de travail.</div>




<div class="FormNormal">Titre :</div>

<div>
<input name="titre" class="Formfield" id="titre" disabled="disabled" value="<?php echo($titre) ;?>" type="text" />
</div>

<div class="FormNormal">Société :</div>

<div>
<input name="societe" class="Formfield" id="societe" disabled="disabled" type="text">
</div>

<input type="hidden" name="valide" id="valide" value="">

<div class="FormMandatory">Nom :</div>

<div>
<input name="nom" class="Formfield" id="nom" disabled="disabled" value="<?php echo($nom) ;?>" type="text">
</div>

<div class="FormMandatory">Prénom :</div>


<div>
<input name="prenom" class="Formfield" id="prenom" disabled="disabled" value="<?php echo($votre_prenom) ;?>" type="text">
</div>

</td>
                              
<td style="padding-left: 20px; background: url(&quot;/images/gui/main/AdrSep.gif&quot;) no-repeat scroll 0% 0% 
transparent;" align="left" valign="top" width="200">

<div class="FormMandatory">Adresse :</div>

<div>
<input name="adresse" class="Formfield" id="adresse" disabled="disabled" maxlength="60" value="<?php echo($adresse) ;?>" type="text">
</div>

<div class="FormNormal">Complément d'adresse :</div>

<div>
<input name="complement" class="Formfield" id="complement" disabled="disabled" maxlength="60" value="<?php echo($complement) ;?>" type="text">
</div>

<div class="FormMandatory">Code postal :</div>

<div>
<input name="cp" class="Formfield" id="cp" disabled="disabled" maxlength="5" value="<?php echo($cp) ;?>" type="text">
</div>

<div class="FormMandatory">Ville :</div>

<div>
<input name="ville" class="Formfield" id="ville" disabled="disabled"  value="<?php echo($ville) ;?>"  type="text">
</div>

<div class="FormNormal">Infos complémentaires :</div>

<div>
<input class="Formfield" name="Extra" id="Extra" disabled="disabled" maxlength="35" type="text">
</div>


</td>
<td rowspan="2" style="vertical-align: top; text-align: center; background: url(../images/AdrAddrBg.jpg) no-repeat 
scroll 0% 0% transparent; height: 351px; width: 243px;">

<div style="width: 218px; height: 300px; margin-top: 30px; margin-left: 10px;">

<table class="AdrList" border="0" cellpadding="0" cellspacing="0" width="100%">

<tbody>

<tr>
<td align="left" width="85%"><label for="Addr1">Adresse de facturation</label></td>
<td align="center" width="15%">


<?php

echo "<input name=\"adresse\"  type=\"radio\" value=\"1\"   onClick=\"document.location.href = 'choix_adresse.php?indice=1' \"  ";

	if($var ==1) echo " checked=\"checked\"  >" ;
	  		echo " </td>
				</tr>
				
		";

?>




<?php
if($data['titre1'] != null)
  { 
  	
    echo "<tr>
	  <td align=\"left\" width=\"85%\"><label for=\"Addr2\">";
	  echo($data['titre1']); 
	  echo "</label></td>
                <td align=\"center\" width=\"15%\"> ";	
  	
    echo "<input name=\"adresse\"  type=\"radio\" value=\"2\" 
    onClick=\"document.location.href = 'choix_adresse.php?indice=2' \"  ";
    ?>
    <?php
    
	
	
       if($var ==2) echo " checked=\"checked\"  >" ;
	  		echo " </td>
				</tr>
				
		";
		
					
	echo "<input type=\"hidden\" name=\"valide\" id=\"valide\" value=\"\"> ";
																							  
																							  
}
?>



<?php

if($data['titre2'] != null)
  {
  	   echo "<tr>
	  <td align=\"left\" width=\"85%\"><label for=\"Addr3\">";
	  echo($data['titre2']); 
	  echo "</label></td>
                <td align=\"center\" width=\"15%\"> ";	
  	
  	echo "<input name=\"adresse\" type=\"radio\" value=\"3\" 
      onClick=\"document.location.href = 'choix_adresse.php?indice=3' \"  ";
   ?>
   <?php
     
         if($var ==3) echo " checked=\"checked\"  >" ;
		 
		echo " </td>
				</tr>
		";
	   
  }
?> 


 
</tr>
</tbody></table>

									</div>
								</td>
							</tr>


<tr>
<td style="padding: 5px 10px 10px;" align="left" valign="middle">
<div style="color: rgb(185, 25, 0); margin-bottom: 4px;">Destination de ma commande :</div>
										<select name="Pays" id="Pays">
										<option value="33" selected="selected">France Métropolitaine</option>
										<option value="3301">France DOM</option>
										<option value="3302">France TOM</option>
										<option value="32">Belgique</option>
										<option value="377">Monaco</option>
									</select>

<div style="color: rgb(136, 136, 136); margin-top: 4px;">Il est à noter que le choix des transporteur peut se restreindre en 
fonction de celle-ci</div>
									</td>
<td align="center" valign="top">
<img src="AdrMap.jpg" alt="" height="107" width="185"><br>
<br></td>
							</tr>
						</tbody></table>
					</td>
				</tr>
			</tbody></table>
			<div style="margin-top: 5px; width: 730px;">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tbody><tr>
						<td align="left" width="72%">&nbsp;
								
							</td>

<td style="text-align: right;" width="28%">
<input name="imageField" src="../images/btn_nextstep.gif" type="image"></td>
</tr>
</tbody></table>
</div>
</form>
	</div>


	<!-- Right Side -->
</div>
			</div>

			<!-- aside -->
			
            <div id="aside">
			<div id="search-bar">

			<form method="get" action="http://www.materiel.net/search.html">
			<input type="text" name="search" title="Recherche"/>
			<input type="submit" value="Rechercher" />
			</form>
			</div>
			

<?php
            
            //if(isset($_SESSION['connexion']))
		 if(isset($_SESSION['utilisateur_login']))
		   {
			    if($_SESSION['utilisateur_login']== "valide")
				  {         //echo '<body onLoad="alert(\'Identification par le panel.\')">'; 
							echo "
								<div id=\"account\" class=\"on\">
								<ul>
								<li class=\"icon\"><a href=\"../compte/compte.php\">Mon espace perso</a></li>
								<li class=\"logout\"><a href=\"../compte/logout.php\" title=\"Me d&eacute;connecter\">Me d&eacute;connecter</a></li>
								</ul>
								<div class=\"panel\">
								<ul class=\"buttons\">
								<li class=\"account\"><a href=\"../compte/compte.php\">Mon compte client</a></li>
								<li class=\"orders\"><a href=\"../commande/suivi_commande.php\">Mes commandes</a></li>
								<li class=\"addresses\"><a href=\"../compte/adresse_livraison.php\">Mon carnet d'adresse</a></li>
								<li class=\"repairs\"><a href=\"../compte/sav.html\">Mes retours S.A.V</a></li>
								<li class=\"parrainages\"><a href=\"../compte/parrainage.html\">Mes parrainages</a></li>
								<li class=\"refunds\"><a href=\"../compte/avoir.html\">Mes avoirs</a></li>
								<li class=\"carts\"><a href=\"../panier/shopping_liste.php\">Mes paniers</a></li>
								<li class=\"alertes\"><a href=\"../compte/alerte.html\">Mes alertes</a></li>
								</ul>
								</div>
								</div> ";
					
				     }
					 
					 else {
						 		echo "
						 		<div id=\"account\">
								<ul>
								<li class=\"icon\"><a href=\"../compte/login.php\">Mon espace perso</a></li>
								</ul>

								<div class=\"panel\">
								<form action=\"../compte/check.php\" method=\"post\">
								<dl>
								<dt><label for=\"login\">Votre nom utilisateur</label></dt>
								<dd><input name=\"login\" id=\"login\" maxlength=\"20\" type=\"text\"></dd>
								<dt><label for=\"pass\">Votre mot de passe</label></dt>
								<dd><input name=\"pass\" id=\"pass\" maxlength=\"10\" type=\"password\"></dd>
								</dl>
								<input value=\"Connexion\" type=\"submit\">
								<hr>
								<ul class=\"buttons\">
								<li class=\"register\"><a href=\"../compte/creation_compte.php\">Créer mon compte</a></li>
								<li class=\"password\"><a href=\"../compte/sendpass.php\">Mot de passe oublié ?</a></li>
								</ul>
								</form>
								</div>
								</div> ";
						 
					      }
					 
			}		 
			 


      
      $mess1 = $_SESSION['nb_article_panier'] ." " ."article" ; 
      if($_SESSION['nb_article_panier'] >1)
        { $mess1 = $mess1 ."s";
	}

      $mess2 = $_SESSION['total_ttc_panier'] ." &euro";	

	
?>

      <div id="basket" class="on">
      <ul>
      <li id="BasketProdCount"><a href="../panier/panier.php"><?php echo $mess1; ?></a></li>  
      <li id="BasketAmount"><?php echo $mess2; ?></li> 
      </ul>
      </div>
      </div> 


			<!-- footer -->
		</div>
	</body></html>