<?php
$title="Petites annonces - www.serie6.com - l'univers de la BMW série 6 : M635, 635, 633, 628, 630";

//Marqueur Estat
$rubrique = $_GET['rubrique'];
if ($rubrique) {
    $estatmark="pa_".$rubrique;
    } else {
    $estatmark="index_pa";
}
$estatgroup="pa";
    
include("includes/header_pa.inc");

    //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 rubrique est demandée
    switch ($rubrique) {
		
				/*******************
				*  AUTO COMPLETE   *
				*******************/
		
				case 'auto':
				
//S'il y a soumission du formulaire
if ($submit) {
			
			//Traitement des options c1
			if ($c1!='') {
			 $option=$c1;
			 $cpt=1;
			  }
			if ($c2!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c2;
			 			} else {
			 			$option=$c2;
			 			$cpt=1;
				}
			}
			if ($c3!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c3;
			 			} else {
			 			$option=$c3;
			 			$cpt=1;
				}
			}
			if ($c4!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c4;
			 			} else {
			 			$option=$c4;
			 			$cpt=1;
				}
			}			
			if ($c5!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c5;
			 			} else {
			 			$option=$c5;
			 			$cpt=1;
				}
			}					
			if ($c6!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c6;
			 			} else {
			 			$option=$c6;
			 			$cpt=1;
				}
			}
			if ($c7!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c7;
			 			} else {
			 			$option=$c7;
			 			$cpt=1;
				}
			}
			if ($c8!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c8;
			 			} else {
			 			$option=$c8;
			 			$cpt=1;
				}
			}								
			if ($c9!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c9;
			 			} else {
			 			$option=$c9;
			 			$cpt=1;
				}
			}			
			if ($c10!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c10;
			 			} else {
			 			$option=$c10;
			 			$cpt=1;
				}
			}
			if ($c11!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$c11;
			 			} else {
			 			$option=$c11;
			 			$cpt=1;
				}
			}

			if ($fboite=='- Choisissez -') {
				 $fboite1='';
				 } else {
				 $fboite1=$fboite;
				 }
			if ($fcouleur=='- Choisissez -') {
				 $fcouleur1='';
				 } else {
				 $fcouleur1=$fcouleur;
				 }
			if ($finterieur=='- Choisissez -') {
				 $finterieur1='';
				 } else {			
				 $finterieur1=$finterieur;
				 }
	
			//Insertion dans la base
    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);
			$nlcomm=nl2br($fcomm);
  		$sql = "INSERT INTO annonces (serie,modele,annee,boite,km,couleur,interieur,prem_main,options,commentaires,prix,pseudo,telephone,email,ville,origine,dateinscript) VALUES ('$master','$slave','$fmill','$fboite1','$fkm','$fcouleur1','$finterieur1','$fpm','$option','$nlcomm','$fprix','$name','$phone','$email','$fville','$forigine',now())";
			$result = mysql_query($sql);
			
			// DECONNEXION MYSQL
			mysql_close($db);

			echo "<p><span class='postfoot'>Auto complète : Annonce envoyée !</span></p>";
			echo "<p align='justify'>Cette annonce paraîtra très bientôt sur ce site. La validité de cette annonce est de 3 mois. Pour retirer cette annonce, merci d'envoyer un mail à";
			echo "&nbsp;<a href='mailto:sharknose@serie6.com?subject=Retirer ma P.A.'>sharknose@serie6.com</a></p>";
			echo "<p align='center'><span class='postfoot'>Saisie d'une nouvelle petite annonce :</span><br><br>";
			echo "<a href='pa.php3?rubrique=auto'>Auto complète</a><br><a href='pa.php3?rubrique=piece'>Pièces, documentation, autres...</a></p>";

//Si pas de soumission de formulaire
} else{

//Affichage du formulaire
?>
<p align="justify">Utilisez ce formulaire pour proposer une auto complète ou 
pour pièces. Pour les pièces détachées ou d'autres annonces, <a href="pa.php3?rubrique=piece">veuillez cliquer 
ici.</a></p>
<p align="justify">Ce formulaire peut-être utilisé pour les séries 6 ainsi que 
les séries approchantes. La rubrique &quot;Autres&quot; est réservée pour les séries 
spéciales comme les Alpina, Hartge... Pour des raisons de vie privée et une meilleure 
lisibilité, les annonces seront validées avant la mise en ligne.</p>
<p align="justify">(*) La zone Pseudo/Nom est obligatoire, ainsi que le Téléphone ou l'Email</p>
<table width="80%" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">

  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="3" class='maintitle' height="21">
        <tr> 
          <td class="maintitle" height="21">&nbsp;</td>
          <td width="100%" class="maintitle" style="font-weight: bold" height="21">
          <span style="font-weight: 400">Formulaire pour une auto complète</span></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td class='mainbg'> 
      <table border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111">
        <tr> 
          <td class="forum2" width="40%">
          Série</td>
          <td class="forum2" width="60%" colspan="2">
          <form name="drops" method="post" action="" onsubmit="return VerificationFormulaire(this)">

          <select name="master" size=1 onchange="changeList(this)" class="input1">
					<option value="Série 6 E24">Série 6 E24 
				<option value="Série E3">Série E3
				<option value="Série E9">Série E9
				<option value="Série 5 E12">Série 5 E12
				<option value="Série 7 E23">Série 7 E23
				<option value="Série 8 E31">Série 8 E31
				<option value="Autre">Autre...
					</select></td>
        </tr>
        <tr> 
          <td class="forum2" width="40%">
          Modèle</td>
          <td class="forum2" width="60%" colspan="2">
          <select name="slave" size=1 class="input1">
					<option>- Choisissez -
					</select></td>
        </tr>
        <tr> 
          <td class="forum2" width="40%">
          Millésime</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="fmill" size="5" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Boîte de vitesses</td>
          <td class="forum2" width="60%" colspan="2">
          <select size="1" name="fboite" class="input1">
      <option>- Choisissez -</option>
      <option>Manuelle 5 rapports</option>
      <option>Manuelle 5 Sport</option>
      <option>Manuelle 4 rapports</option>
      <option>Automatique 3 rapports</option>
      <option>Automatique 4 rapports</option>
   </select></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Kilométrage</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="fkm" size="16" class="input1"> (sans espaces)</td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Couleur</td>
          <td class="forum2" width="60%" colspan="2">
          <select size="1" name="fcouleur" class="input1">
          <option>- Choisissez -</option>
          <option>Anthracite</option>
          <option>Blanche</option>
          <option>Bleue</option>
          <option>Grise</option>
          <option>Marron</option>
          <option>Noire</option>
          <option>Or</option>
          <option>Rouge</option>
          <option>Verte</option>
          <option>Autre</option>
          </select></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Intérieur</td>
          <td class="forum2" width="60%" colspan="2">
          <select size="1" name="finterieur" class="input1">
          <option>- Choisissez -</option>
          <option>Tissu</option>
          <option>Cuir</option>
          <option>Recaro tissu</option>
          <option>Recaro cuir</option>
          </select></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Première main</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="checkbox" name="fpm" value="Oui"> Oui</td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Options</td>
          <td class="forum2" width="30%" valign="top">
      <input type="checkbox" name="c1" value="Climatisation">Climatisation<b><br>
      <input type="checkbox" name="c2" value="Alarme"></b>Alarme<br>
      <input type="checkbox" name="c3" value="Toit Ouvrant">Toit Ouvrant<br>
      <input type="checkbox" name="c4" value="Verrouillage Centralisé">Verrou. centralisé<br>
      <input type="checkbox" name="c5" value="Vitres Electriques">Vitres électriques<br>
      <input type="checkbox" name="c6" value="Jantes Alu">Jantes alu</td>
          <td class="forum2" width="30%" valign="top">
      <input type="checkbox" name="c7" value="Auto-Radio K7">Auto-radio K7<br>
      <input type="checkbox" name="c8" value="Auto-Radio CD">Auto-radio CD<br>
      <input type="checkbox" name="c9" value="Changeur de CD">Chargeur de CD<br>
      <input type="checkbox" name="c10" value="Rétroviseurs Electriques">Rétros électriques<br>
      <input type="checkbox" name="c11" value="Crochet d'attelage">Crochet d'attelage</td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Commentaires</td>
          <td class="forum2" width="60%" colspan="2">
          <textarea rows="8" name="fcomm" cols="45" class="input1"></textarea></td>
        </tr>
                    
        <tr>
          <td class="forum2" width="40%">
          Prix</td>
          <td class="forum2" width="60%" colspan="2">
      <input type="text" name="fprix" size="12" class="input1"> (en euros, sans espaces)
			<input TYPE="hidden" VALUE="rubrique" NAME="auto"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Nom ou pseudo *</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="name" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Téléphone *</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="phone" size="20" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          EMail *</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="email" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Ville ou région</td>
          <td class="forum2" width="60%" colspan="2">
          <input type="text" name="fville" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Origine de l'annonce</td>
          <td class="forum2" width="60%" colspan="2">
          <select size="1" name="forigine" class="input1">
      <option value="Propriétaire">C'est moi qui vends cette pièce
      <option value="Internet">J'ai vu cette annonce sur internet
      <option value="Journal">Cette anonce provient d&#39;un journal, magazine...
      <option value="Autre">Cette annonce provient d'une autre source
   </select></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="591" colspan="3" align="center">
          <input type="submit" value="Envoyer" name="submit" class="input1"><input type="reset" value="Effacer tout" name="B2" class="input1"></td>
       </form></tr>
                    
        <tr> 
          <td class="mainfoot" align="left" colspan="3" width="591">
          <a href="#haut">
          <img border="0" src="nav/nav_haut.gif" align="right" alt="Remonter" width="25" height="21"></a></td>
        </tr>
                    
      </table>
    </td>
    </tr>
</table>
  <?php

} // end if
	 	break;
				
				/*******************
				* PIECES DETACHEES *
				*******************/
			
			 	case 'piece':

//S'il y a soumission du formulaire
if ($submit) {
			//Insertion dans la base
    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);
			$nlcomm=nl2br($fcomm);
  		$sql = "INSERT INTO annonces (modele,commentaires,prix,pseudo,telephone,email,ville,origine,dateinscript) VALUES ('$ftitre','$nlcomm','$fprix','$name','$phone','$email','$fville','$forigine',now())";
			$result = mysql_query($sql);
			
			// DECONNEXION MYSQL
			mysql_close($db);

			echo "<p><span class='postfoot'>Pièces détachées, documentation, autres : Annonce envoyée !</span></p>";
			echo "<p align='justify'>Cette annonce paraîtra très bientôt sur ce site. La validité de cette annonce est de 3 mois. Pour retirer cette annonce, merci d'envoyer un mail à";
			echo "&nbsp;<a href='mailto:sharknose@serie6.com?subject=Retirer ma P.A.'>sharknose@serie6.com</a></p>";
			echo "<p align='center'><span class='postfoot'>Saisie d'une nouvelle petite annonce :</span><br><br>";
			echo "<a href='pa.php3?rubrique=auto'>Auto complète</a><br><a href='pa.php3?rubrique=piece'>Pièces, documentation, autres...</a></p>";

//Si pas de soumission de formulaire
} else{

//Affichage du formulaire
?>
				
<p align="justify">Utilisez ce formulaire pour proposer des pièces détachées ou d'autres annonces. 
Pour une auto complète, <a href="pa.php3?rubrique=auto">veuillez cliquer 
ici.</a></p>
<p align="justify">Pour des raisons de vie privée et une meilleure 
lisibilité, les annonces seront validées avant la mise en ligne.</p>
<p align="justify">(*) La zone Pseudo/Nom est obligatoire, ainsi que le Téléphone ou l'Email</p>
<table width="80%" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="3" class='maintitle' height="21">
        <tr> 
          <td class="maintitle" height="21">&nbsp;</td>
          <td width="100%" class="maintitle" style="font-weight: bold" height="21">
          <span style="font-weight: 400">Formulaire pour des pièces détachées, 
          documentation...</span></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td class='mainbg'> 
      <table border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111">
        <tr>
				  <form name="drops" method="post" action="" onsubmit="return VerificationFormulaire(this)">
          <td class="forum2" width="40%">
          Titre</td>
          <td class="forum2" width="60%">
          <input type="text" name="ftitre" size="45" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Texte détaillé de l'annonce</td>
          <td class="forum2" width="60%">
          <textarea rows="8" name="fcomm" cols="45" class="input1"></textarea></td>
        </tr>
                    
        <tr>
          <td class="forum2" width="40%">
          Prix</td>
          <td class="forum2" width="60%">
      <input type="text" name="fprix" size="12" class="input1"> (en euros, sans espaces)
			<input TYPE="hidden" VALUE="rubrique" NAME="piece"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Nom ou pseudo *</td>
          <td class="forum2" width="60%">
          <input type="text" name="name" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Téléphone *</td>
          <td class="forum2" width="60%">
          <input type="text" name="phone" size="20" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          EMail *</td>
          <td class="forum2" width="60%">
          <input type="text" name="email" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Ville ou région</td>
          <td class="forum2" width="60%">
          <input type="text" name="fville" size="34" class="input1"></td>
        </tr>
                    
        <tr> 
          <td class="forum2" width="40%">
          Origine de l'annonce</td>
          <td class="forum2" width="60%">
          <select size="1" name="forigine" class="input1">
      <option value="Propriétaire">C'est moi qui vends cette pièce
      <option value="Internet">J'ai vu cette annonce sur internet
      <option value="Journal">Cette anonce provient d&#39;un journal, magazine...
      <option value="Autre">Cette annonce provient d'une autre source
   </select></td>
        </tr>
				                    
        <tr> 
          <td class="forum2" width="591" colspan="2" align="center">
          <input type="submit" value="Envoyer" name="submit" class="input1"><input type="reset" value="Effacer tout" name="B2" class="input1"></td>
       </form></tr>
                    
        <tr> 
          <td class="mainfoot" align="left" colspan="2" width="591">
          <a href="#haut">
          <img border="0" src="nav/nav_haut.gif" align="right" alt="Remonter" width="25" height="21"></a></td>
        </tr>
                    
      </table>
    </td>
    </tr>
</table>
  <?php

} // end if				
			 	break;
				
			 case 'lire_autos':

				/*******************
				* LECTURE AUTOS    *
				*******************/

    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);
		
		echo "<p><span class='postfoot'>Bienvenue sur les Petites-Annonces !</span></p>";
		echo "<p align='justify'>Vous trouverez ici toutes les annonces qui gravitent autour de la série 6. ";
		echo "Utilisez le panneau de droite pour écrire votre propre annonce. Sont autorisées les séries 6 E24 ainsi que les autos dont elle prend la suite : les berlines E3 ";
		echo "et coupés E9 des années 70, les séries E12 et E23 avec lesquelles elle partage quelques pièces, et celle qui prit sa difficile succession, la série 8 (E31) !</p>";
		echo "<p>Les annonces sont visibles pendant trois mois :</p>";
		
		$result = mysql_query("SELECT serie,modele,annee,boite,km,couleur,interieur,prem_main,options,commentaires,prix,pseudo,telephone,email,ville,origine,date_format(dateinscript,'%d/%m/%Y') FROM annonces WHERE TO_DAYS(NOW()) - TO_DAYS(dateinscript) <90 AND flag='1' AND serie!='' ORDER BY serie ASC,dateinscript DESC",$db);
		$cpt100=0;
		$serieactuelle="toto";
		while ($myrow = mysql_fetch_row($result)) {
					if ($myrow[2]=='' && $myrow[10]=='') {$titre=$myrow[1];}
					if ($myrow[2]=='' && $myrow[10]!='') {$titre=$myrow[1].", ".$myrow[10]." €";}	 
					if ($myrow[2]!='' && $myrow[10]=='') {$titre=$myrow[1].", ".$myrow[2];}	 						 						
					if ($myrow[2]!='' && $myrow[10]!='') {$titre=$myrow[1].", ".$myrow[2].", ".$myrow[10]." €";}
					
			//Traitement des options
			if ($myrow[5]!='') {
			 $option=$myrow[5];
			 $cpt=1;
			  }
			if ($myrow[6]!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', intérieur '.$myrow[6];
			 			} else {
			 			$option='Intérieur '.$myrow[6];
			 			$cpt=1;
				}
			}
			if ($myrow[4]!='0') {
				 if ($cpt==1) {
			 	 		$option=$option.', '.$myrow[4].' km';
			 			} else {
			 			$option=$myrow[4].' km';
			 			$cpt=1;
				}
			}
			if ($myrow[3]!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', boîte '.$myrow[3];
			 			} else {
			 			$option='Boîte '.$myrow[3];
			 			$cpt=1;
				}
			}			
	
			if ($myrow[7]!='') {
				 if ($cpt==1) {
			 	 		$option=$option.', première main';
			 			} else {
			 			$option='Première main';
			 			$cpt=1;
				}
			}		
				
		//Coordonnées		
			/*if ($myrow[12]!='') {
			 $option1='- '.$myrow[12];
			 $cpt=1;
			  }*/
			if ($myrow[13]!='') {
			 		$option1='<a href=\'mailto:'.$myrow[13].'\'>'.$myrow[13].'</a>';
				} else {
					$option1='';
			}
			/*if ($myrow[14]!='') {
				 if ($cpt==1) {
			 	 		$option2=$option1.' - ('.$myrow[14].')';
			 			} else {
			 			$option2='- ('.$myrow[14].')';
			 			$cpt=1;
				}
			}		
						*/
//Même série, le tableau continue
if ($serieactuelle==$myrow[0]) {
		echo "<tr><td class='titlemedium' align='center'><p align='left'><span lang='fr'>$titre</span></td></tr>";
		echo "<tr><td class='forum2'><p align='left'>$option<br>";
		echo "$myrow[8]<br>$myrow[9]<br>$myrow[11] $myrow[12] $option1 $myrow[14]<br>";
		echo "Date : $myrow[16], Origine : $myrow[15]</td></tr>";

//Nouvelle série
} else {
		if ($cpt100!=0) {

		echo "<tr><td class='mainfoot'><a href='#haut'><img border='0' src='nav/nav_haut.gif' align='right' alt='Remonter' width='25' height='21'></a>";
		echo "</td></tr></table></td></tr></table>";
		echo "&nbsp;<br>";
		}
		//Début du tableau des annonces
		echo "<table width='90%' border='0' cellspacing='1' cellpadding='0' bgcolor='#345487' align='center'><tr><td>"; 
		echo "<table width='100%' border='0' cellspacing='0' cellpadding='3' class='maintitle' height='21'><tr>"; 
		echo "<td class='maintitle' height='21'>&nbsp;</td><td width='100%' class='maintitle' style='font-weight: bold' height='21'>";
		echo "<span style='font-weight: 400'>$myrow[0]</span></td></tr></table></td></tr>";
		echo "<tr><td class='mainbg'><table width='100%' border='0' cellspacing='1' cellpadding='4' style='border-collapse: collapse' bordercolor='#111111'>";
		echo "<tr><td class='titlemedium' align='center'><p align='left'><span lang='fr'>$titre</span></td></tr><tr>";
		echo "<td class='forum2'><p align='left'>$option<br>";
		echo "$myrow[8]<br>$myrow[9]<br>$myrow[11] $myrow[12] $option1 $myrow[14]<br>";
		echo "Date : $myrow[16], Origine : $myrow[15]</td></tr>";


$serieactuelle=$myrow[0];
}

$option="";
$cpt100=$cpt100+1;	
//Fin du while		
}
		echo "<tr><td class='mainfoot'><a href='#haut'><img border='0' src='nav/nav_haut.gif' align='right' alt='Remonter' width='25' height='21'></a>";
		echo "</td></tr></table></td></tr></table>";
		echo "&nbsp;<br>";
		echo "Consulter aussi les annonce de <a href='pa.php3?rubrique=lire_pieces'>pièces, documentation, autres...</a>";		
		
		break;
		

			 case 'lire_pieces':

				/*******************
				* LECTURE PIECES   *
				*******************/

    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);
		
		echo "<p><span class='postfoot'>Bienvenue sur les Petites-Annonces !</span></p>";
		echo "<p align='justify'>Vous trouverez ici toutes les annonces qui gravitent autour de la série 6. ";
		echo "Utilisez le panneau de droite pour écrire votre propre annonce. Sont autorisées les séries 6 E24 ainsi que les autos dont elle prend la suite : les berlines E3 ";
		echo "et coupés E9 des années 70, les séries E12 et E23 avec lesquelles elle partage quelques pièces, et celle qui prit sa difficile succession, la série 8 (E31) !</p>";
		echo "<p>Les annonces sont visibles pendant trois mois :</p>";
		
		$result = mysql_query("SELECT modele,commentaires,prix,pseudo,telephone,email,ville,origine,date_format(dateinscript,'%d/%m/%Y') FROM annonces WHERE serie='' AND flag='1' AND TO_DAYS(NOW()) - TO_DAYS(dateinscript) <90 ORDER BY dateinscript DESC",$db);

		//Début du tableau des annonces
		echo "<table width='90%' border='0' cellspacing='1' cellpadding='0' bgcolor='#345487' align='center'><tr><td>"; 
		echo "<table width='100%' border='0' cellspacing='0' cellpadding='3' class='maintitle' height='21'><tr>"; 
		echo "<td class='maintitle' height='21'>&nbsp;</td><td width='100%' class='maintitle' style='font-weight: bold' height='21'>";
		echo "<span style='font-weight: 400'>Pièces, documentation, autres...</span></td></tr></table></td></tr>";
		echo "<tr><td class='mainbg'><table width='100%' border='0' cellspacing='1' cellpadding='4' style='border-collapse: collapse' bordercolor='#111111'>";

		while ($myrow = mysql_fetch_row($result)) {
				
		//Coordonnées		
			if ($myrow[4]!='') {
			 $option1='- '.$myrow[4];
			 $cpt=1;
			  }
			if ($myrow[5]!='') {
				 if ($cpt==1) {
			 	 		$option1=$option1.' - <a href=\'mailto:'.$myrow[5].'\'>'.$myrow[5].'</a>';
			 			} else {
			 			$option1='- <a href=\'mailto:'.$myrow[5].'\'>'.$myrow[5].'</a>';
			 			$cpt=1;
				}
			}
			if ($myrow[6]!='') {
				 if ($cpt==1) {
			 	 		$option1=$option1.' - ('.$myrow[6].')';
			 			} else {
			 			$option1='- ('.$myrow[6].')';
			 			$cpt=1;
				}
			}		
			if ($myrow[2]!='') {
			$titre=$myrow[0].' - '.$myrow[2].' €';
			} else {
			$titre=$myrow[0];
			}
						
		echo "<tr><td class='titlemedium' align='center'><p align='left'><span lang='fr'>$titre</span></td></tr><tr>";
		echo "<td class='forum2'><p align='left'>$myrow[1]<br>";
		echo "$myrow[3] $option1<br>";
		echo "Date : $myrow[8], Origine : $myrow[7]</td></tr>";
		$option1='';	

//Fin du while		
}
		echo "<tr><td class='mainfoot'><a href='#haut'><img border='0' src='nav/nav_haut.gif' align='right' alt='Remonter' width='25' height='21'></a>";
		echo "</td></tr></table></td></tr></table>";
		echo "&nbsp;<br>";
		echo "Consulter aussi les annonce d'<a href='pa.php3?rubrique=lire_autos'>Autos complètes</a>";		
		
		break;

		
		default:			 

				/*******************
				* ACCUEIL P.A.     *
				*******************/
    $db = mysql_connect("localhost", "ju30891", "bjm7pc9f");
    mysql_select_db("ju30891",$db);

    $lignes = mysql_query("SELECT count(*) FROM annonces WHERE serie!='' AND TO_DAYS(NOW()) - TO_DAYS(dateinscript) <90 AND flag='1'",$db);
    $lignes1 = mysql_query("SELECT count(*) FROM annonces WHERE serie='' AND TO_DAYS(NOW()) - TO_DAYS(dateinscript) <90 AND flag='1'",$db);
		$myrow = mysql_fetch_row($lignes);
		$myrow1 = mysql_fetch_row($lignes1);

		echo "<p><span class='postfoot'>Bienvenue sur les Petites-Annonces !</span></p>";
		echo "<p align='justify'>Vous trouverez ici toutes les annonces qui gravitent autour de la série 6. ";
		echo "Utilisez le panneau de droite pour écrire votre propre annonce. Sont autorisées les séries 6 E24 ainsi que les autos dont elle prend la suite : les berlines E3 ";
		echo "et coupés E9 des années 70, les séries E12 et E23 avec lesquelles elle partage quelques pièces, et celle qui prit sa difficile succession, la série 8 (E31) !</p>";
		echo "<p>Les annonces sont visibles pendant trois mois.</p>";
		echo "<p align='center'><span class='postfoot'>Lecture des petites annonces</span><br><br>";
		echo "<a href='pa.php3?rubrique=lire_autos'>Autos complètes ($myrow[0] annonces)</a><br><a href='pa.php3?rubrique=lire_pieces'>Pièces, documentation, autres... ($myrow1[0] annonces)</a></p><br>";						
				
		//fin du switch
    }

    //Colonne séparatrice
    echo "</td><td width='15' valign='top'>&nbsp;</td><td valign='top' width='170'>";

    //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'>Ecrire une annonce</td></tr><tr><td width='100%' class='forum2'>\n";
    echo "<img border='0' src='nav/img_carre.gif' width='10' height='9'>&nbsp;";
    echo "<a href='pa.php3?rubrique=auto'>Auto complète</a><br>\n";
    echo "<img border='0' src='nav/img_carre.gif' width='10' height='9'>&nbsp;";
    echo "<a href='pa.php3?rubrique=piece'>Pièces, docs, autres...</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.inc");
?>


