$BDD_identifiant = "root";
$BDD_pass = "";
$BDD_name = "adwords";
$BDD_host = "localhost";
?>
$ERRORS['BDD']=$db->error;
$db->disconnect();
?>
//include 'commun.inc';
mysql_connect('localhost','php','php');
mysql_select_db("dolphin");
?>
// Initialisation des variables
$niveau=0;
$nom = "";
if(isset($_REQUEST['n'])) $niveau=$_REQUEST['n'];
if(isset($_REQUEST['nom'])) $nom=$_REQUEST['nom'];
switch($niveau)
{
case 0:
// Les fabricants
$requetef = " select distinct v_fabricant.fabricant as nom_fabricant,v_produits.fabricant,t_categorie.libelle as categorie,v_produits.id_cat from t_categorie INNER JOIN v_produits ON t_categorie.id=v_produits.id_cat INNER JOIN v_fabricant ON v_fabricant.ref_fab=v_produits.fabricant order by nom_fabricant,v_produits.fabricant,t_categorie.libelle";
$title_page= "Liste des Fabricants - DOLPHIN STORE";
$titre_page= "Les fabricants de produits";
$metadescription="Dolphin Store est une division de Dolphin Computers, fabricant informatique. Toutes les marques informatiques sont présentées chez Dolphin Store";
$metakeywords="fabricant informatique, Dolphin computers, Dolphin Store, ordinateur, ordinateurs, PC, MAC, fabricant informatique";
break;
case 1:
// Les réferences du fabricants
$requetef = " select distinct t.id,t.libelle as categorie,(select libelle from t_categorie where idcat=t.idcat and idscat='AA') as famille,v_fabricant.fabricant as fabricant_nom from t_categorie t INNER JOIN v_produits ON v_produits.id_cat = t.id INNER JOIN v_fabricant ON v_fabricant.ref_fab=v_produits.fabricant where v_fabricant.fabricant_tiret ='$nom' order by t.id";
$title_page= "Produits et références " . strtoupper($nom) . " / Dolphin Store";
$titre_page= "LES REFERENCES PRODUITS DU FABRICANT
include 'bandeau_haut.html';
// ici le menu de navigation
//echo "Niveau = " . $niveau . "
menu_nav = " . $menu_nav[$niveau] . "
" ;
if ($niveau>=1)
printf("
%s
",$menu_nav[$niveau]);
// ici le titre de la page
printf("
%s
",$titre_page);
?>
//echo $requetef;
//echo "NIVEAU = $niveau";
switch($niveau)
{
case 0:
// Les fabricants
//echo $requetef;
$resultatf = mysql_query($requetef);
$idp=0;
while($lignef = mysql_fetch_array($resultatf))
{
$nom_fab=$lignef['nom_fabricant'];
$fabricant=$lignef['fabricant'];
$id_cat=$lignef['id_cat'];
$libelle=$lignef['categorie'];
$tab_fab['nom_fab'][$nom_fab]=$nom_fab;
$tab_fab[$nom_fab]['fabricant'][$fabricant]=$fabricant;
$tab_fab[$nom_fab]['categorie'][$id_cat]=$libelle;
$tab_fab[$nom_fab]['encre'] = sprintf("%s",$nom_fab);
$tab_fab[$nom_fab]['lien_interne'] = sprintf("
%s / ",$nom_fab,$nom_fab,$nom_fab); ////
$tab_fab[$nom_fab]['url'] = str_replace(" ","-",sprintf("/-%s.html",$nom_fab));
}
foreach($tab_fab['nom_fab'] as $key => $value)
{
$total_similitude = 0; ////
foreach($tab_fab[$key]['fabricant'] as $cle => $valeur)
{
if(sizeof($tab_mots_cles) > 0)
{
$liste_mots_descriptif=preg_replace("/([;:,?.'\/\-_])/"," ",$cle);
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille mots cles %s , longueur mots_cles %s
",sizeof($tab_mots_cles),strlen($liste_mots_cles));
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) print_r($tab_mots_cles);
//$liste_mots_descriptif=strtoupper($liste_mots_descriptif);
$tab_mots_descriptif=explode(" ",$liste_mots_descriptif);
$communs=array_intersect($tab_mots_descriptif,$tab_mots_cles);
$ajout_liste_fab = str_ireplace($tab_mots_cles,$resu_mots_cles,$cle);
if(sizeof($communs) > 0) $total_similitude += bcpow("100",sizeof($communs)); //// ON DONNE PLUS DE POIDS AUX NOMS DE FABRICANTS
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille communs %s -> Total similitude %s
",sizeof($communs),$total_similitude);
}
else
{
$ajout_liste_fab=$cle;
}
$liste_fab[$key] .= $ajout_liste_fab .", ";
}
$liste_fab[$key]=substr($liste_fab[$key],0,strlen($liste_fab[$key])-2);
foreach($tab_fab[$key]['categorie'] as $kcle => $kvaleur)
{
if(sizeof($tab_mots_cles) > 0)
{
$liste_mots_descriptif=preg_replace("/([;:,?.'\/\-_])/"," ",$kvaleur);
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille mots cles %s , longueur mots_cles %s
",sizeof($tab_mots_cles),strlen($liste_mots_cles));
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) print_r($tab_mots_cles);
//$liste_mots_descriptif=strtoupper($liste_mots_descriptif);
$tab_mots_descriptif=explode(" ",$liste_mots_descriptif);
$communs=array_intersect($tab_mots_descriptif,$tab_mots_cles);
$ajout_categorie_fab = str_ireplace($tab_mots_cles,$resu_mots_cles,$kvaleur);
if(sizeof($communs) > 0) $total_similitude += bcpow("10",sizeof($communs));
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille communs %s -> Total similitude %s
",sizeof($communs),$total_similitude);
}
else
{
$ajout_categorie_fab=$kvaleur;
}
$categorie_fab[$key] .= $ajout_categorie_fab .", ";
}
$categorie_fab[$key]=substr($categorie_fab[$key],0,strlen($categorie_fab[$key])-2);
//echo "
";
//echo "
".$liste_fab[$key]."
";
//echo $categorie_fab[$key]."
";
$lien_interne.=$tab_fab[$key]['lien_interne'];
$texte_paragraphe[$idp]=sprintf("
%s
%s
",$tab_fab[$key]['url'],$key,$key,$key,$liste_fab[$key],$categorie_fab[$key]);
//echo $texte_paragraphe[$idp];
if($total_similitude > 0) $similitude[$idp]=$total_similitude-$idp/100;
else $similitude[$idp]= -$idp/100;
//printf("
%s
%s
%s
",$tab_fab[$key]['url'],$key,$liste_fab[$key],$categorie_fab[$key]);
/*echo "
"; */
$idp++;
}
// Trie des paragraphes à afficher
arsort($similitude);
foreach($similitude as $key => $value)
{
printf("%s",$texte_paragraphe[$key]);
if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
%s -> %s
",$key,$value);
}
// AFFICHAGE DES LIENS INTERNES
echo "
" . $lien_interne . "";
break;
case 1:
// Les catégories
$resultatf = mysql_query($requetef);
$num_rows = mysql_num_rows($resultatf);
if($num_rows == 0)
{
printf("
INFORMATION
Les références produit du fabricant %s
ne sont pas disponibles pour l'instant
",$nom);
echo "
TOUS NOS PRODUITS CLIQUEZ ICI";
}
$idp=0;
while($lignef = mysql_fetch_array($resultatf))
{
$total_similitude = 0; ////
$fabricant_nom=$lignef['fabricant_nom'];
$famille=$lignef['famille'];
$id_cat=$lignef['id'];
$libelle=$lignef['categorie'];
$encre = $famille ." / ". $libelle;
$lien_interne[$encre]=sprintf("
%s / ",$encre,$encre,$encre);
$url = str_replace(" ","-",sprintf("http://informatique-discount.catalogue-produits.com/-%s/-%s/-%s/-%s.html",$id_cat,$famille,$libelle,$nom));
$requete_cat = " SELECT distinct ref as libelle from v_produits where id_cat = $id_cat and fabricant in (select ref_fab from v_fabricant where fabricant_tiret='$nom') order by libelle";
$resultat_cat = mysql_query($requete_cat);
$descriptif = $encre . " -> REFERENCES DU CONSTRUCTEUR " . $fabricant_nom . ":
XZXZX";
while($ligne_cat = mysql_fetch_array($resultat_cat))
{
if($ligne_cat['libelle'] <> '') $descriptif .= " , " . $ligne_cat['libelle'];
}
$descriptif=str_replace("XZXZX ,","",$descriptif);
if(sizeof($tab_mots_cles) > 0)
{
$liste_mots_descriptif=preg_replace("/([;:,?.'\/\-_])/"," ",$descriptif);
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille mots cles %s , longueur mots_cles %s
",sizeof($tab_mots_cles),strlen($liste_mots_cles));
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) print_r($tab_mots_cles);
//$liste_mots_descriptif=strtoupper($liste_mots_descriptif);
$tab_mots_descriptif=explode(" ",$liste_mots_descriptif);
$communs=array_intersect($tab_mots_descriptif,$tab_mots_cles);
$descriptif = str_ireplace($tab_mots_cles,$resu_mots_cles,$descriptif);
//if(sizeof($communs) > 0) $total_similitude += bcpow("10",sizeof($communs));
if(sizeof($communs) > 0) $total_similitude += 10 * sizeof($communs);
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
taille communs %s -> Total similitude %s
",sizeof($communs),$total_similitude);
}
mysql_free_result($resultat_cat);
//echo "
";
//echo "
".$descriptif."
";
$texte_paragraphe[$idp]=sprintf("
%s
",$url,$encre,strtolower($encre),$encre,$descriptif);
if($total_similitude > 0) $similitude[$idp]=$total_similitude-$idp/100;
else $similitude[$idp]= -$idp/100;
$idp++;
}
if($num_rows > 0)
{
// Trie des paragraphes à afficher
arsort($similitude);
foreach($similitude as $key => $value)
{
printf("%s",$texte_paragraphe[$key]);
//if($_SERVER['REMOTE_ADDR'] == "82.66.186.154" && $debug == 1) printf("
%s -> %s
",$key,$value);
}
// AFFICHAGE DES LIENS INTERNES
foreach($lien_interne as $key => $value)
{
$affiche_lien_interne .= $value;
}
echo "
" . $affiche_lien_interne . "";
}
break;
}
mysql_free_result($resultatf);
mysql_close();
include 'bandeau_bas.html';
?>