Код: <?
if (eregi("block_random_product.php",$PHP_SELF)) { Header("Location: index.php"); }
{
$result1e=mysql_query("SELECT count(ItemID) FROM $prefix"._maticmarket_items."");
$nbe = mysql_fetch_row($result1e);
if($nbe[0] > 1){
echo "<table border=\"0\" width=\"180\" cellspacing=\"2\" cellpadding=\"0\">\n"
."<tr>\n"
."<td CLASS='TITRE' width=\"100%\" height=\"19\" bgcolor=\"$coul\" align='center'><font size='2' color='#000000'><B><I>";
if($affiche_aleatoire == 1){ echo _ALEATOIR;}else{ echo _FIXEIMG;}
echo "</I></B></font></td>\n"
."</tr>\n"
."<tr>\n"
."<td width=\"100%\" bgcolor=\"$coul1\" valign='top'>\n";
tableaux();
echo "<font size='1'>\n";
//--> Alйatoire ou Fixe
if($affiche_aleatoire == 1){
$randCondition = "";
}elseif($affiche_aleatoire == 0 AND $product_fixe_block != ""){
$randCondition = "WHERE ItemID='".$product_fixe_block."'";
}else{
$randCondition = "";
}
;
$result01=mysql_query("SELECT ItemName, ItemCost, ItemID, ItemDescription, Promo, ItemID*0+rand() as col_order from $prefix"._maticmarket_items." $randCondition order by col_order limit 1");
while( $row01 = mysql_fetch_row( $result01 )){
if(($row01[0] != "")&&($row01[2] != 0)){
echo "<p align='center'><a href=\"modules.php?op=modload&name=".$modulename."&file=product_description&II=$row01[2]&IDU=$IDU\">";
if (file_exists("modules/".$modulename."/images/product/".$row01[2].".".$img)) {
echo psn_image('modules/'.$modulename.'/images/product/'.$row01[2].'.'.$img, $row01[0], $dim_img_productL, $dim_img_productH);
echo "</a></p>";
}else{
$texte_desc = substr("$row01[3]", 0, 30);
if(strlen($row01[3])>30){//--> Si + de 20 caractиre mettre "..." en fin de phrase
$texte_desc .="<br><a href=\"modules.php?op=modload&name=".$modulename."&file=product_description&II=$row01[2]&IDU=$IDU\">"._LIRELASUITEA."</a>\n";
}
echo "</a>".stripslashes($texte_desc)."</p>\n";
}
}
echo "<p align='center'>\n"
."<font size='1'>:NAME:<br><a href=\"modules.php?op=modload&name=".$modulename."&file=product_description&II=$row01[2]&IDU=$IDU\"><b><i>".htmlspecialchars(stripslashes($row01[0]))."</b></i></a></font><br>\n"
."<font size='1'>:PREIS:<br><font size='1'>\n";
//--> Affiche le prix
if($row01[4] == 1){
$date = date(Ymd);
$resultat=mysql_query("SELECT OldPrice, NewPrice, SuperPromo, AutoEnd, StartDate, EndDate, EndOkay FROM $prefix"._maticmarket_promos." WHERE ProductID='$row01[2]'");
while ($infos = mysql_fetch_row($resultat)) {
$OldPrice = $infos[0];
$NewPrice = $infos[1];
$SuperPromo = $infos[2];
$AutoEnd = $infos[3];
$promo_debut = $infos[4];
$promo_fin = $infos[5];
$finok = $infos[6];
if($AutoEnd == 1){
if($promo_debut > date(Ymd)){
$promo1 = 0;
}elseif($promo_debut <= date(Ymd) AND $finok == 1){
$promo1 = 1;
}elseif($promo_debut <= date(Ymd) AND ($finok == 0 AND $promo_fin < date(Ymd))){
$promo1 = 0;
}elseif($promo_debut <= date(Ymd) AND ($finok == 0 AND $promo_fin > date(Ymd))){
$promo1 = 1;
}else{
$promo1 = 1;
}
}else{
$promo1 = 1;
}
}
}
if($promo1 == 1 AND $row01[4] == 1){
if($SuperPromo == 1){ $imgBL = " <a href=\"modules.php?IDU=$IDU&op=modload&name=".$modulename."&file=product_promotion\"><img src=\"modules/".$modulename."/images/special.gif\" border=\"0\" ALT=\""._ALTSUPPROMO."\"></a>\n";}
echo "\n<font size='1'><strike>".$b.$DEVG.mef(tva($row01[1])).$DEVD." ".ttc()."</strike><br>".$DEVG."</font><font size='1' color='red'>".mef(tva($NewPrice))."</font><font size='1'>".$DEVD." ".ttc().$bf."</font></b></i>$imgBL";
}else{
echo "\n<font size='1'>".$b.$DEVG.mef(tva($row01[1])).$DEVD." ".ttc().$bf."</font></b></i>";
}
//--> Fin prix
echo "</font></p>\n";
}
fermetableaux();
echo "</td>\n"
."</tr>\n"
."</table>\n"
."<br>\n";
}else{
echo "<font size='2' color='red'><a href=\"modules.php?op=modload&name=".$modulename."&file=index&IDU=$IDU\">"._ACCUEILLBLOCK."</a><br><br></font>\n";
}
}
?>