laast seen

Begonnen von Darijo, 10 November 2002, 13:53:51

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

Darijo

Hi Leute,

wie kann ich den im Laast Seen Block die User vom letzten Besuch...(170 Tage)
entfernen, bzw. dass sie nicht mehr angezeigt werden.
ginge es da max die letzten 30 tage angezeigt werden.?
ich habe das vkp 5.5

thx

jubilee

hallo !
Versuch das einmal :
/blocks/block-Last-seen.php so an Zeile 74
das hier :
 
Zitat$content = "\n<!-- $thisfile output start -->\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$result = sql_query("SELECT username, date FROM ${prefix}_lastseen where username not in($excludedusers) ORDER BY date DESC limit 0,$numusers", $dbi);

ändern in das hier :
 
Zitat$content = "\n<!-- $thisfile output start -->\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$decrement= time()- (60*60*24*30);
$result = sql_query("SELECT username, date FROM ${prefix}_lastseen where username not in($excludedusers) AND date > ($decrement) ORDER BY date DESC limit 0,$numusers", $dbi);
 
dann sollte das eigentlich funktionieren (zeigt nur die letzten 30 Tage).
Wenn die die Tage ändern willst nusst Du das hier anpassen :
$decrement= time()- (60*60*24*30); = 30 Tage
$decrement= time()- (60*60*24*50); = 50 Tage etc....
MfG
jubilee

Hi, Danke für die Antwort...
aber bei mir sihet das anders aus.
Anbei mein block Last_Seen.php

<?

// michael yarbrough
// opedog@comediccadavers.com
// http://www.comediccadavers.com/

// php-nuke 5.1 blocks version by thiago campos aka mr. hemp (mrhemp@amigoz.org)

global $cookie, $prefix, $currentlang;


if(file_exists("language/lastseen/lastseen-$currentlang.php")) {
   include("language/lastseen/lastseen-$currentlang.php");
}
else {
   include("language/lastseen/lastseen-english.php");
}

        $numusers = 20;
        $username = $cookie[1];

        mysql_query("create table if not exists $prefix"._lastseen." (id int (15) not null auto_increment, username text not null, date int(15) not null, ip char(50), primary key (id), unique (id))");

        if (isset($username)) {
                $ip = getenv("remote_host");
                if (empty($ip)) {
                        $ip = getenv("remote_addr");
                }

                $result = mysql_query("select * from $prefix"._lastseen." where username = \"$username\"");
                if (mysql_num_rows($result) > 0) {
                        mysql_query("update $prefix"._lastseen." set date = " . time() . " where username = \"$username\"");
                } else {
                        mysql_query("insert into $prefix"._lastseen." values (\"\", \"$username\", ".time().", \"".$ip."\")");
                }
        }

        $content = "";
        $result = mysql_query("select username, date from $prefix"._lastseen." order by date desc limit 0,11");
        while (list($uname, $date) = mysql_fetch_row($result)) {
                if ($uname != $username) {
                        $realtime = time() - $date;
                        $dont = false;

                        // how many days ago?
                        if ($realtime >= (60*60*24*2)) { // if it's been more than 2 days
                                $days = floor($realtime / (60*60*24));
                                $dont = true;
                        } else if ($realtime >= (60*60*24)) { // if it's been less than 2 days
                                $days = 1;
                                $realtime -= (60*60*24);
                        }

                        if (!$dont) {
                                // how many hours ago?
                                if ($realtime >= (60*60)) {
                                        //$content .= " ($realtime) ";
                                        $hours = floor($realtime / (60*60));
                                        $realtime -= (60*60*$hours);
                                }

                                // how many minutes ago?
                                if ($realtime >= 60) {
                                        $mins = floor($realtime / 60);
                                        $realtime -= (60*$mins);
                                }

                                // just a little precation, although i don't *think* mins will ever be 60...
                                if ($mins == 60) {
                                        $mins = 0;
                                        $hours += 1;
                                }
                        }

                        $content .= "<font class=tiny><a href=\"modules.php?name=your_account&op=userinfo&uname=$uname\">".$uname."</a>:";
                        if ($dont) {
                                $content .= " ".$days." "._lastseendays."";
                        } else {
                                if ($days > 0) {
                                        $content .= " ".$days." "._lastseenday."".(($hours == 0 && $mins == 0)?(""):(","));
                                }
                                if ($hours > 0) {
                                        $content .= " ".$hours." ".(($hours > 1)?(""._lastseenhours.""):(""._lastseenhour."")).(($mins == 0)?(""):(","));
                                }
                                if ($mins > 0) {
                                        $content .= " ".$mins." ".(($mins > 1)?(""._lastseenminutes.""):(""._lastseenminute.""))."";
                                }  else { // less than a minute :)
                                        $content .= " ".$realtime." "._lastseenseconds."";
                                }
                        }

                        $content .= " "._lastseenago." </font><br>";

                        $days = 0;
                        $hours = 0;
                        $mins = 0;
                        $dont = false;
                }
        }

        $content .= "";


?>


PS, ich habe noch das VKP 5.5

Darijo

 :exclam:
war nicht eingeloggt...

jubilee

Hallo !
Ich denke einmal, Dein Block ist noch ein wenig älter als der aktuellste
VKP 5.5- LastseenBlock.
Aber ich schau noch einmal.
Melde mich in Kürze wieder.
MfG
jubilee

jubilee

Gut, ich nochmal.
Versuchen wir es so :
/blocks/block-Last_Seen.php so ab Zeile 30
 Die Zeilen :
 
Zitat$content = "";
$result = mysql_query("SELECT username, date FROM $prefix"._lastseen." ORDER BY date DESC limit 0,11");
Bitte so abändern:
 
Zitat$content = "";
$decrement= time()- (60*60*24*30);
$result = mysql_query("SELECT username, date FROM $prefix"._lastseen" WHERE date > ($decrement) ORDER BY date DESC limit 0,11");
So sollte das funktionieren.
Durch das limit 0,11 werden aber höchsten immer nur 11 Einträge angezeigt.
Wie gehabt durch ändern der Zeile $decrement=time()-(60*60*24*30); kann angegeben werden bis zu welcher Zeit (hier 30 Tage) angezeigt wird.
Alles was länger als 30 Tage her ist wird nicht angezeigt !
Versuch einmal (mach aber vorher ein Backup von deinem original-Block ;-)  )
MfG
jubilee