1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| <?php
// ***************************************************************
// 3 ANNONCEURS aleatoires - affichage dans PUBTOP
// ***************************************************************
// dossier des images
$dossierAnnonceurs = 'images-partenariat/';
$dossierAnnonceurs = '../../fichiers/images-partenariat/';
// -------------------------
// table de la BD
$tableAnnonceurs = 'T_PUB_PARTENARIAT_PUB';
// requete : publier=1
$pub_query = "SELECT * FROM ".$tableAnnonceurs." AS PUB
WHERE PUB.publier=1
AND PUB.logo!='';";
$pub_result = mysql_query($pub_query) or die('Erreur SQL :<br />'.$pub_query.'<br />'.mysql_error());
$pub_nombre = mysql_num_rows($pub_result);
// -------------------------
// creation de tableaux array avant melange aleatoire
$ipub = 0;
while ($pub_row = mysql_fetch_array($pub_result))
{
$arrayannonceur[$ipub][0] = $dossierAnnonceurs.$pub_row['logo']; // logo
$arrayannonceur[$ipub][1] = fctsitewebURL($pub_row['siteweb']); // site web + lien
$arrayannonceur[$ipub][2] = stripslashes($pub_row['titre']); // titre (soutitre) + lien
if ($pub_row['soustitre']!='') {
$arrayannonceur[$ipub][2] .= ' - '.stripslashes($pub_row['soustitre']);
}
$ipub++;
}
// -------------------------
// melange aleatoire
shuffle($arrayannonceur);
// -------------------------
// on affiche les 3 premiers
for($ipub=0; $ipub<3; $ipub++)
{
if($arrayannonceur[$ipub][1]!='') {
?>
<a class="pubD<?php echo ($ipub+1); ?>" href="<?php echo $arrayannonceur[$ipub][1]; ?>" onclick="window.open(this.href); return false;" title="<?php echo $arrayannonceur[$ipub][2]; ?>">
<img <?php echo fctaffichimage($arrayannonceur[$ipub][0], 140, 80); ?> alt="" />
</a>
<?php
} else {
?>
<a class="pubD<?php echo ($ipub+1); ?>" href="javascript:void(0);" title="<?php echo $arrayannonceur[$ipub][2]; ?>">
<img <?php echo fctaffichimage($arrayannonceur[$ipub][0], 140, 80); ?> alt="" />
</a>
<?php
}
}
?> |
Partager