Standard OnlineBox ilch
<?php
if (!defined('main')) {die("no direct access");}
$dif = date('Y-m-d H:i:s', time() - 60);
$abf = "SELECT uid FROM `prefix_online` WHERE uptime > '". $dif."'";
$resultID = db_query($abf);
$brk='';
$uid = array();
$guests = 0;
$guestn = $lang['guests'];
$content='';
while ($row = db_fetch_object($resultID)) {
if ($row->uid != 0 AND $brk!=$row->uid) {
$name=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$row->uid),0);
$content.= '<tr><td><img src="include/images/icons/online.gif" border="0" alt="online"></td>';
$content.='<td><a href="index.php?user-details-'.$row->uid.'">'.$name.'</a></td></tr>'."\n";
$uid[] = $row->uid;
}
if ($row->uid == 0) { $guests++; }
$brk=$row->uid;
}
if ($guests == 1) { $guestn = $lang['guest']; }
if (empty($content)) { $content.='<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><font color="#003366">0 User </font></td></tr>'."\n"; }
$content.='<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px;"></td></tr>'."\n";
$where = (count($uid)>0) ? 'WHERE id NOT IN ('.implode(', ', $uid).')' : '';
$abf2 = 'SELECT * FROM prefix_user '.$where.' ORDER BY llogin DESC LIMIT 0,5';
$erg2 = db_query($abf2);
while ($row2 = db_fetch_object($erg2)) {
$datum = date('H:i d.m.y',$row2->llogin);
$user = $row2->name;
$content.='<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><a href="index.php?user-details-'.$row2->id.'" title="'.$lang['lasttimeonline'].$datum.'">'.$user.'</a></td></tr>'."\n";
}
if ($guests == 0) {
$content.= '<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px";></td></tr>'."\n".'
<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><font size="-1" color="#003366">0 '.$lang['guests'].'</td></tr>'."\n";
} else {
$content.= '<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px;"></td></tr>'."\n".'
<tr><td><img src="include/images/icons/online.gif" border="0" alt="online"></td><td><font size=-1>'.$guests.' '.$guestn.'</font></td></tr>'."\n";
}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" >
<?php echo $content; ?>
</table>
OnlineBox vom Lord wo eben Fehler sind. ZB. Dass nur ein User den schwarzen rahmen bekommt und alle weiteren drunter nicht.
Bei gesammt User kommt kein Tooltip und bei user waren Online/ Userliste kommt auch nichts
<?php
defined ('main') or die ( 'no direct access' );
// ### CSS für Tooltip
$ILCH_HEADER_ADDITIONS .= '<style type="text/css">
.onlinebox {
text-align:center;
}
a.onlinetooltip {
position: relative;
display: inline;
}
a.onlinetooltip span {
position: absolute;
width:140px;
color: #FFFFFF;
background: #000000;
height: 30px;
line-height: 30px;
text-align: center;
visibility: hidden;
border-radius: 6px;
}
a.onlinetooltip span:after {
content: "";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -8px;
width: 0; height: 0;
border-bottom: 8px solid #000000;
border-right: 8px solid transparent;
border-left: 8px solid transparent;
}
a:hover.onlinetooltip span {
visibility: visible;
opacity: 0.8;
top: 25px;
left: 50%;
margin-left: -70px;
z-index: 999;
}
</style>';
// ### onlinezeit 60 sec
define ('USERUPTIME', 60);
// ### alle online
function online_ges() {
$dif = date('Y-m-d H:i:s', time() - USERUPTIME);
$erg = db_query("SELECT COUNT(*) FROM `prefix_online` WHERE `uptime` > '" . $dif . "'");
$anz = db_result($erg, 0);
return ($anz);
}
// ### nur die user
function online_ges_user() {
$dif = date('Y-m-d H:i:s', time() - USERUPTIME);
$erg = db_query("SELECT COUNT(*) FROM `prefix_online` WHERE `uid` > 0 AND `uptime` > '" . $dif . "'");
$anz = db_result($erg, 0);
return ($anz);
}
// ### nur die gaeste
function online_ges_gast() {
$dif = date('Y-m-d H:i:s', time() - USERUPTIME);
$erg = db_query("SELECT COUNT(*) FROM `prefix_online` WHERE `uid` = 0 AND `uptime` > '" . $dif . "'");
$anz = db_result($erg, 0);
return ($anz);
}
// ### user online liste
function online_user_on_liste() {
$list = '';
$dif = date('Y-m-d H:i:s', time() - USERUPTIME);
$erg = db_query("SELECT DISTINCT `uid`, `name` FROM `prefix_online` LEFT JOIN `prefix_user` ON `prefix_user`.`id` = `prefix_online`.`uid` WHERE `uid` > 0 AND `uptime` > '" . $dif . "'");
if (db_num_rows($erg) == 0) {
$list = 'Niemand';
} else {
while ($row = db_fetch_object($erg)) {
$list .= $row->name . '<br/>';
}
$list = substr($list, 0, strlen($list) - 5);
}
return ($list);
}
// #### user online liste des tages
function online_user_on_today_liste() {
$list = '';
$dif = mktime(0,0,0,date('m'),date('d'),date('Y'));
$erg = db_query("SELECT id, name, llogin FROM `prefix_user` WHERE `llogin` > '" . $dif . "' ORDER BY `llogin` DESC");
while($row = db_fetch_object($erg)) {
$Xdif = date('Y-m-d H:i:s', time() - USERUPTIME);
if (@db_result(db_query("SELECT COUNT(*) FROM `prefix_online` WHERE `uid` = '" . $row->id . "' AND `uptime` > '" . $Xdif . "'")) == 0) {
$list .= $row->name . '<br/>';
}
}
$list = substr($list, 0, strlen($list) - 5);
if (empty($list)) $list = 'Niemand';
return ($list);
}
$gast = (online_ges_gast() == 1)?'Gast':'Gäste';
echo '<div class="onlinebox">';
echo 'Aktuell sind Online:<br/>';
echo '<a class="onlinetooltip" href="#">'.online_ges_user().' User<span>'.online_user_on_liste().'</span></a><br/>';
echo '<a class="onlinetooltip" href="#">'.online_ges_gast().' '.$gast.'</a><br/>';
echo '<a class="onlinetooltip" href="#">'.online_ges().' Gesamt</a><br/>';
echo '<br/>Heute waren Online:<br/>';
echo '<a class="onlinetooltip" href="#">Userliste<span>'.online_user_on_today_liste().'</span></a><br/>';
echo '</div>';
?>