Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #1  
Old 18th November 2019, 18:05
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default Admin Staff HitRun
Hello all need little help not shows my Hit and Runners, here is code and picture.


Thanks for help


Click the image to open in full size.

Code:
<?php
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'] ? '<img width="100" src="pic/default_avatar.png" alt="No Avatar" />' : 
    '<img width="100" src="'.htmlspecialchars($avatar['avatar']).'" alt="Member 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("<h2>".(!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" )."</h2><br /> 
    <a class='altlink' href='?'>Show all current hit and runners</a> || 
    <a class='altlink' href='?really_bad=show_them'>Show only 'real' hit and runners</a><br /><br />
    <table>".(mysql_num_rows($hit_and_run_rez) > 0 ? "
    <tr>
        <td  class='colhead'></td>
        <td  class='colhead'><b>Member</b></td>
        <td class='colhead'><b>On Torrent</b></td>        
        <td class='colhead'><b>Times</b></td>
        <td class='colhead'><b>Stats</b></td>
        <td class='colhead'><b>Add to shit list</b></td>
        <td class='colhead'><b>PM</b></td>" : "<tr>
        <td>No hit and runners at the moment...</td>")."</tr>");

    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("<tr>
    <td class='".$class."' valign='middle' align='left'>".$avatar."</td>
    <td  class='".$class."' valign='middle' align='left'><a class='altlink' href='userdetails.php?id=".$hit_and_run_arr['userid']."&amp;completed=1'></a>
    [ " . class_user($row["username"]) . " ] " . $row[username] . "<br />
    Total Hit & Runs: <b>".$arr_hit_and_runs[0]." </b></td>
    <td  class='".$class."' valign='middle' align='left'><a class='altlink' href='details.php?id=".$hit_and_run_arr['torrentid']."'>".$arr_check_owner['name']."</a><br />
    Seeding: No <br /><font color='red'>Currently: ".($arr_leechers[0] != 1 ? $arr_leechers[0].' Others still leeching this torrent' : $arr_leechers[0].' Other still leeching this torrent')."<br />
    </font><font color='limegreen'>Currently: ".($arr_seeders[0] != 1 ? $arr_seeders[0].' Others still seeding this torrent' : $arr_seeders[0].' Other still seeding this torrent')."</font><br /><br />
    **Should still seed for: ".mkprettytime($minus_ratio)."</td>
    <td class='".$class."' valign='middle' align='left'><b><font class='small' color='red'>Finished DL at: ".get_date_time($snatched_arr['complete_date'])." </font><br />
    <font class='small' color='orange'>Stopped seeding at: ".get_date_time($hit_and_run_arr['hit_and_run'])."</font><br />
    <font class='small' color='limegreen'>Seeded for: ".mkprettytime($snatched_arr['seedtime'])."</font><br />
    <font class='small' color='pink'>Last torrent action: ".get_date_time($snatched_arr['last_action']). "</font></b> </td>
    <td class='".$class."' valign='middle' align='left'><font class='small' color='limegreen'>Uploaded: ".mksize($snatched_arr['uploaded'])."</font><br />
    <font class='small' color='red'>Downloaded  ".mksize($snatched_arr['downloaded'])."</font><br />
    Torrent ratio:  <font class='small' color='".get_ratio_color($ratio_torrent)."'>".$ratio_torrent."</font><br />
    Site ratio:  <font class='small' color='".get_ratio_color($ratio_site)."' title='Includes all bonus and karma stuff'>".$ratio_site."</font></td>
    <td class='".$class."' valign='middle' align='left'><a class='altlink' href='shit_list.php?action=new&amp;shit_list_id=".$hit_and_run_arr['userid']."&amp;return_to=hit_and_runners.php'>
    Add to shit list</a></td>
    <td class='".$class."' valign='middle' align='left'><a class='altlink' href='sendmessage.php?receiver=".$hit_and_run_arr['userid']."'>PM</a> </td>
    </tr>");                    
    }
    
}//=== end if not owner
}//=== if not seeding list them
}//=== end of while loop
print("</table>\n");
if ($count > $perpage)
print("$pagerbottom");
stdfoot();
?>
Bump: Ok gays see now help here, why not show me a torrents here is screen


Click the image to open in full size.

Bump: any help gays now I have only error not show me a torrents please look a screen.Thanks


Click the image to open in full size.


Code:
<?php
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 = '<span style="color:#'.get_user_class_color($user['class']).';"><b>'.$user['username'].'</b></span>';
        $str = '<span style="white-space: nowrap;"><a class="'.$user['id'].'" href="'.$BASEURL.'/userdetails.php?id='.$user['id'].'"target="_blank">'.$username.'</a>';
        return $str;
}

function member_ratio($up, $down) {
    switch(true) {
        case ($down > 0 && $up > 0): 
        $ratio = '<span style="color:'.get_ratio_color($up/$down).';">'.number_format($up/$down, 3).'</span>';
        break;
        case ($down > 0 && $up == 0): 
        $ratio = '<span style="color:'.get_ratio_color(1/$down).';">'.number_format(1/$down, 3).'</span>';
        break;
        case ($down == 0 && $up > 0): 
        $ratio=  '<span style="color: '.get_ratio_color($up/1).';">inf</span>';
        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'] ? '<img width="100" src="pic/default_avatar.png" alt="No Avatar" />' : 
    '<img width="100" src="'.htmlspecialchars($avatar['avatar']).'" alt="Member 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("<h2>".(!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" )."</h2><br /> 
    <a class='altlink' href='?'>Show all current hit and runners</a> || 
    <a class='altlink' href='?really_bad=show_them'>Show only 'real' hit and runners</a><br /><br />
    <table>".(mysql_num_rows($hit_and_run_rez) > 0 ? " 
    <tr>
        <td class='colhead'></td>
        <td class='colhead'><b>Member</b></td>
        <td class='colhead'><b>On Torrent</b></td>        
        <td class='colhead'><b>Times</b></td>
        <td class='colhead'><b>Stats</b></td>
        <td class='colhead'><b>Add to shit list</b></td>
        <td class='colhead'><b>PM</b></td>" : "<tr>
        <td>No hit and runners at the moment...</td>")."</tr>");

    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("<tr>
    <td class='".$class."' valign='middle' align='left'>".$avatar."</td>
    <td  class='".$class."' valign='middle' align='left'><a class='altlink' href='userdetails.php?id=".$hit_and_run_arr['userid']."&amp;completed=1'></a>
    [ ".get_user_class_name($user_arr['class'])." ] " . format_username($user_arr) . "<br />
    <td  class='".$class."' valign='middle' align='left'><a class='altlink' href='details.php?id=".$hit_and_run_arr['torrentid']."'></a><br />
    Seeding: No <br /><font color='red'>Currently: ".($arr_leechers[0] != 1 ? $arr_leechers[0].' Others still leeching this torrent' : $arr_leechers[0].' Other still leeching this torrent')."<br />
    </font><font color='limegreen'>Currently: ".($arr_seeders[0] != 1 ? $arr_seeders[0].' Others still seeding this torrent' : $arr_seeders[0].' Other still seeding this torrent')."</font><br /><br />
    **Should still seed for: ".mkprettytime($minus_ratio)."</td>
    <td class='".$class."' valign='middle' align='left'><b><font class='small' color='red'>Finished DL at: ".gmdate($snatched_arr['complete_date'])." </font><br />
    <font class='small' color='orange'>Stopped seeding at: ".gmdate($hit_and_run_arr['hit_and_run'])."</font><br />
    <font class='small' color='limegreen'>Seeded for: ".mkprettytime($snatched_arr['seedtime'])."</font><br />
    <font class='small' color='pink'>Last torrent action: ".gmdate($snatched_arr['last_action'])."</font></b> </td>
    <td class='".$class."' valign='middle' align='left'><font class='small' color='limegreen'>Uploaded: ".mksize($snatched_arr['uploaded'])."</font><br />
    <font class='small' color='red'>Downloaded  ".mksize($snatched_arr['downloaded'])."</font><br />
    Torrent ratio:  <font class='small' color='".get_ratio_color($ratio_torrent)."'>".$ratio_torrent."</font><br />
    Site ratio:  <font class='small' color='".get_ratio_color($ratio_site)."' title='Includes all bonus and karma stuff'>".$ratio_site."</font></td>
    <td class='".$class."' valign='middle' align='left'><a class='altlink' href='shit_list.php?action=new&amp;shit_list_id=".$hit_and_run_arr['userid']."&amp;return_to=hit_and_runners.php'>
    Add to shit list</a></td>
    <td class='".$class."' valign='middle' align='left'><a class='altlink' href='sendmessage.php?receiver=".$hit_and_run_arr['userid']."'>PM</a> </td>
    </tr>");                    
    }
    
}//=== end if not owner
}//=== if not seeding list them
}//=== end of while loop
print("</table>\n");
if ($count > $perpage)
print("$pagerbottom");
stdfoot();
?>
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 20:47. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.