function message_box() {
global $bgcolor1, $bgcolor2, $user, $admin, $cookie, $textcolor2, $prefix, $multilingual, $currentlang, $db;
$amazon_id = "espacedvd-21";
mt_srand((double)microtime()*1000000);
$imgs = dir('images/promo');
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("swf", $file)) {
$imglist .= "$file ";
}
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$asin = explode(".", $image);
if ($multilingual == 1) {
$querylang = "AND (mlanguage='$currentlang' OR mlanguage='')";
} else {
$querylang = "";
}
$sql = "SELECT mid, title, content, date, expire, view FROM ".$prefix."_message WHERE active='1' $querylang";
$result = $db->sql_query($sql);
if ($numrows = $db->sql_numrows($result) == 0) {
return;
} else {
while ($row = $db->sql_fetchrow($result)) {
$mid = $row[mid];
$mid = intval($mid);
$title = $row[title];
$content = $row[content];
$mdate = $row[date];
$expire = $row[expire];
$expire = intval($expire);
$view = $row[view];
$view = intval($view);
if ($title != "" && $content != "" ) {
if ($expire == 0) {
$remain = _UNLIMITED;
} else {
$etime = (($mdate+$expire)-time())/3600;
$etime = (int)$etime;
if ($etime < 1) {
$remain = _EXPIRELESSHOUR;
} else {
$remain = ""._EXPIREIN." $etime "._HOURS."";
}
}
$retour=explode("@",$image);
switch ($retour[0]) {
/* case "clust":
$content = "
<a href=\"http://tracker.affistats.com/dirclick.php?id=a1884b3187c411276e2f2g1h230i4k4\">
<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"460\" height=\"273\">
<param name=\"movie\" value=\"http://www.espacedvd.net/images/promo/clust@1.swf\">
<param name=\"quality\" value=\"high\">
<embed src=\"http://www.espacedvd.net/images/promo/clust@1.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"460\" height=\"273\"></embed>
</object></a>
";
break;
case "concours":
$retour2=explode(".",$retour[1]);
$content = "<a href=\"modules.php?name=concours\">";
$content.= "<img src=\"images/promo/$image\" border=\"0\" alt=\"Jouez et Gagnez\">";
break;
default:
$content = "<a href=\"http://www.amazon.fr/exec/obidos/ASIN/$asin[0]/$amazon_id\" target=\"_blank\">";
$content .= "<img src=\"images/promo/$image\" border=\"0\" alt=\"\">";
break;*/
}
$content = "<a href=\"http://tracker.affistats.com/dirclick.php?id=a1884b3200c411276e1f2g1h188i4k4\" target=_blank>
<img src=\"/images/bannieres/glowria_460.gif\" border=\"0\"></a>";
/*format des liens amazon http://www.amazon.fr/exec/obidos/ASIN/B0000AG8J9/espacedvd-21*/
if ($view == 4 AND is_admin($admin)) {
OpenTable3();
echo "<center>$content"
."<br><br><center><font class=\"content\">[ "._MVIEWADMIN." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";
CloseTable3();
} elseif ($view == 3 AND is_user($user) || is_admin($admin)) {
OpenTable3();
echo "<center>$content";
if (is_admin($admin)) {
echo "<br><br><center><font class=\"content\">[ "._MVIEWUSERS." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";
}
CloseTable33();
} elseif ($view == 2 AND !is_user($user) || is_admin($admin)) {
OpenTable();
echo "<center>$content";
if (is_admin($admin)) {
echo "<br><br><center><font class=\"content\">[ "._MVIEWANON." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";
}
CloseTable3();
} elseif ($view == 1) {
OpenTable3();
echo "<center>$content";
if (is_admin($admin)) {
echo "<br><br><center><font class=\"content\">[ "._MVIEWALL." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";
}
CloseTable3();
}
if ($expire != 0) {
$past = time()-$expire;
if ($mdate < $past) {
$db->sql_query("UPDATE ".$prefix."_message SET active='0' WHERE mid='$mid'" ); |