OK! Hier der Code
(ist aber etwas lang):
<?php
// $Id: block-Who_is_Online_IrcChat.php,v 20.1 2004/01/13 10:56:11 KorschAl Exp $
// based on: block-Who_is_Online.php,v 1.6 2003/10/02 22:28:55 EllselAn Exp $
/**********************************************************************/
/* vkpMx 2.0 Content Management System Platform */
/* ================================================================== */
/* Copyright (C) 2003 by the vkpMx & pragmaMx Developer Team */
/* email: team@pragmamx.org */
/* homepage: http://www.maax-design.de */
/* further sites: http://www.pragmaMx.org, http;//guggemahier.de, */
/* http://www.marx-city.de, http://www.genutec-studios.de, */
/* http://www.shiba-design.de, http://www.power-maax.de */
/* ================================================================== */
/* The vkpMx is distributed free of charge by maax-design.de. */
/* The use of this system is allowed until copyright information */
/* is shown perspicuous visible and correcty on all system pages. */
/* Sales, rent out and the use of single code parts from this */
/* system must be allowed by maax-design.de. */
/**********************************************************************/
/* */
/* Module Co-Development and eggdrop enhancement by ircfreunde.de */
/* */
/********************************************************************/
################# Einstell Variablen ############################################################################
$onlinelistsize = 8; # Hoehe des Selectfeld der Onlinuser (Online-Liste)
$onlinechatlistsize=8; # Hoehe des Selectfeld der Chatuser (Online-Liste)
$showuserlistall = 0; # Wenn Online-Liste immer erscheinen soll, 1=Ja, 0=nein
$showbuddy = 1; # Buddylink (Messenger) anzeigen , 1=Ja, 0=nein
# User, die nicht angezeigt werden sollen
# Namen mit Komma trennen!
$excludedusers ="Texsterdsgf, Knaxllerfgfd";
##################################################################################################################
$imagedir="images/maaxon";
$pm_module_name = "Private_Messages";
##################################################################################################################
#$checkpmtime=200000; # Intervall zum private Nachrichten abfragen, 0 wenn nicht abgefragt werden soll
$thisfile=basename(__file__);
if (!defined("mxMainFileLoaded")) die ("You can't access this file directly...");
$mxblockcache = FALSE;
global $prefix, $user_prefix, $bgcolor1, $bgcolor2, $bgcolor3, $txtcolor1, $txtcolor2;
if(@file_exists("language/maaXoN/maaXoN-".$GLOBALS['currentlang'].".php")) {
include_once("language/maaXoN/maaXoN-".$GLOBALS['currentlang'].".php");
}
else {
include_once("language/maaXoN/maaXoN-english.php");
}
# Variablen initialisieren
if(substr(strtolower($GLOBALS['currentlang']), 0, 6) == "german"){ # Bilder fuer Buttons definieren (noch keine Bilder vorhanden!!)
$pmimagepath="modules/$pm_module_name/images/buttons/german";
}
else{
$pmimagepath="modules/$pm_module_name/images/buttons/english";
}
# Variablen initialisieren
$isseruser = 0;
$username = "";
if (mxIsUser()){
$isseruser = 1;
$cookie=mxGetUserSession();
$username = $cookie[1];
$uid = $cookie[0];
}
$isseradmin = mxIsAdmin();
# SQL-bedingung fuer excluded Users erstellen
$exusers = explode (",", $excludedusers);
if(!$isseradmin){
while (list($key, $val) = each($exusers)) {
$xexusers[]=trim($val);
}
}
$xexusers[] = $GLOBALS['anonymous'];
$excludedusers = "'".implode("','",$xexusers)."'";
# Anzahl aller User und hoechste uid ermitteln
$totalmembers=0;
$qry="select COUNT(uid), MAX(uid) from ${user_prefix}_users where user_stat=1;";
list($totalmembers, $lastuid) = sql_fetch_row(sql_query($qry));
# neusten User ermitteln
$lastuid = (empty($lastuid)) ? 0 : $lastuid;
$qry="select uname from ${user_prefix}_users where uid = $lastuid;";
$result = sql_query($qry); # neusten User ermitteln
list($lastuser) = sql_fetch_row($result);
$past = time()- MX_SETINACTIVE_MINS ;
# Alle Gaeste ermitteln
$guest_online_num=0;
$result = sql_query("SELECT Count(ip) FROM ${prefix}_visitors WHERE time>".$past." AND uid=0;");
list($guest_online_num) = sql_fetch_row($result);
# Alle User ermitteln, evtl auflisten
$member_online_num = 0;
$whoonlineselect = "";
$smallunmae = strtolower($username);
#$GLOBALS["mxSqlDebug"] = 1;
#$result = sql_query("SELECT uname, uid, user_lastvisit FROM ${user_prefix}_users WHERE (user_lastvisit >= ".$past.") AND user_stat=1 order by uname");
/* $result = sql_query("SELECT u.uname
FROM ${user_prefix}_users As u LEFT JOIN ${prefix}_visitors AS v ON u.uid = v.uid
WHERE ((u.user_lastvisit >= ".$past.") AND (u.user_stat=1) AND (u.uname NOT IN ($excludedusers)) AND (v.uid=u.uid))
ORDER BY u.uname"); */
$result = sql_query("SELECT uname FROM ${user_prefix}_users
WHERE ((uname Not In (".$excludedusers.")) AND (user_lastvisit >= ".$past.") AND (user_stat=1) AND (user_lastmod<>'logout'))
ORDER BY uname");
#$GLOBALS["mxSqlDebug"] = 0;
while (list($uname2) = sql_fetch_row($result)) {
$sel = (strtolower($uname2) == $smallunmae) ? " selected " : "";
$uname3 = mxCutString($uname2, 18, "..", ""); # Kurzen Usernamen erstellen
$whoonlineselect.="<option value=\"".$uname2."\" ".$sel." title=\"".$uname2."\">".$uname3."</OPTION>\n"; # options fuer auswahlselect erstellen
$member_online_num++; # Anzahl User hochzaehlen
}
# Private Nachrichten
$countpm=0; $countpmunread=0; $sendpm=0;
if ($isseruser) { # Wenn aktueller User registriert ist (kein Gast)
$pmactiv = (mxModuleAllowed($pm_module_name)) ? 1 : 0; # feststellen ob pm-modul aktiv ist
if ($pmactiv){ # falls pm-modul aktiv ist
$qry="SELECT read_msg, Count(msg_id) FROM ${prefix}_priv_msgs WHERE to_userid=".$uid." group by read_msg;";
$result = sql_query($qry);
while (list($read_msg, $nums) = sql_fetch_row($result)) {
if ($read_msg==0) { # wenn angemeldeter User
$countpmunread=$nums; # Anzahl ungelesene ermitteln
}
else{
$countpm=$nums; #++; # Anzahl aller pm's ermitteln
}
}
}
$qry="SELECT read_msg, Count(msg_id) FROM ${prefix}_priv_msgs_send WHERE from_userid=".$uid." group by read_msg;";
$result = sql_query($qry);
while (list($read_msg, $nums) = sql_fetch_row($result)) {
$sendpm=$nums;
}
#else{
#$checkpmtime=0; # private Nachrichten nicht abfragen!
# }
}
# Usergaestebuch
$content_ug = "";
if ($isseruser) { # Wenn aktueller User registriert ist (kein Gast)
if (mxModuleAllowed("UserGuest")){ # falls gaestebuch vorhanden
$qry="SELECT Count(gid) FROM ${prefix}_userguest WHERE touserid='".$uid."' AND touser = '".$username."' AND dummy=0;";
$result = sql_query($qry);
list($gbnewentries) = sql_fetch_row($result);
# Usergaestebuch
if(!empty($gbnewentries)){
$content_ug .= "<div align=\"left\"><a href=\"modules.php?name=UserGuest&op=view&touser=$username\">
<img src=\"$imagedir/tcake.gif\" width=\"19\" height=\"19\" border=\"0\" Alt=\""._BWOGUESTBOOK."\"></a> \n
<b>$gbnewentries </b><a href=\"modules.php?name=UserGuest&op=view&touser=$username\">";
if($gbnewentries==1){
$content_ug .= ""._BWOGUESTBOOK1."";
}
else {
$content_ug .= ""._BWOGUESTBOOK2."";
}
$content_ug .= "</a></div>";
}
}
}
# weitere Variablen initialisieren zur Zeitberechnung :(
//Creating SQL parameter
$gestern = mktime(0, 0, 0, date ("m") , date ("d")-1, date("Y"));
$heute = mktime(0, 0, 0, date ("m") , date ("d"), date("Y"));
# Heute neu angemeldete User ermitteln
$qry = "SELECT COUNT(uid) from ${user_prefix}_users WHERE user_regtime >= $heute and user_stat=1 and uname not in($excludedusers);";
list($userCount) = sql_fetch_row(sql_query($qry));
# Gestern neu angemeldete User ermitteln
$qry = "SELECT COUNT(uid) from ${user_prefix}_users WHERE user_regtime >= $gestern and user_regtime < $heute and user_stat=1 and uname not in($excludedusers);";
list($userCount2) = sql_fetch_row(sql_query($qry));
# Ausgabe ...................................
$content = "\n<!-- $thisfile output start -->\n<div class=\"boxcontent\">\n";
if ($isseruser) {
$content .= "Hallo, <br><font color=\"#ff0000\"><b>$username!</b></font><br>(<a href=\"modules.php?name=Your_Account&op=logout\">logout</a>)\n";
$content .= "<center><b>..::[ <a href=\"modules.php?name=Your_Account\">Dein Account</a> ]::..</b><br><br>\n";
}else{
$content .= "<b>Hallo, $anonymous</b><br>\n";
$content .= "<br><li><b><a href=\"modules.php?name=User_Registration\">Registrieren</a></b>
<li><a href=\"modules.php?name=Your_Account\">Community Login</a>
<li><a href=\"modules.php?name=Your_Account&op=pass_lost\">Passwort vergessen?</a><br><br>\n";
}
$gesamt_online=($guest_online_num+$member_online_num);
$content .="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border: 0px; margin-bottom: 5px;\">\n"
."\n<tr>\n<td class=\"boxcontent\">"._BWOTOTALMEMBERS."</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$totalmembers</b></td>\n</tr>\n"
."\n<tr>\n<td class=\"boxcontent\">"._BWOTODAYMEMBERS."</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$userCount</b></td>\n</tr>\n"
."\n<tr>\n<td class=\"boxcontent\">"._BWOYESTERDAYMEMBERS."</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$userCount2</b></td>\n</tr>\n"
."\n<tr>\n<td class=\"boxcontent\">"._BWOMEMBERS1."</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$member_online_num</b></td>\n</tr>\n"
."\n<tr>\n<td class=\"boxcontent\">"._BWOGUESTES."</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$guest_online_num</b></td>\n</tr>\n"
."\n<tr>\n<td class=\"boxcontent\">Gesamt online:</td>\n<td align=\"right\" class=\"boxcontent\">\n<b>$gesamt_online</b></td>\n</tr>\n"
."</table>\n";
if ($isseruser) {
// zuletzt angemeldeter User
$content .= "<div style=\"border: 0px; margin-bottom: 5px;\">"._BWOLATEMEMBER."<br>\n<A HREF=\"modules.php?name=Userinfo&uname=$lastuser\">$lastuser</a></div>\n";
}
if ($isseruser || $isseradmin || $showuserlistall) { # Wenn angemeldeter User oder Admin oder Liste immer erscheinen soll
# Onlineliste anzeigen wenn User online sind
if($member_online_num>0){
if($onlinelistsize>=$member_online_num) {$onlinelistsize=$member_online_num+1;}
if(!$isseruser || !$pmactiv){
$script = "";
}
else{
$script = " onDblClick=\"whob_clickit()\"";
$content .= "\n<!--\n";
$content .= "function whob_clickit(){\n";
$content .= " var y=document.onlineuserinfo.uname.selectedIndex; \n";
$content .= " var x=document.onlineuserinfo.uname.options[y].value; \n";
$content .= " window.open('modules.php?name=$pm_module_name&file=buddy&op=compose&to='+x, '".md5(time())."','left=370,top=150,width=450,height=300,toolbar=no,location=no,menubar=no,scrollbars=yes,resizeable=yes,status=no');\n";
$content .= " return false;\n";
$content .= " }\n//-->\n";
$content .= "\n";
}
#background-color: $bgcolor1; font-size: 9px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #ffffff; width: 90%; border: 0px $bgcolor1;
# Chatuser ermitteln
$chatrooms="";
//
// IrcChat-Enhancement
//
// disable ircchat html output by default
$ircchat_active = false;
if(mxModuleAllowed("IrcChat")){
include("modules/IrcChat/config.php");
if($botconf['eggdrop'] == "true" && !empty($botconf['verzeich'])) {
// enable html output
$ircchat_active = true;
// Wenn Admin wird Admin-Nic genommen
if(mxIsAdmin())
{
extract(mxGetAdminSession());
$thisuser = str_replace(array("SiteAdmin ", "SiteAssistant ", "Admin ", " "),array("","","","_"), $aid);
if(count($chatroom['public']) > 0){
for($i=0; $i < count($chatroom['public']); $i++) $chatrooms[] = $chatroom['public']["$i"];
}
if(count($chatroom['user']) > 0){
for($i=0; $i < count($chatroom['user']); $i++) $chatrooms[] = $chatroom['user']["$i"];
}
if(count($chatroom['admin']) > 0){
for($i=0; $i < count($chatroom['admin']); $i++) $chatrooms[] = $chatroom['admin']["$i"];
}
}
// wenn User und nicht Admin wird User-Nic genommen
elseif(mxIsUser()){
$cookie = mxGetUserSession();
$thisuser = str_replace(" ", "_", $cookie[1]);
if(count($chatroom['public']) > 0){
for($i=0; $i < count($chatroom['public']); $i++) $chatrooms[] = $chatroom['public']["$i"];
}
if(count($chatroom['user']) > 0){
for($i=0; $i < count($chatroom['user']); $i++) $chatrooms[] = $chatroom['user']["$i"];
}
// wenn Anonymous wird Nic hier zusammen gesetzt
// (damit auch mehr als ein Gast im Chat sein kann)
}else{
$thisuser = _CHAT_GUEST."_".substr( time(), 6);
if(count($chatroom['public']) > 0){
for($i=0; $i < count($chatroom['public']); $i++) $chatrooms[] = $chatroom['public']["$i"];
}
}
$ChatPeople[]= "";
$wio_chat_file_size= 0;
if(count($chatrooms) > 0){
for($i=0; $i < count($chatrooms); $i++)
if($chatrooms["$i"] != ""){
$onlinetext= "".$botconf['verzeich']."/".$chatrooms["$i"].".txt";
if(ereg('://', $onlinetext) && !ini_get('allow_url_fopen')){
@ini_set("allow_url_fopen","1");
$restore_ini = true;
}else{
$restore_ini = false;
}
$wio_chat_file = fopen($onlinetext, "rt");
while ($CLine = fgets($wio_chat_file, 999)) {
$teile=explode(chr(32),$CLine); $name=$teile[0];
if ($name!=$botconf['botname'] && $name!="ChanServ") {
$ChatPeople[].="<option value=\"".$name."\" title=\"".$name."\">".$name."</OPTION>\n";
}
}
fclose($wio_chat_file);
if($restore_ini) @ini_set("allow_url_fopen","0");
}
}
$ChatPeople = array_unique($ChatPeople);
//$wio_chat_file_size = count($ChatPeople);
$sauber = "";
foreach($ChatPeople as $value) {
if($value !=""){
$sauber .= "\n$value";
$wio_chat_file_size++;
}
}
$ChatPeople = substr($sauber,1);
if($wio_chat_file_size>0){
if($onlinechatlistsize>=$wio_chat_file_size) {$onlinechatlistsize=$wio_chat_file_size+1;}
} else {
$onlinechatlistsize=2;
$ChatPeople.="<option value=\"niemand\" title=\"niemand\">Kein User im Chat</OPTION>\n";
}
} // end if eggdrop
// Unset chat config.php values
unset($chatsettings); unset($chatroom); unset($chatconf); unset($styleconf); unset($guiconf); unset($botconf); unset($chatsmileys);
} // end if chat enabled and allowed
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border: 0px; margin-bottom: 5px;\">\n";
$content .= "\n<tr>\n<td colspan=\"2\" align=\"center\" class=\"boxcontent\">\n";
$content .= "<b>"._BWOONLINELIST."</b><br>\n";
$content .= "</td>\n</tr>\n";
$content .= "\n<tr>\n<td colspan=\"2\" align=\"center\">"; # select-options verwenden
$content .= "<form action=\"modules.php?test\" name=\"onlineuserinfo\" method=\"get\" style=\"border: 0px; margin-bottom: 5px; margin-top: 0px;\">";
$content .= "<input type=\"hidden\" name=\"name\" value=\"Your_Account\">";
$content .= "<input type=\"hidden\" name=\"op\" value=\"userinfo\">";
$content .= "<select name=\"uname\" size=\"$onlinelistsize\" style=\" background-color: $bgcolor1; font-size: 9px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #ffffff; width: 90%; cursor: hand;
$content .= "border: 1px solid $bgcolor2; text-decoration: none; padding-left: 1px; padding-top: 1px; padding-bottom: 1px;" $script>".$whoonlineselect."</select>";
$content .= "<br>\n<input type=\"image\" src=\"$pmimagepath/info.gif\" alt=\""._BWOUSERINFO."\">";
$content .= "</form>\n";
$content .= "</td>\n</tr>\n";
// only active when ircchat if-part was executed
if($ircchat_active) {
$content .= "\n<tr>\n<td colspan=\"2\" align=\"center\" class=\"boxcontent\">\n";
if ($isseruser) { $content .= "<br><b>Im<a href=\"/community/htmltonuke.php?filnavn=htmlseiten/chathilfe.html\"> Chat</a> sind:</b><br>\n";
$content .= "</td>\n</tr>\n";
$content .= "\n<tr>\n<td colspan=\"2\" align=\"center\">"; # select-options verwenden
$content .= "<form action=\"modules.php?test\" name=\"onlinechatuserinfo\" method=\"get\" style=\"border: 0px; margin-bottom: 5px; margin-top: 0px;\">";
$content .= "<select name=\"ucname\" size=\"$onlinechatlistsize\" style=\" background-color: $bgcolor1; font-size: 9px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #ffffff; width: 90%; cursor: hand;
$content .= "border: 1px solid $bgcolor2; text-decoration: none; padding-left: 1px; padding-top: 1px; padding-bottom: 1px;">".$ChatPeople."</select>";
$content .= "</form><center>..::[ <a href=\"/community/htmltonuke.php?filnavn=htmlseiten/chathilfe.html\">Zum Chat</a> ]::..\n";
$content .= "</td>\n</tr>\n";
}
}
$content .= "</table>\n";
}
# private messages
if (!empty($pmactiv) && $isseruser){
# pm Liste
include("modules/Private_Messages/inboxsize-conf.php");
$erlaubtpm=$sentboxsize;
$erlaubtgetpm=$inboxsize;
if($countpm >= $erlaubtgetpm) {
$countpm = "<font color=red>$countpm</font>";
}
if($sendpm >= $erlaubtpm) {
$sendpm = "<font color=red>$sendpm</font>";
}
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border: 0px; margin-bottom: 5px;\">\n";
if ($countpm || $sendpm){
$content .= "\n<br><tr>\n<td colspan=\"3\" align=\"center\" class=\"boxcontent\"><a href=\"modules.php?name=Private_Messages\">"._BWOPMSG."</a></td>\n</tr>\n";
$content .= "\n<tr>\n<td align=\"center\" class=\"boxcontent\"><a href=\"modules.php?name=Private_Messages\"><img src=\"$imagedir/pmessage.gif\" width=\"19\" height=\"19\" border=\"0\" Alt=\""._BWOPMSG."\"></a></td>\n";
$content .= "<td valign=\"top\" class=\"boxcontent\">"._BWOPMSGALL.":<br>\ngesendet:<br>\n"._BWOPMSGUNREAD.":</td>\n";
$content .= "<td valign=\"top\" align=\"right\" class=\"boxcontent\"><b>".$countpm." </b>/<i>".$erlaubtgetpm."</i><br>\n";
$content .= " <b>".$sendpm."</b> /<i>".$erlaubtpm."</i><BR>";
$content .= ($countpmunread) ? "<img src=\"modules/eBoard/images/buttons/german_du/new.gif\" alt=\"\" width=\"38\" height=\"18\" border=\"0\"> <b>".$countpmunread."</b>" : "<b>$countpmunread</b>";
$content .= "</td>\n";
$content .= "</tr>\n";
}
else{
$content .= "<br><tr><td class=\"boxcontent\"><a href=\"modules.php?name=Private_Messages\"><img src=\"$imagedir/pmessage.gif\" width=\"19\" height=\"19\" border=\"0\" Alt=\""._BWOPMSG."\" hspace=\"0\"></a></td><td><a href=\"modules.php?name=Private_Messages\">"._BWOPMSG."</a></td></tr>\n";
}
$content .= "</table>\n";
# Buddy
if ($showbuddy){
$themedir = MX_THEME_DIR."/images";
$buddyimg = (@file_exists($themedir."/buddy.gif")) ? $themedir."/buddy.gif" : $imagedir."/buddy.gif";
$buddyimg = mxCreateImage($buddyimg, _BWOBUDDIE, 0);
$windowname=md5($GLOBALS['sitename']);
$content .= "<a href=\"#\" onClick=\"window.open('modules.php?name=Private_Messages&file=buddy','$windowname','left=180, top=150, width=240,height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0'); return false;\">".$buddyimg."</a><br><br></center>\n";
$content .= "<ul><li><a href=\"modules.php?name=Members_List\">Mitgliederliste</a>
<li><a href=\"modules.php?name=Usersuche\">Mitglied