<?php
$title="Photos - www.serie6.com - l'univers de la BMW série 6 : M635, 635, 633, 628, 630";

//Marqueur Estat
$couleur = $_GET['couleur'];
if ($couleur) {
    $estatmark="photos_".$couleur;
    } else {
    	if ($auto) {
    	$estatmark="photos_".$auto;
    	} else {
    	$estatmark="index_photos";
		}
}

$estatgroup="photos";
    
include("includes/header.inc");

    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);

    //Tableau général de la page avec des \n pour espacer le code
    echo "<table border='0' cellpadding='0' cellspacing='1' style='border-collapse: collapse' bordercolor='#111111' width='750'>";
    echo "<tr><td valign='top' width='565'>";

    //Si une couleur est demandée
    if ($couleur) {
       $autos = mysql_query("SELECT famille_img,img_thumb,count(*) FROM images WHERE couleur='$couleur' GROUP BY famille_img ORDER BY famille_img ASC",$db);
       $myautos = mysql_fetch_array($autos);
       echo "<p><span class='postfoot'>Photos : $couleur</span></p>\n";
       echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' bgcolor='#345487'><tr><td>\n";
       echo "<table width='100%' border='0' cellspacing='0' cellpadding='3' class='maintitle' height='21'>\n";
       echo "<tr><td class='maintitle' height='21'>&nbsp;</td><td width='100%' class='maintitle' style='font-weight: bold' height='21'>\n";
       echo "<span style='font-weight: 400'>&nbsp;</span></td>\n";
       echo "</tr></table>\n</td></tr><tr><td class='mainbg'>\n";
       echo "<table width='100%' border='0' cellspacing='1' cellpadding='4'><tr>";

			 $cptautos=0;
							
       //Affichage des photos
       do {
            if ($cptautos %2==0) {
               echo "<td class='forum1' align='center' width='50%' valign='top'>\n";
               echo "<a href='photos.php3?auto=$myautos[0]'><img border='0' src='img_thumb/$myautos[1]'><br>Auto N° : $myautos[0] - Nb photos : $myautos[2]</a></td>\n";
               } else {
               echo "<td class='forum1' align='center' width='50%' valign='top'>\n";
               echo "<a href='photos.php3?auto=$myautos[0]'><img border='0' src='img_thumb/$myautos[1]'><br>Auto N° : $myautos[0] - Nb photos : $myautos[2]</a></td></tr>\n";
               }
							 
				  $cptautos=$cptautos+1;
          } while ($myautos = mysql_fetch_array($autos));

       //Remplit de bleu la dernière case, s'il y a un nb impair d'images
       if ($cptautos %2!=0) { echo "<td class='forum1' align='center' width='50%' valign='top'></td>"; }

       //Fin du tableau d'une auto
       echo "<tr><td class='mainfoot' colspan='2'><p align='right'><a href='#haut'>\n";
       echo "<img border='0' src='nav/nav_haut.gif' alt='Remonter' width='25' height='21'></a></td>\n";
       echo "</tr></table></td></tr></table>\n";

    } else {
		// S'il y a une auto

		if ($auto) {

       $autos = mysql_query("SELECT nom_proprio,img_thumb,img_moy,img_big,email,couleur,stockage FROM images WHERE famille_img='$auto' ORDER BY num_img ASC",$db);
       $myautos = mysql_fetch_array($autos);
       echo "<p><span class='postfoot'>Photos des autos de couleur : $myautos[5]</span></p>\n";

       echo "<br><table width='100%' border='0' cellspacing='1' cellpadding='0' bgcolor='#345487'><tr><td>\n";
       echo "<table width='100%' border='0' cellspacing='0' cellpadding='3' class='maintitle' height='21'>\n";
       echo "<tr><td class='maintitle' height='21'>&nbsp;</td><td width='100%' class='maintitle' style='font-weight: bold' height='21'>\n";
       echo "<span style='font-weight: 400'>Auto N° : $auto</span></td>\n";
       echo "</tr></table>\n</td></tr><tr><td class='mainbg'>\n";
       echo "<table width='100%' border='0' cellspacing='1' cellpadding='4'><tr>";

       $cptautos=0;

       //Affichage des photos
       do {
			 		//stockage de la photo
			 	 if ($myautos[6]=="1") {
				 		$stock="http://membres.lycos.fr/imge24/";
				 } else {
				 	 $stock="http://www.e24.free.fr/img_big/";
				 }
				 
         //La photo existe en taille moyenne ?
         if ($myautos[2]!="") {
            //Le tiret et le point
            $phtiret=strpos($myautos[2],"-");
            $phpoint=strpos($myautos[2],".");
            $phlongueur=$phpoint-$phtiret-1;
            $taillephotom=substr($myautos[2],$phtiret+1,$phlongueur);
            $photomoyenne="<br><img border='0' src='nav/nav_loupe.gif'><a href=\"javascript:ouvreZoomWindow('zoom.htm?$stock$myautos[2]','top=50,left=50')\">$taillephotom</a>";
						} else {
						$photomoyenne="";
         }
				 //La photo existe en taille grande ?
				 if ($myautos[3]!="") {
            //Le tiret et le point
            $phtiret=strpos($myautos[3],"-");
            $phpoint=strpos($myautos[3],".");
            $phlongueur=$phpoint-$phtiret-1;
            $taillephotog=substr($myautos[3],$phtiret+1,$phlongueur);
            $photogrande="&nbsp;<img border='0' src='nav/nav_loupe.gif'><a href=\"javascript:ouvreZoomWindow('zoom.htm?$stock$myautos[3]','top=50,left=50')\">$taillephotog</a>";
						} else {
						$photogrande="";
         }
            if ($cptautos %2==0) {
               echo "<td class='forum1' align='center' width='50%' valign='top'>\n";
               echo "<img border='0' src='img_thumb/$myautos[1]'>$photomoyenne$photogrande</td>\n";
               } else {
               echo "<td class='forum1' align='center' width='50%' valign='top'>\n";
               echo "<img border='0' src='img_thumb/$myautos[1]'>$photomoyenne$photogrande</td></tr>\n";
               }

         $cptautos=$cptautos+1;
          } while ($myautos = mysql_fetch_array($autos));

       //Remplit de bleu la dernière case, s'il y a un nb impair d'images
       if ($cptautos %2!=0) { echo "<td class='forum1' align='center' width='50%' valign='top'></td>"; }

       //Fin du tableau d'une auto
       echo "<tr><td class='mainfoot' colspan='2'><p align='right'><a href='#haut'>\n";
       echo "<img border='0' src='nav/nav_haut.gif' alt='Remonter' width='25' height='21'></a></td>\n";
       echo "</tr></table></td></tr></table>\n<br>";
		
		
		} else {
		
		
		
		
		
		
		
      //Pas de demande de couleur donc accueil du module photos
      echo "<p><span class='postfoot'>Galerie de Photos des séries 6</span></p>";
      echo "<p align='justify'>Consultez les photos groupées par couleur. 630 CS, 633 CSi, 628 CSi, 635 CSi, M635 CSi, M6, L6</p>";
			echo "<center><img src='nav/accueilphotos.jpg'></center>";
    }
}
    //Colonne séparatrice
    echo "</td><td width='15' valign='top'>&nbsp;</td><td valign='top' width='170'>";

    //Requête pour le tableau de navigation
    $couleurs = mysql_query("SELECT DISTINCT couleur,count(*),flag FROM images GROUP BY couleur ORDER BY flag,couleur ASC",$db);

    //Début du tableau de couleurs
    echo "<table border='0' cellpadding='4' cellspacing='1' style='border-collapse: collapse' bordercolor='#111111' width='100%' bgcolor='#345487'>\n";
    echo "<tr><td class='maintitle' height='16'><p align='center'>Palette</td></tr><tr><td width='100%' class='forum2'>\n";

          
    //Affichage avec lien hypertexte
		$lig=0;
    while ($mycoul = mysql_fetch_array($couleurs)) {

					if ($mycoul[2]=='1' & $lig==0) {
						 $lig=1;
						 echo "<br>";
						 }

          echo "<img border='0' src='nav/img_carre.gif' width='10' height='9'>&nbsp;";
          echo "<a href='photos.php3?couleur=$mycoul[0]'>$mycoul[0] - $mycoul[1] Photos</a><br>\n";
          }

    //Fonction recherche
    echo "</td></tr>";
    echo "<tr><td width='100%' class='mainfoot' height='13'></td></tr></table>\n";
   
	 	include("includes/recherche.inc");
	 
    //Fin du tableau principal de la page
    echo "</td></tr></table>\n";

    include("includes/footer_hvf.inc");
?>


