Thema: Anzeigen welche User gerade online sind

Forum: MLF 1.7

Autor: wolf


wolf - 22/9/2007 um 17:40

<?php

// MLF 1.7 Mod
// Anzeigen welche User grade online sind
// 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'];

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

$result=mysql_query("SELECT ip, time, user_id FROM forum_useronline", $connid);
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>';
$subnav_2 = '';
$subnav_2 .= ' <span class="small"><a href="mod_last_postings.php"><img src="img/update.gif" alt="" title="'.$lang['update_time_linktitle'].'" width="9" height="9" onmouseover="this.src=\'img/update_mo.gif\';" onmouseout="this.src=\'img/update.gif\';"</a></span>';

parse_template();
echo $header;
?>

<h2>Wer ist gerade online?</h2>
<ul class="thread">

<?php

$cnt = 0;

while ($uzeile = mysql_fetch_array($result))
{
$user_id = $uzeile["user_id"];

if ($user_id != 0) {
$cresult = mysql_query("SELECT * FROM forum_userdata WHERE user_id = $user_id");

while ($czeile = mysql_fetch_array($cresult)) {
$cnt++;
}

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

while ($zeile = mysql_fetch_array($userresult)) {
if ($zeile['user_type'] == 'admin') $name = "<span class=\"admin-highlight\">".htmlspecialchars(stripslashes($zeile['user_n ame']))."</span> <font color=\"#cccc99\">®</font>";
elseif ($zeile['user_type'] == 'mod') $name = "<span class=\"mod-highlight\">".htmlspecialchars(stripslashes($zeile['user_nam e']))."</span> <font color=\"#cccc99\">®</font>";
else $name = '<font color="'.$zeile['user_color'].'">'.htmlspecialchars(stripslashes($zeile[ 'user_name'])).'</font>';
$userid = $zeile['user_id'];
echo "<b><a href=\"user.php?id=$userid\">$name</a></b>";
echo "<br>";
}
}
}

echo "<br><p>Es sind zur Zeit $cnt registrierte User online.</p>";

?>

</ul>

<?php
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=122