Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
Anzahl der Benutzer, die gerade online sind [phpwcms-HowTo:wiki]

Anzahl der Benutzer, die gerade online sind

Das ist ganz einfach:
Lege eine Datei mit folgendem Inhalt an (nenne sie rt_users_online und speichere sie in /template/inc_script/frontend_render):

<?php
/************************************************************************************************************************************
REPTAG CODE: {ONLINE}
 
Developer: Joachim Scholtysik
Homepage: http://www.scholtysik.net
phpwcms Version: 1.3.9
running with r401 too
 
last modified (RCS):  08.03.2010
08.03.2010 (RCS): Fix for some installations - not all will write into the scripts folder
Enhanced output: styling the content
 
18.06.2008: Fix: Changed order of the variables $zeiten and $ips in the array
23.05.2008: Added phpwcms constants check written by O.G.
22.05.2008: Initial release
 
Description:
Shows a status line with users who are online.
 
Installation:
            Copy this file into the frontend_render directory
 
            Create a blank file named "count.txt" and place it also in the frontend_render directory (CHMOD: 777)
 
            Place this line into your template or article:
 
            {ONLINE}
************************************************************************************************************************************/
 
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
 
if( ! (strpos($content["all"],'{ONLINE}')===false)) {
   $content["all"] = preg_replace('/\{ONLINE\}/',online(),$content["all"]);
}
 
function online() {
   //$daten = $_SERVER['DOCUMENT_ROOT']."/count.txt";
   $daten = PHPWCMS_ROOT."/count.txt";
   $time  = time();
   $ip    = getenv("REMOTE_ADDR");
   $ablaufzeit = $time - "300";
   $pruefung   = @file($daten);
 
   while (list ($line_num, $line) = @each ($pruefung)) {
      $zeiten = explode("&&",$line);
      if($zeiten[1] <= $ablaufzeit) {
         $fp = fopen( "$daten", "r" );
         $contents = fread($fp, filesize($daten));
         fclose($fp);
         $line=quotemeta($line);
         $string2 = "";
         $replace = ereg_replace($line, $string2, $contents);
         $fh=fopen($daten, "w");
         @flock($fp,2);
         fputs($fh, $replace);
         @flock($fp,3);
         fclose($fh);
      }
   }
   $ippruefung = @file($daten);
   while (list ($line_num, $line) = @each ($ippruefung)) {
      $ips = explode("&&",$line);
      if($ips[0] == $ip) {
         $fp = fopen( "$daten", "r" );
         $contents = fread($fp, filesize($daten));
         fclose($fp);
         $line=quotemeta($line);
         $string2 = "";
         $replace = ereg_replace($line, $string2, $contents);
         $fh=fopen($daten, "w");
         @flock($fp,2);
         fputs($fh, $replace);
         @flock($fp,3);
         fclose($fh);
      }
   }
   $fp = fopen("$daten", "a+");
   flock($fp,2);
   fputs ($fp, "$ip&&$time&&\n");
   flock($fp,3);
   fclose ($fp);
   $anzahldaten = file($daten);
   $anzahl = count($anzahldaten);
   $online="<div style='color:RED;text-align:center'><p><b>$anzahl</b> User online</p></div>";
   return $online;
}
?>

Jetzt noch eine leere Datei “count.txt” ins phpwcms-root (Dateitechte 777) und fertig.
In Deiner Vorlage schreibe {ONLINE} - oder erstelle einen CP HTML mit dem Inhalt {ONLINE}
Pfade und Dateiname sowie output-Aussehen können angepasst werden.

deutsch/ersetzer_rts/frontend_render/benutzer_online.txt · Last modified: 2010/10/09 18:07 by Knut Heermann (flip-flop)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79