Stads tool on a tracker width more than 1000 users will take down your MySQL server becouse of multiple connections to it.
Ok. Here a alternate working one.
Thanx to my good friend Jason.
Put both files in
/admin/
stats.php
PHP Code:
<?
/***********************************************/
/* Based on */
/* MrDecoder - wWw.Fearless-Releases.CoM */
/* Fynnon - wWw.BvList.CoM */
/* Working Stats tool Coded by Jason&kale */
/***********************************************/
if (!defined ('STAFF_PANEL_TSSEv53'))
{
exit ('<font face=\'verdana\' size=\'2\' color=\'darkred\'><b>Error!</b> Direct initialization of this file is not allowed.</font>');
}
define ('S_VERSION', '0.3 by ***');
require_once INC_PATH . '/functions_mkprettytime.php';
stdhead ('Stats');
echo '
';
echo '<S';
echo 'TYLE TYPE="text/css" MEDIA=screen>
<!--
a.subheaderlink:link, a.subheaderlink:visited{
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
a.subheaderlink:hover {
text-decoration: underline;
}
-->
</STYLE>';
($res = sql_query ('SELECT owner, COUNT(DISTINCT id) AS numberOfTorrents
FROM torrents
GROUP BY owner
ORDER BY numberOfTorrents DESC') );
if (mysql_num_rows ($res) == 0)
{
stdmsg ('Sorry...', 'No uploaders.');
}
else
{
_form_header_open_ ('Uploader Activity');
begin_table (true);
print '<tr><td class=subheader>Username</td><td class=subheader>Torrents</td></tr>';
while ($uper = mysql_fetch_array ($res))
{
$uname = '' . $uper['owner'];
$res2 = sql_query ('SELECT username FROM users WHERE id = ' . $uper['owner']);
if ($namequery = mysql_fetch_array ($res2) )
{
$uname = '' . $namequery['username'];
}
print '<tr>';
print '<td><a href=index.php?act=statsinfo&user=' . $uper['owner'] . '>' . $uname . '</a></td>';
print '<td align=right>' . $uper['numberOfTorrents'] . '</td>';
print '</tr>';
}
end_table ();
_form_header_close_ ();
echo '<br />';
}
stdfoot ();
exit ();
?>
statsinfo.php
PHP Code:
<?
/***********************************************/
/* Based on */
/* MrDecoder - wWw.Fearless-Releases.CoM */
/* Fynnon - wWw.BvList.CoM */
/* Working Stats tool Coded by Jason&kale */
/***********************************************/
if (!defined ('STAFF_PANEL_TSSEv53'))
{
exit ('<font face=\'verdana\' size=\'2\' color=\'darkred\'><b>Error!</b> Direct initialization of this file is not allowed.</font>');
}
define ('S_VERSION', '0.3 by ***');
require_once INC_PATH . '/functions_mkprettytime.php';
stdhead ('Stats');
echo '
';
echo '<S';
echo 'TYLE TYPE="text/css" MEDIA=screen>
<!--
a.subheaderlink:link, a.subheaderlink:visited{
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
a.subheaderlink:hover {
text-decoration: underline;
}
-->
</STYLE>
';
($res = sql_query ('SELECT COUNT(*) FROM torrents') OR sqlerr (__FILE__, 39));
$n = mysql_fetch_row ($res);
$n_tor = $n[0];
($res = sql_query ('SELECT COUNT(*) FROM peers') OR sqlerr (__FILE__, 43));
$n = mysql_fetch_row ($res);
$n_peers = $n[0];
$uporder = $_GET['uporder'];
$catorder = $_GET['catorder'];
if ($uporder == 'lastul')
{
$orderby = 'last DESC, name';
}
else
{
if ($uporder == 'torrents')
{
$orderby = 'n_t DESC, name';
}
else
{
if ($uporder == 'peers')
{
$orderby = 'n_p DESC, name';
}
else
{
$orderby = 'name';
}
}
}
$tmpUser = '' . $_GET['user'];
if($tmpUser == '')
{
$tmpUser = '1';
}
else
{
$tmpUser = mysql_real_escape_string($tmpUser);
}
$query = '' . '
SELECT u.id, u.username AS name, g.canupload, g.namestyle, MAX(t.added) AS last, COUNT(DISTINCT t.id) AS n_t, COUNT(p.id) as n_p
FROM users as u
LEFT JOIN torrents as t ON u.id = t.owner
LEFT JOIN peers as p ON t.id = p.torrent
LEFT JOIN usergroups as g ON u.usergroup = g.gid
WHERE g.canupload = \'yes\' AND u.id = ' . $tmpUser . '
GROUP BY u.id
ORDER BY ' . $orderby
;
($res = sql_query ($query) OR sqlerr (__FILE__, 64));
if (mysql_num_rows ($res) == 0)
{
stdmsg ('Sorry...', 'No uploaders.');
}
else
{
_form_header_open_ ('Uploader Activity');
begin_table (true);
print '<tr>
<td class=subheader>Uploader</td>
<td class=subheader>Last Upload</td>
<td class=subheader>Torrents</td>
<td class=subheader>Perc.</td>
<td class=subheader>Peers</td>
<td class=subheader>Perc.</td>
</tr>';
while ($uper = mysql_fetch_array ($res))
{
print '' . '<tr><td><a href=' . $BASEURL . '/userdetails.php?id=' . $uper['id'] . '><b>' . get_user_color ($uper['name'], $uper['namestyle']) . '</b></a></td>
';
print '<td ' . ($uper['last'] ? '>' . $uper['last'] . ' (' . mkprettytime (time () - strtotime ($uper['last'])) . ')' : 'align=center>---') . '</td>
';
print '<td align=right>' . $uper['n_t'] . '</td>
';
print '<td align=right>' . (0 < $n_tor ? number_format (100 * $uper['n_t'] / $n_tor, 1) . '%' : '---') . '</td>
';
print '<td align=right>' . $uper['n_p'] . '</td>
';
print '<td align=right>' . (0 < $n_peers ? number_format (100 * $uper['n_p'] / $n_peers, 1) . '%' : '---') . '</td></tr>
';
}
end_table ();
_form_header_close_ ();
echo '<br />';
}
stdfoot ();
exit ();
?>