elvira |
18th November 2019 18:05 |
Admin Staff HitRun
Hello all need little help not shows my Hit and Runners, here is code and picture.
Thanks for help
http://shrani.si/f/3D/dr/2sgl8Tno/brez-naslova.png
Code:
require "include/bittorrent.php";
gzip();
dbconn(false);
loggedinorreturn();
maxsysop ();
parked();
if (get_user_class() < UC_MODERATOR)
stderr("Greska", "Zbog zastite privatnosti korisnika, ova statistika je pristupna samo administraciji.");
//=== avatar stuff... hell it's called all over the place... new function add to where ever ya like :-o
$avatar = ($CURUSER['avatars'] == 'no' ? '' : (!$avatar['avatar'] ? '' :
''));
$res = sql_query('SELECT COUNT(*) FROM snatched WHERE hit_and_run != \'0000-00-00 00:00:00\' AND finished = \'yes\'') or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_row($res);
$count = $row[0];
$perpage = 15;
$hit_and_run_rez = sql_query('SELECT torrentid, userid, hit_and_run FROM snatched WHERE hit_and_run != \'0000-00-00 00:00:00\' AND finished = \'yes\' ORDER BY userid '.$pager['limit'].'') or sqlerr(__FILE__, __LINE__);
print("$pagertop");
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "?id=$id&");
stdhead("Hit i Run");
if ($count > $perpage)
print("$pagertop");
print("".(!isset($_GET['really_bad']) ? "Current Hit and Run MoFos who still have a chance" : "Hit and Run MoFos with at least one mark on their perminant record" )."
Show all current hit and runners ||
Show only 'real' hit and runners
".(mysql_num_rows($hit_and_run_rez) > 0 ? "
|
Member |
On Torrent |
Times |
Stats |
Add to shit list |
PM | " : "
No hit and runners at the moment... | ")." ");
while ($hit_and_run_arr = mysql_fetch_assoc($hit_and_run_rez))
{
//=== peers
$peer_rez = sql_query('SELECT seeder FROM peers WHERE userid='.$hit_and_run_arr['userid'].' AND torrent='.$hit_and_run_arr['torrentid']) or sqlerr(__FILE__, __LINE__);
$peer_arr = mysql_fetch_assoc($peer_rez);
//=== if really seeding list them
if ($peer_arr['seeder'] !== 'yes')
{
//=== make sure they are NOT the torrent owner
$res_check_owner = sql_query('SELECT owner,name,added AS torrent_added FROM torrents WHERE id = '.$hit_and_run_arr['torrentid']) or sqlerr(__FILE__, __LINE__);
$arr_check_owner = mysql_fetch_assoc($res_check_owner);
if ($hit_and_run_arr['userid'] !== $arr_check_owner['owner'])
{
//=======change colors
$count2='';
$count2= (++$count2)%2;
$class = 'clearalt'.($count2==0?6:7);
//=== then check to see if there are still seeders / leechers on that torrent
$res_leechers = sql_query('SELECT COUNT(id) FROM peers WHERE torrent = '.$hit_and_run_arr['torrentid'].' AND seeder = \'no\' AND to_go > 0 AND userid <> '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_leechers = mysql_fetch_row($res_leechers);
$res_seeders = sql_query('SELECT COUNT(id) FROM peers WHERE torrent = '.$hit_and_run_arr['torrentid'].' AND seeder = \'yes\' AND userid != '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_seeders = mysql_fetch_row($res_seeders);
//=== get snatched info
$snatched_rez = sql_query('SELECT *, snatched.start_date AS st FROM snatched WHERE torrentid='.$hit_and_run_arr['torrentid'].' AND userid='.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$snatched_arr = mysql_fetch_assoc($snatched_rez);
//=== get user info
$user_rez = sql_query('SELECT id, avatar, username, uploaded, downloaded, class, hit_and_run_total, donor, warned, enabled, chatpost, leechwarn FROM users WHERE id = '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$user_arr = mysql_fetch_assoc($user_rez);
//=== get count of hit and runs by member
$num_hit_and_runs = sql_query('SELECT COUNT(id) FROM snatched WHERE mark_of_cain = \'yes\' AND userid ='.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_hit_and_runs = mysql_fetch_row($num_hit_and_runs);
$ratio_site = member_ratio($user_arr['uploaded'], $user_arr['downloaded']);
$ratio_torrent = member_ratio($snatched_arr['uploaded'], $snatched_arr['downloaded']);
$avatar = avatar_stuff($user_arr);
//=== get times per class
$torrent_needed_seed_time = ($snatched_arr['st'] - $arr_check_owner['torrent_added']);
switch ($user['class'])
{
case UC_USER:
$days_3 = 3*86400; //== 3 days
$days_14 = 2*86400; //== 2 days
$days_over_14 = 86400; //== 1 day
break;
case UC_POWER_USER:
$days_3 = 2*86400; //== 2 days
$days_14 = 129600; //== 36 hours
$days_over_14 = 64800; //== 18 hours
break;
case UC_UPLOADER:
$days_3 = 129600; //== 36 hours
$days_14 = 86400; //== 24 hours
$days_over_14 = 43200; //== 12 hours
break;
case UC_VIP || UC_MODERATOR || UC_ADMINISTRATOR || UC_SYSOP:
$days_3 = 86400; //== 24 hours
$days_14 = 43200; //== 12 hours
$days_over_14 = 21600; //== 6 hours
break;
}
switch(true)
{
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) < 7*86400):
$minus_ratio = ($days_3 - $snatched_arr['seedtime']);
break;
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) < 21*86400):
$minus_ratio = ($days_14 - $snatched_arr['seedtime']);
break;
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) >= 21*86400):
$minus_ratio = ($days_over_14 - $snatched_arr['seedtime']);
break;
}
$minus_ratio = (preg_match('/-/i',$minus_ratio) ? 0 : $minus_ratio);
$color = ($minus_ratio > 0 ? get_ratio_color($minus_ratio) : 'limegreen');
if ($minus_ratio > 0)
{
print("
".$avatar." |
[ " . class_user($row["username"]) . " ] " . $row[username] . "
Total Hit & Runs: ".$arr_hit_and_runs[0]." |
".$arr_check_owner['name']."
Seeding: No Currently: ".($arr_leechers[0] != 1 ? $arr_leechers[0].' Others still leeching this torrent' : $arr_leechers[0].' Other still leeching this torrent')."
Currently: ".($arr_seeders[0] != 1 ? $arr_seeders[0].' Others still seeding this torrent' : $arr_seeders[0].' Other still seeding this torrent')."
**Should still seed for: ".mkprettytime($minus_ratio)." |
Finished DL at: ".get_date_time($snatched_arr['complete_date'])."
Stopped seeding at: ".get_date_time($hit_and_run_arr['hit_and_run'])."
Seeded for: ".mkprettytime($snatched_arr['seedtime'])."
Last torrent action: ".get_date_time($snatched_arr['last_action']). " |
Uploaded: ".mksize($snatched_arr['uploaded'])."
Downloaded ".mksize($snatched_arr['downloaded'])."
Torrent ratio: ".$ratio_torrent."
Site ratio: ".$ratio_site." |
Add to shit list |
PM |
");
}
}//=== end if not owner
}//=== if not seeding list them
}//=== end of while loop
print(" \n");
if ($count > $perpage)
print("$pagerbottom");
stdfoot();
?>
Bump: Ok gays see now help here, why not show me a torrents here is screen
http://shrani.si/f/2/tP/4vbP35LB/brez-naslova.png
Bump: any help gays now I have only error not show me a torrents please look a screen.Thanks
http://shrani.si/f/2/tP/4vbP35LB/brez-naslova.png
Code:
require "include/bittorrent.php";
gzip();
dbconn(false);
loggedinorreturn();
maxsysop ();
parked();
if (get_user_class() < UC_MODERATOR)
stderr("Greska", "Zbog zastite privatnosti korisnika, ova statistika je pristupna samo administraciji.");
function format_username($user, $icons = true) {
global $BASEURL;
$user['id'] = (int)$user['id'];
$user['class'] = (int)$user['class'];
$username = ''.$user['username'].'';
$str = ''.$username.'';
return $str;
}
function member_ratio($up, $down) {
switch(true) {
case ($down > 0 && $up > 0):
$ratio = ''.number_format($up/$down, 3).'';
break;
case ($down > 0 && $up == 0):
$ratio = ''.number_format(1/$down, 3).'';
break;
case ($down == 0 && $up > 0):
$ratio= 'inf';
break;
default:
$ratio = '---';
}
return $ratio;
}
//=== avatar stuff... hell it's called all over the place... new function add to where ever ya like :-o
function avatar_stuff($avatar)
{
global $CURUSER;
$avatar_show = ($CURUSER['avatars'] == 'no' ? '' : (!$avatar['avatar'] ? '' :
''));
return $avatar_show;
}
$res = sql_query('SELECT COUNT(*) FROM snatched WHERE hit_and_run != \'0000-00-00 00:00:00\' AND finished = \'yes\' ORDER BY userid ' . $pager['limit'] . '') or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_row($res);
$count = $row[0];
$perpage = 15;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "?id=$id&");
$hit_and_run_rez = mysql_query('SELECT torrentid, userid, hit_and_run FROM snatched WHERE hit_and_run != \'0000-00-00 00:00:00\' AND finished = \'yes\'') or sqlerr(__FILE__, __LINE__);
stdhead("Hit i Run");
print("".(!isset($_GET['really_bad']) ? "Current Hit and Run MoFos who still have a chance" : "Hit and Run MoFos with at least one mark on their perminant record" )."
Show all current hit and runners ||
Show only 'real' hit and runners
".(mysql_num_rows($hit_and_run_rez) > 0 ? "
|
Member |
On Torrent |
Times |
Stats |
Add to shit list |
PM | " : "
No hit and runners at the moment... | ")." ");
while ($hit_and_run_arr = mysql_fetch_assoc($hit_and_run_rez))
{
//=== peers
$peer_rez = sql_query('SELECT seeder FROM peers WHERE userid='.$hit_and_run_arr['userid'].' AND torrent='.$hit_and_run_arr['torrentid']) or sqlerr(__FILE__, __LINE__);
$peer_arr = mysql_fetch_assoc($peer_rez);
//=== if really seeding list them
if ($peer_arr['seeder'] !== 'yes')
{
//=== make sure they are NOT the torrent owner
$res_check_owner = sql_query('SELECT owner,name,added AS torrent_added FROM torrents WHERE id = '.$hit_and_run_arr['torrentid']) or sqlerr(__FILE__, __LINE__);
$arr_check_owner = mysql_fetch_assoc($res_check_owner);
if ($hit_and_run_arr['userid'] !== $arr_check_owner['owner'])
{
//=== then check to see if there are still seeders / leechers on that torrent
$res_leechers = sql_query('SELECT COUNT(id) FROM peers WHERE torrent = '.$hit_and_run_arr['torrentid'].' AND seeder = \'no\' AND to_go > 0 AND userid <> '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_leechers = mysql_fetch_row($res_leechers);
$res_seeders = sql_query('SELECT COUNT(id) FROM peers WHERE torrent = '.$hit_and_run_arr['torrentid'].' AND seeder = \'yes\' AND userid != '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_seeders = mysql_fetch_row($res_seeders);
//=== get snatched info
$snatched_rez = sql_query('SELECT *, snatched.start_date AS st FROM snatched WHERE torrentid='.$hit_and_run_arr['torrentid'].' AND userid='.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$snatched_arr = mysql_fetch_assoc($snatched_rez);
//=== get user info
$user_rez = sql_query('SELECT id, avatar, username, uploaded, downloaded, class, hit_and_run_total, donor, warned, enabled, chatpost, leechwarn FROM users WHERE id = '.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$user_arr = mysql_fetch_assoc($user_rez);
//=== get count of hit and runs by member
$num_hit_and_runs = sql_query('SELECT COUNT(id) FROM snatched WHERE mark_of_cain = \'yes\' AND userid ='.$hit_and_run_arr['userid']) or sqlerr(__FILE__, __LINE__);
$arr_hit_and_runs = mysql_fetch_row($num_hit_and_runs);
$ratio_site = member_ratio($user_arr['uploaded'], $user_arr['downloaded']);
$ratio_torrent = member_ratio($snatched_arr['uploaded'], $snatched_arr['downloaded']);
$avatar = avatar_stuff($user_arr);
//=== get times per class
$torrent_needed_seed_time = ($snatched_arr['st'] - $arr_check_owner['torrent_added']);
switch ($user_arr['class'])
{
case UC_USER:
$days_3 = 3*86400; //== 3 days
$days_14 = 2*86400; //== 2 days
$days_over_14 = 86400; //== 1 day
break;
case UC_POWER_USER:
$days_3 = 2*86400; //== 2 days
$days_14 = 129600; //== 36 hours
$days_over_14 = 64800; //== 18 hours
break;
case UC_UPLOADER:
$days_3 = 129600; //== 36 hours
$days_14 = 86400; //== 24 hours
$days_over_14 = 43200; //== 12 hours
break;
case UC_VIP || UC_MODERATOR || UC_ADMINISTRATOR || UC_SYSOP:
$days_3 = 86400; //== 24 hours
$days_14 = 43200; //== 12 hours
$days_over_14 = 21600; //== 6 hours
break;
}
switch(true)
{
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) < 7*86400):
$minus_ratio = ($days_3 - $snatched_arr['seedtime']);
break;
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) < 21*86400):
$minus_ratio = ($days_14 - $snatched_arr['seedtime']);
break;
case (($snatched_arr['st'] - $arr_check_owner['torrent_added']) >= 21*86400):
$minus_ratio = ($days_over_14 - $snatched_arr['seedtime']);
break;
}
$minus_ratio = (preg_match('/-/i',$minus_ratio) ? 0 : $minus_ratio);
$color = ($minus_ratio > 0 ? get_ratio_color($minus_ratio) : 'limegreen');
if ($minus_ratio > 0)
{
print("
".$avatar." |
[ ".get_user_class_name($user_arr['class'])." ] " . format_username($user_arr) . "
|
Seeding: No Currently: ".($arr_leechers[0] != 1 ? $arr_leechers[0].' Others still leeching this torrent' : $arr_leechers[0].' Other still leeching this torrent')."
Currently: ".($arr_seeders[0] != 1 ? $arr_seeders[0].' Others still seeding this torrent' : $arr_seeders[0].' Other still seeding this torrent')."
**Should still seed for: ".mkprettytime($minus_ratio)." |
Finished DL at: ".gmdate($snatched_arr['complete_date'])."
Stopped seeding at: ".gmdate($hit_and_run_arr['hit_and_run'])."
Seeded for: ".mkprettytime($snatched_arr['seedtime'])."
Last torrent action: ".gmdate($snatched_arr['last_action'])." |
Uploaded: ".mksize($snatched_arr['uploaded'])."
Downloaded ".mksize($snatched_arr['downloaded'])."
Torrent ratio: ".$ratio_torrent."
Site ratio: ".$ratio_site." |
Add to shit list |
PM |
");
}
}//=== end if not owner
}//=== if not seeding list them
}//=== end of while loop
print(" \n");
if ($count > $perpage)
print("$pagerbottom");
stdfoot();
?>
|