Hier mal eine Idee zum testen und basteln
<?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>';
?>