Thema: Die meist gelesenen Threads anzeigen

Forum: MLF 1.7

Autor: wolf


wolf - 22/9/2007 um 17:39

<?php

// MLF 1.7 Mod
// Die meist gelesenen Threads anzeigen
// Diese Modifikation zeigt die Beiträge in der Threadansicht
// Die Erweiterung der farbigen Nicknamen muß installiert sein

include("inc.php");

include ("db_settings.php");

$host = $db_settings['host'];
$user = $db_settings['user'];
$pw = $db_settings['pw'];
$db = $db_settings['db'];

// Anzahl der Threads
$limit = 30;

$link = mysql_connect("$host", "$user", "$pw" )
or die("Could not connect : " . mysql_error());
mysql_select_db("$db" ) or die("Could not select database" );

$query = "SELECT UNIX_TIMESTAMP(time), subject, user_id, name, tid, views, time, views, text FROM
forum_entries GROUP BY tid **** BY views
desc LIMIT 0, $limit";
$result = mysql_query($query, $link) or die("Query failed : " .
mysql_error());

if(!$result) die($lang['db_error']);

$subnav_1='<a class="textlink" href="posting.php?category='.urlencode($category).'" title="'.$lang['new_entry_linktitle'].'">'.$lang['new_entry_linkname'].' </a>';

parse_template();
echo $header;

echo "<h2>Die $limit meist gelesenen Threads</h2>"
?>
<ul class="thread">
<?php

while($zeile = mysql_fetch_array( $result )) {

$subject = $zeile["subject"];
$tid = $zeile["tid"];
$time = $zeile["time"];

$views = $zeile["views"];

// name des Threaderstellers - nicht des letzten Posters
$name = $zeile["name"];
$user_id = $zeile["user_id"];

echo '<li><a class="';

if ((($zeile==0) && isset($_SESSION[$settings['session_prefix'].'newtime']) && $_SESSION[$settings['session_prefix'].'newtime'] < $zeile["last_answer"]) || (($zeile["pid"]==0) && empty($_SESSION[$settings['session_prefix'].'newtime']) && $zeile["last_answer"] > $last_visit))
{
echo "threadnew";
}
elseif ($zeile["pid"]==0)
{
echo "thread";
}
elseif ((($zeile["pid"]!=0) && isset($_SESSION[$settings['session_prefix'].'newtime']) && $_SESSION[$settings['session_prefix'].'newtime'] < $zeile["time"]) || (($zeile["pid"]!=0) && empty($_SESSION[$settings['session_prefix'].'newtime']) && $zeile["time"] > $last_visit))
{
echo "replynew";
}
else
{
echo "reply";
}

echo '" href="forum_entry.php?id='.$zeile["tid"].'">'.htmlspecialchars(stripslas hes($zeile["subject"])).'</a>';

$userresult = mysql_query("SELECT * FROM forum_userdata WHERE user_id = $user_id");

while ($uzeile = mysql_fetch_array($userresult)) {
if ($uzeile['user_type'] == 'admin') $name = "<span class=\"admin-highlight\">".htmlspecialchars(stripslashes($uzeile['user_ name']))."</span> <font color=\"#cccc99\">®</font>";
elseif ($uzeile['user_type'] == 'mod') $name = "<span class=\"mod-highlight\">".htmlspecialchars(stripslashes($uzeile['user_na me']))."</span> <font color=\"#cccc99\">®</font>";
else $name = '<font color="'.$uzeile['user_color'].'">'.htmlspecialchars(stripslashes($uzeil e['user_name'])).'</font>';
echo " - <b>$name</b>";
}

$edat = explode(" ", $time);
$dat = explode("-", $edat[0]);
$datum = "$dat[2].$dat[1].$dat[0]";
$std = explode(":", $edat[1]);
$uhr = "$std[0]:$std[1]";

echo ", $datum, $uhr - $views Zugriffe</li>";
}

echo "</ul>";

mysql_free_result($result);

mysql_close($link);

echo $footer;
?>

Dieses Thema kommt von : eD2K-Serverboard
http://ed2k-serverboard.de

URL dieser Webseite:
http://ed2k-serverboard.de/modules.php?name=eBoard2&file=viewthread&fid=34&tid=121