>>  Site Map >>  Forums >>  Blocks

Forum module - topics in forum:



Blocks - Having problems with a block? Code doesn't work, get help here.



can u add a scroling code in this block

OK i have this las seen block wich is working good on my site but this one is taking much space so can any one add a svroling code in this block ? block code is
Code: :
<?

// Michael Yarbrough
// opedog@comediccadavers.com
// http://www.comediccadavers.com/

// PHP-Nuke 5.1 Blocks version by Thiago Campos aka Mr. Hemp (mrhemp@amigoz.org)

// Updated to work with PHP-Nuke 6.0 and the phpBB2 forum port by
// Tom Nitzschner (tom@toms-home.com)
// http://bbtonuke.sourceforge.net (http://www.toms-home.com)
//
// As always, make a backup before messing with anything. All code
// release by me is considered sample code only. It may be fully
// functual, but you use it at your own risk, if you break it,
// you get to fix it too. No waranty is given or implied.
//
// Please change your prefix to suit your database.
// Set $numusers to the count of people you want listed +1
//

global $cookie, $prefix, $currentlang, $dbi, $username, $numusers;
$prefix = "nuke";
$numusers = 20;

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

        $username = $cookie[1];

        sql_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))", $dbi);

        if (isset($username)) {
                $ip = getenv("REMOTE_HOST");
                if (empty($ip)) {
                        $ip = getenv("REMOTE_ADDR");
                }

                $result = sql_query("SELECT * FROM $prefix"._lastseen." WHERE username = \"$username\"", $dbi);
                if (sql_num_rows($result, $dbi) > 0) {
                        sql_query("UPDATE $prefix"._lastseen." SET date = " . time() . " WHERE username = \"$username\"", $dbi);
                } else {
                        sql_query("INSERT INTO $prefix"._lastseen." VALUES (\"\", \"$username\", ".time().", \"".$ip."\")", $dbi);
                }
        }
        $content = "";
        $result = sql_query("SELECT username, date FROM $prefix"._lastseen." ORDER BY date DESC limit $numusers", $dbi);
        while (list($uname, $date) = sql_fetch_row($result, $dbi)) {
                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;
                                }
                        }
         $myresult = sql_query("select user_id from nuke_users where (username='$uname')", $dbi);
             list($uid) = sql_fetch_row($myresult, $dbi);
                        $content .= "<font class=tiny><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=".$uid."\">".$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 .= "";


?>


and language file is:
Code: :
<?php

define("_LASTSEENDAYS","days");
define("_LASTSEENDAY","day");
define("_LASTSEENHOURS","hours");
define("_LASTSEENHOUR","hour");
define("_LASTSEENMINUTES","minutes");
define("_LASTSEENMINUTE","minute");
define("_LASTSEENSECONDS","seconds");
define("_LASTSEENAGO","ago");

?>


this is full code of block






This block is ment for php-nuke 6.0 ONLY and poses a security risk if used on 6.5 or above I would recommend finding a version of is and there is one for 6.5+






I dont no what security but this block is working fine on my nco modified php and showing all the deta and i have set this block to show 20 user so when it shows 20 user it become much bigger so i want that this block scroll the user name so it wont take space and i cant found the latest version then this one or any other last seen block working with nco modified




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS