TorrentFlux.com Welcome, Guest. Please login or register.
03-19-2010, 18:11:20
Home Help Search Login Register donate
TorrentFlux Home | TorrentFlux Hosting

+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  Good looking statistics hack
« previous next »
Pages: [1] Go Down Print
Author Topic: Good looking statistics hack  (Read 2663 times)
FLX
Newbie
*
Offline Offline

Posts: 9



View Profile
« on: 05-17-2006, 06:09:01 »

Hey there,

Personally, i hate scrolling.
I hate the fact that i have ~80 torrents listed in my index, and as soon as i want to view the transfer statistics or whatsoever, i have to scroll all the way down to view it. In a pretty crappy way too IMHO.
I also noted that i dont use the user table next to the links, since i'm the only user on it, and i guess most of you guys are also single users.

Anyway, thats why i created this hack:

The items are individually linked to an item corresponding to the value, i.e clicking on the Total Transfer value will automattically take you to drivespace.php

Here is how to implement it:

Open index.php
Search for:
Code:
        echo "<b>"._ONLINE.":</b><br>";

        for($inx = 0; $inx < count($arOnlineUsers); $inx++)
        {
            echo "<a href=\"message.php?to_user=".$arOnlineUsers[$inx]."\">";
            echo "<img src=\"images/user.gif\" width=17 height=14 title=\"\" border=0 align=\"bottom\">". $arOnlineUsers[$inx];
            echo "</a><br>\n";

Add above:
Code:
//Good looking statistics hack by FLX
      if ($cfg['enable_xfer'] == 1) {
        echo "<b>"._TOTALXFER.":</b><br>";
        echo '<a href="drivespace.php"><img src="images/hdd.gif" width="16" height="16" border="0" title="" align="absmiddle">'.formatFreeSpace($xfer_total['total']['total']/(1024*1024)).'</a><br>';
      }
        echo "<b>"._DRIVESPACE.":</b><br>";
        echo '<a href="drivespace.php"><img src="images/hdd.gif" width="16" height="16" border="0" title="" align="absmiddle">'.formatFreeSpace($cfg["free_space"]).'</a><br>';
        echo "<b>"._TOTALSPEED.":</b><br>";
        echo '<a href="xfer.php"><img src="images/download.gif" width="16" height="16" border="0" title="" align="absmiddle">'.number_format($cfg["total_download"]+$cfg["total_upload"], 2).' kB/s</a><br>';
        echo "<b>"._DOWNLOADSPEED.":</b><br>";
        echo '<a href="xfer.php"><img src="images/download.gif" width="16" height="16" border="0" title="" align="absmiddle">'.number_format($cfg["total_download"], 2).' kB/s</a><br>';
        echo "<b>"._UPLOADSPEED.":</b><br>";
        echo '<a href="xfer.php"><img src="images/download.gif" width="16" height="16" border="0" title="" align="absmiddle">'.number_format($cfg["total_upload"], 2).' kB/s</a><br>';
        echo "<b>"._SERVERLOAD.":</b><br>";
        if ($cfg["show_server_load"] && isFile($cfg["loadavg_path"])) {
        $loadavg_array = explode(" ", exec("cat ".$cfg["loadavg_path"]));
        $loadavg = $loadavg_array[2];
        echo '<a href="who.php"><img src="images/who.gif" width="16" height="16" border="0" title="" align="absmiddle">'.$loadavg.'</a><br>';
        } else {
          echo "n/a";
        }
//END

Enjoy this hack  Grin

FLX

p.s you can also remove the online and offline user part, like i did later on, since im the only one using TF
Find:
Code:
        echo "<b>"._ONLINE.":</b><br>";

        for($inx = 0; $inx < count($arOnlineUsers); $inx++)
        {
            echo "<a href=\"message.php?to_user=".$arOnlineUsers[$inx]."\">";
            echo "<img src=\"images/user.gif\" width=17 height=14 title=\"\" border=0 align=\"bottom\">". $arOnlineUsers[$inx];
            echo "</a><br>\n";
        }

        // Does the user want to see offline users?
        if ($cfg["hide_offline"] == false)
        {
            echo "<b>"._OFFLINE.":</b></br>";
            // Show offline users

            for($inx = 0; $inx < count($arOfflineUsers); $inx++)
            {
                echo "<a href=\"message.php?to_user=".$arOfflineUsers[$inx]."\">";
                echo "<img src=\"images/user_offline.gif\" width=17 height=14 title=\"\" border=0 align=\"bottom\">".$arOfflineUsers[$inx];
                echo "</a><br>\n";
            }
        }

Change to:
Code:
/*        echo "<b>"._ONLINE.":</b><br>";

        for($inx = 0; $inx < count($arOnlineUsers); $inx++)
        {
            echo "<a href=\"message.php?to_user=".$arOnlineUsers[$inx]."\">";
            echo "<img src=\"images/user.gif\" width=17 height=14 title=\"\" border=0 align=\"bottom\">". $arOnlineUsers[$inx];
            echo "</a><br>\n";
        }

        // Does the user want to see offline users?
        if ($cfg["hide_offline"] == false)
        {
            echo "<b>"._OFFLINE.":</b></br>";
            // Show offline users

            for($inx = 0; $inx < count($arOfflineUsers); $inx++)
            {
                echo "<a href=\"message.php?to_user=".$arOfflineUsers[$inx]."\">";
                echo "<img src=\"images/user_offline.gif\" width=17 height=14 title=\"\" border=0 align=\"bottom\">".$arOfflineUsers[$inx];
                echo "</a><br>\n";
            }
        } */
« Last Edit: 05-17-2006, 06:35:13 by FLX » Logged
Igloo
Newbie
*
Offline Offline

Posts: 13



View Profile
« Reply #1 on: 05-17-2006, 08:19:34 »

hey FLX.

I just installed your mod and its rather cool  Grin

I have one problem with the server load. It doesnt show up?

Im using Ubuntu Linux (Debian port) with PHP5 and Mysql 2.

Here is an image of what happens.



Thanks,

Igloo
Logged
FLX
Newbie
*
Offline Offline

Posts: 9



View Profile
« Reply #2 on: 05-17-2006, 08:34:11 »

i see total download speed and server load doesnt work.
i guess total download speed doesnt work since i used variables from b4rts mod.
but i see that server load DOES work at the bottom of your page.
my advice is to look up the variable used at the bottom for server load and past it @ the place of my hack.

Regards,

FLX
Logged
Igloo
Newbie
*
Offline Offline

Posts: 13



View Profile
« Reply #3 on: 05-17-2006, 08:41:30 »

I will take a look through here later. And post a version thats availible without any other mods applied.

- Igloo
Logged
FLX
Newbie
*
Offline Offline

Posts: 9



View Profile
« Reply #4 on: 05-17-2006, 08:43:35 »

Thanks alot Smiley
Logged
ollie
Newbie
*
Offline Offline

Posts: 1



View Profile
« Reply #5 on: 05-17-2006, 09:20:51 »

Thanks for this hack, its gonna be the first one i implement myself, and one that i really want as i too am sick of scrolling down to get a jist of whats going on.

I too got the same problem as Igloo sortof. All the stats appear, but they all read zero, and i'm a total php novice (any coding for that matter).

i would also really like to change the font size, if poss.

cheers guys

Logged
deags
Full Member
***
Offline Offline

Posts: 121



View Profile
« Reply #6 on: 05-18-2006, 03:10:00 »

not for me but very nice looking
Logged
bubba1977
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 4




View Profile
« Reply #7 on: 06-10-2006, 11:34:36 »

Thanks for this.

Added easily enough but doesnt show total up/down speeds they show as 0.00kb/s eventho i have torrents running.

any ideas?

also when i click the images next to up/down it sends me to xfer.php but i dunno where to get that php file from.
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP