More clients

Started by Payaa, December 13, 2012, 11:31:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Payaa

#5
I got it! Thx m8 :)

elephant

bt_clients_functions.php is only useful if you don't store the useragent.

While it is convenient to do so, a varchar useragent field will make the peers table structure dynamic which may bring with it certain disadvantages depending on your choice of storage engine:
http://stackoverflow.com/questions/147315/mysql-row-format-difference-between-fixed-and-dynamic . The peer_id field however, is always of a fixed length and all you require to work out the client name.

So you are right that it is unnecessary as it currently stands, but you can make changes to increase database performance, and space utilisation while using bt_clients_functions.php to maintain frontend functionality.

Payaa

#3
Oh my friend elephant! Yo baby! U are the best thanks!
No need explode :)

Its work like this:
//$mc->delete('agent'.$id);
$agent_get = $mc->get('agent'.$id);
    if ($agent_get === false) {
$adatleker = sqli_query("SELECT GROUP_CONCAT(DISTINCT agent ORDER BY agent ASC SEPARATOR '||') AS ua FROM peers WHERE userid=" . sqlesc($user["id"]) . "") or print(mysqli_error());
$megvan = mysqli_fetch_assoc($adatleker);
$mc->set('agent'.$id, $megvan, 3600);      } else
$megvan = $agent_get;
$agent = $megvan["ua"];


Works very well. I seed torrents from 2 places and before this code just shown one but now show like this:
Client(s): Deluge 1.3.5||Transmission/2.72

One little question coz I want to understand:
Why we need bt_client_function.php in peerlist?

Coz we have now (almost) like this:
$s .= "<td align='left'$highlight>" . htmlspecialchars(getagent($e["agent"], $e["peer_id"])) . "</td>\n";

But we can do just this:
$s .= "<td align='left'$highlight>" . htmlspecialchars($e["agent"]) . "</td>\n";

Or this if we do not want the clients build number just version number:
$Chunk = explode("(", $e["agent"]);
                $s .= "<td align='left'$highlight>" . htmlspecialchars($Chunk[0]) . "</td>\n";

and by this change there is no more "Unknown client".

So somebody explain me why use the bt_clients_function???

elephant

Something like:

SELECT GROUP_CONCAT(DISTINCT useragent ORDER BY useragent ASC SEPARATOR '|') AS ua FROM peers WHERE uid = $uid

I don't use a standard announce so I am guessing those field names are correct.

Then you just run explode() on the results with the pipe separator.

Payaa

#1
Yo!

I see a mod in a site that if u use more clients at the same time then all shown in userdetails page not only 1 like now.

What i mean? Example if u use utorrent from home and a deluge from a seedbox then your page shown like this:
Used client(s): utorrent x.x.x || deluge x.x

So anyone get idea how to?
Thx.