You must have snatchlist installed
Always remember to make a backup
Credit to original coders some from slab, spirtblue and some bits from mircomonkey
You can import the table bits you need or i find it easier to remove the snatched table and just import the full new table
SQL
Because we remove the table it shows a few errors but this is nothing to worry about just empty the sqlerr table once the new snatched table is added
Add in config.php :
This is where everything is set - ban is at 50 be careful here to be reasonable you dont want to ban all members
In admincp.php add the link
Add at the end before ?> :
in cleanup.php find:
replace with :
search :
in account-details search :
Add after :
find
Add Below
The next is optional to improve the torrent completed page
In torrents-completed find
Replace with
Find
replace with
Find
Replace with
Add image hitnrun_list.png to images/admin folder[ATTACH]31._xfImport[/ATTACH]
Add required.php to root
Always remember to make a backup
Credit to original coders some from slab, spirtblue and some bits from mircomonkey
You can import the table bits you need or i find it easier to remove the snatched table and just import the full new table
SQL
CREATE TABLE `snatched` (
`sid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tid` int(11) unsigned NOT NULL DEFAULT '0',
`uid` int(11) unsigned NOT NULL DEFAULT '0',
`stime` int(11) unsigned NOT NULL DEFAULT '0',
`utime` int(11) unsigned NOT NULL DEFAULT '0',
`ltime` int(11) unsigned NOT NULL DEFAULT '0',
`uload` bigint(20) unsigned NOT NULL DEFAULT '0',
`dload` bigint(20) unsigned NOT NULL DEFAULT '0',
`completed` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`hnr` enum('no','yes') COLLATE utf8_bin NOT NULL DEFAULT 'no',
`done` enum('yes','no') COLLATE utf8_bin NOT NULL DEFAULT 'no',
`hitrun` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`hitrunwarn` enum('yes','pending','no') COLLATE utf8_bin NOT NULL DEFAULT 'no',
PRIMARY KEY (`sid`),
UNIQUE KEY `tid_uid` (`tid`,`uid`),
KEY `completed` (`completed`),
KEY `tid` (`tid`),
KEY `uid` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `users` ADD `hitruns` tinyint( 3 ) unsigned NOT NULL default '0';Because we remove the table it shows a few errors but this is nothing to worry about just empty the sqlerr table once the new snatched table is added
Add in config.php :
This is where everything is set - ban is at 50 be careful here to be reasonable you dont want to ban all members
//hit mod
$site_config["hnr_deadline"] = 7*86400; // 7 days to hit the seed target
$site_config["hnr_seedtime"] = 172800; // target is to seed for 48 hours
$site_config["hnr_warn"] = 5; // 5 hit & runs then warned
$site_config["hnr_stop_dl"] = 5; // After 5 H & R stop downloading
$site_config["hnr_ban"] = 50; // After 50 H&R they are banned
// hit endIn admincp.php add the link
<td align="center"><a href=admincp.php?action=hnr><img src="images/admin/hitnrun_list.png" border=0 width=32 height=32><br />List of Hit and Run</a><br /></td>Add at the end before ?> :
// Start List of Hit and Run
if ($action=="hnr")
{
stdhead("List of Hit and Run");
navmenu();
if (get_user_class() < 6)
show_error_msg("Acces Denied", 1);
begin_frame("List of Hit and Run");
$ressy = SQL_Query_exec("SELECT COUNT(*) FROM snatched where hnr='yes' $limit");
$rowh = mysql_fetch_array($ressy);
$count = $rowh[0];
$hnrperpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($hnrperpage, $count, "admincp.php?action=hnr&");
print("<div style='margin-top:10px; margin-bottom:10px' align='center'><font size=2>We have <font color=red><b>$count</b></font> User".($count > 1 ? "s" : "")." with Hit and Run</font></div>");
$sql = "SELECT *,s.tid FROM users u left join snatched s on s.uid=u.id where hnr='yes' ORDER BY s.uid DESC $limit";
$result = SQL_Query_exec($sql);
if( mysql_num_rows($result) != 0 )
{
print("$pagertop");
print'<table class=table_table border=0 cellspacing=0 cellpadding=4 align=center>';
print'<tr>';
print'<td class=table_head><b>User</b></td>';
print'<td class=table_head><b>Torrent</b></td>';
print'<td class=table_head><b>Uploaded</b></td>';
print'<td class=table_head><b>Downloaded</b></td>';
print'<td class=table_head><b>Seed Time</b></td>';
print'<td class=table_head align=center><b>Started</b></td>';
print'<td class=table_head align=center><b>Last Action</b></td>';
print'</tr>';
while($row = mysql_fetch_assoc($result))
{
if ($site_config['MEMBERSONLY'])
{
$sql1 = "SELECT id, username FROM users WHERE id = $row[uid]";
$result1 = SQL_Query_exec($sql1);
$row1 = mysql_fetch_assoc($result1);
}
if ($row1['username'])
print'<tr><td class=table_col1><a href="account-details.php?id=' . $row['uid'] . '"><b>'.class_user($row1['username']).'</b></a></td>';
else
print'<tr><td class=table_col1>'.$row[ip].'</td>';
$sql2 = "SELECT name FROM torrents WHERE id = $row[tid]";
$result2 = SQL_Query_exec($sql2);
while ($row2 = mysql_fetch_assoc($result2))
{
$smallname =substr(htmlspecialchars($row2["name"]) , 0, 35);
if ($smallname != htmlspecialchars($row2["name"])) { $smallname .= '...'; }
$stime = mkprettytime($row[ltime]);
$startdate = utc_to_tz(get_date_time($row['stime']));
$lastaction = utc_to_tz(get_date_time($row['utime']));
print'<td class=table_col2><a href="torrents-details.php?id=' . $row['tid'] . '">' . $smallname . '</td>';
print'<td class=table_col1><font color=limegreen>' . mksize($row['uload']) . '</font></td>';
print'<td class=table_col2><font color=red>' . mksize($row['dload']) . '</font></td>';
print'<td class=table_col1>'.(is_null($stime)?'0':$stime).'</td>';
print'<td align=center class=table_col2>'.date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($startdate)).'</td>';
print'<td align=center class=table_col1>'.date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($lastaction)).'</td>';
print'</tr>';
}
}
print'</table>';
print("$pagerbottom");
}
else
{
print'<b><center>No recordings of Hit and Run</center></b><br />';
}
end_frame();
stdfoot();
}
// End List of Hit and Runin cleanup.php find:
//REMOVE WARNING
$res = SQL_Query_exec("SELECT users.id, users.username FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND warned = 'yes' AND enabled='yes' AND uploaded / downloaded >= $minratio AND downloaded >= $downloaded");replace with :
// REMOVE WARNINGS // hit mod
$res = SQL_Query_exec("SELECT users.id, users.username, warnings.expiry FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type != 'Poor Ratio' AND type != 'HnR' AND warned = 'yes' AND enabled='yes' AND warnings.active = 'yes' AND warnings.expiry < '".get_date_time()."'"); // ehdsearch :
//HIT & RUN mod
$timenow = gmtime();
SQL_Query_exec("UPDATE snatched SET hnr = 'yes' WHERE completed = '1' AND hnr = 'no' AND uload < dload AND $timenow - $site_config[hnr_deadline] > stime AND $site_config[hnr_seedtime] > ltime AND done='no'");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND uload >= dload");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND ltime >= $site_config[hnr_seedtime]");
$a = SQL_Query_exec("SELECT DISTINCT uid FROM snatched WHERE hnr = 'yes' AND done='no'");
if ( mysql_num_rows($a) > 0 ) :
while ($b = mysql_fetch_row($a)) :
$c = SQL_Query_exec("SELECT COUNT( hnr ) FROM snatched WHERE uid = $b[0] AND hnr = 'yes'");
$d = mysql_fetch_row($c);
$count = $d[0];
$user = $b[0];
$length = $site_config["hnr_disabled"];
$expiretime = gmdate("Y-m-d H:i:s", $timenow + $length);
$e = SQL_Query_exec("SELECT type, active FROM warnings WHERE userid = '$user'");
$f = mysql_fetch_row($e);
$type = $f[0];
$active = $f[1];
//warn
if ( $count >= $site_config["hnr_warn"] && $type != "HnR" ) :
$reason = "".T_("CLEANUP_WARNING_FOR_ACCUMULATING")." ".$site_config['hnr_warn']." H&R.";
$subject = "".T_("CLEANUP_WARNING_FOR_H&R")."";
$msg = "".T_("CLEANUP_YOU_HAVE_BEEN_WARNEWD_ACCUMULATED")." ".$site_config['hnr_warn']." ".T_("CLEANUP_H&R_INVITE_CHECK_RULE")."\n".T_("CLEANUP_MSG_WARNING_7_DAYS_BANNED")."";
$rev = SQL_Query_exec("SELECT enabled FROM users WHERE id = $user");
$rov = mysql_fetch_assoc($rev);
if ($rov["enabled"] == "yes") :
SQL_Query_exec("UPDATE users SET warned = 'yes' WHERE id = $user");
SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES ($user,".sqlesc($reason).",'".get_date_time()."','".$expiretime."','0','HnR')");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 1)");
endif;
endif;
//Unwarned
if ( $count < $site_config["hnr_warn"] && $type == "HnR") :
$subject = "".T_("CLEANUP_REMOVAL_OF_H&R_WARNING")."";
$msg = "".T_("CLEANUP_YOU_NOW_HAVE_LESS_THAN")." ".$site_config['hnr_warn']." H&R.\n".T_("CLEANUP_YOUR_WARNING_FOR_H&R_HAS_REMOVED")."";
SQL_Query_exec("UPDATE users SET warned = 'no' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 1)");
endif;
//Ban
if ( $count >= $site_config["hnr_ban"] ) :
$g = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $user");
$h = mysql_fetch_row($g);
$modcomment = $h[2];
$modcomment = gmdate("d/m/Y") . " - ".T_("CLEANUP_BANNED_FOR")." " .$count. " H&R.\n " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
write_log(T_("CLEANUP_THE_MEMBER")." <a href='account-details.php?id=".$user."'>".$h[0]."</a> ".T_("CLEANUP_HAS_BEEN_BANNED_REASON")." ".$count." H&R.");
$subject = "".T_("CLEANUP_YOUR_ACCOUNT")." $site_config[SITENAME] ".T_("CLEANUP_HAS_BEEN_DISABLED")."";
$body = "".T_("CLEANUP_YOU_WERE_BANNED_FOLLOWING")."\n
------------------------------
\n/".T_("CLEANUP_YOU_HAVE_ACCUMULATED")." $count H&R.\n
------------------------------
\n".T_("CLEANUP_YOU_CAN_CONTACT_BY_LINK")." :
".$site_config['SITEURL']."/contact.php
\n\n\n".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($h[1], "$subject", "$body", "".T_("OF").": $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endif;
endwhile;
endif;
//Ban warned
$timenow = gmtime();
$k = SQL_Query_exec("SELECT userid FROM warnings WHERE type = 'HnR' AND active = 'yes' AND UNIX_TIMESTAMP(expiry) < $timenow");
if ( mysql_num_rows($k) > 0 ) :
while ($l = mysql_fetch_row($k)) :
$m = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $l[0] AND enabled = 'yes' AND warned = 'yes'");
$n = mysql_fetch_row($m);
$modcomment = $n[2];
$modcomment = gmdate("d/m/Y") . " - ".T_("CLEANUP_BANNED_FOR_EXPIRED_H&R_WARNING_TIMEOUT")."\n " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $l[0]");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $l[0] AND type = 'HnR'");
write_log(T_("CLEANUP_THE_MEMBER")." <a href='account-details.php?id=".$l[0]."'>".$n[0]."</a> ".T_("CLEANUP_HAS_BEEN_BANNED_TIMEOUT")."");
$subject = "".T_("CLEANUP_YOUR_ACCOUNT")." $site_config[SITENAME] ".T_("CLEANUP_HAS_BEEN_DISABLED")."";
$body = "".T_("CLEANUP_YOU_WERE_BANNED_FOLLOWING")."\n
------------------------------
\n".T_("CLEANUP_TIMEOUT_WARNING_H&R_EXPIRED")."\n
------------------------------
\n".T_("CLEANUP_YOU_CAN_CONTACT_BY_LINK")." :
".$site_config['SITEURL']."/contact.php
\n\n\n".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($n[1], "$subject", "$body", "".T_("OF").": $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endwhile;
endif;
// END HIT & RUNin account-details search :
$numtorrents = get_row_count("torrents", "WHERE owner = $id");Add after :
//h&r mod
$qry = SQL_Query_exec("SELECT COUNT(`hnr`) FROM `snatched` WHERE `uid` = '$id' AND `hnr` = 'yes'");
$res = mysql_fetch_row($qry);
$hnr = $res[0];
//End h&rfind
<?php echo T_("RATIO"); ?>: <?php echo $ratio; ?><br />Add Below
<?php echo T_("H&R"); ?>: <?php echo $hnr; ?><br />The next is optional to improve the torrent completed page
In torrents-completed find
<tr>
<th class="table_head"><?php echo T_("USERNAME"); ?></th>
<th class="table_head"><?php echo T_("CURRENTLY_SEEDING"); ?></th>
<th class="table_head"><?php echo T_("DATE_COMPLETED"); ?></th>
<th class="table_head"><?php echo T_("RATIO"); ?></th>
</tr>Replace with
<tr>
<td class="table_head"> <b><?php echo T_("USERNAME"); ?></b> | <b><?php echo T_("RATIO"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("STARTED"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("COMPLETED"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("LAST_ACTION"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("UPLOADED"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("DOWNLOADED"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("RATIO"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("SEED_TIME"); ?></b> </td>
<td class="table_head" align="center"> <b><?php echo T_("SEEDING"); ?></b> </td>
<td class="table_head" align="center"> <font color="#FF1200"><b>H</b><small>&</small><b>R</b></font> </td>
</tr>Find
<td class="table_col1"><a href="account-details.php?id=<?php echo $row["id"]; ?>"><?php echo $row["username"]; ?></a></td>
<td class="table_col2"><?php echo $peers; ?></td>
<td class="table_col1"><?php echo utc_to_tz($row["date"]); ?></td>
<td class="table_col2"><?php echo number_format($ratio, 2); ?></td>replace with
<td class="table_col1"><a href="account-details.php?id=<?php echo $row["id"]; ?>"><b><?php echo $row["username"]; ?></b></a> | <b><?php echo $ratio; ?></b></td>
<td class="table_col2" align="center"><?php echo date('d.M.Y<\\b\\r>H:i', sql_timestamp_to_unix_timestamp($startdate));?></td>
<td class="table_col1" align="center"><?php echo $comdate; ?></td>
<td class="table_col2" align="center"><?php echo date('d.M.Y<\\b\\r>H:i', sql_timestamp_to_unix_timestamp($lastaction));?></td>
<td class="table_col1" align="center"><?php echo $upload; ?></td>
<td class="table_col2" align="center"><?php echo $download; ?></td>
<td class="table_col1" align="center"><b><?php echo $tratio; ?></b></td>
<td class="table_col2" align="center"><?php echo $seedtime; ?></td>
<td class="table_col1" align="center"><?php echo $peers; ?></td>
<td class="table_col2" align="center"><b><?php echo $hnr; ?></b></td>Find
$ratio = ($row["downloaded"] > 0) ? $row["uploaded"] / $row["downloaded"] : 0;
$peers = (get_row_count("peers", "WHERE torrent = '$id' AND userid = '$row[id]' AND seeder = 'yes'")) ? "<font color='green'>" . T_("YES") . "</font>" : "<font color='#ff0000'>" . T_("NO") . "</font>";Replace with
if ($row['downloaded'] > 0)
{
$ratio = $row['uploaded'] / $row['downloaded'];
$ratio = number_format($ratio, 2);
$color = get_ratio_color($ratio);
if ($color)
$ratio = "<font color=#ff0000>$ratio</font>";
} else if ($row['uploaded'] > 0)
$ratio = 'Inf.';
else
$ratio = '---';
$comdate = date("d.M.Y<\\b\\r><\\s\\m\\a\\l\\l>H:i</\\s\\m\\a\\l\\l>", utc_to_tz_time($row["date"]));
$peers = (get_row_count("peers", "WHERE torrent = '$id' AND userid = '$row[id]'")) ? "<font color='#27B500'><b>".T_("YES")."</b></font>" : "<font color='#FF1200'><b>".T_("NO")."</b></font>";
$res2 = SQL_Query_exec("SELECT uload, dload, stime, utime, ltime, hnr FROM snatched WHERE tid = '$id' AND uid = '$row[id]'");
$row2 = mysql_fetch_assoc($res2);
if ($row2['dload'] > 0)
{
$tratio = $row2['uload'] / $row2['dload'];
$tratio = number_format($tratio, 2);
$color = get_ratio_color($tratio);
if ($color)
$tratio = "<font color=#ff0000>$tratio</font>";
} else if ($row2['uload'] > 0)
$tratio = 'Inf.';
else
$tratio = '---';
$startdate = utc_to_tz(get_date_time($row2['stime']));
$lastaction = utc_to_tz(get_date_time($row2['utime']));
$upload = "<font color='#27B500'><b>".mksize($row2["uload"])."</b></font>";
$download = "<font color='#FF1200'><b>".mksize($row2["dload"])."</b></font>";
$seedtime = $row2['ltime'] ? mkprettytime($row2['ltime']) : '---';
if ($row2['hnr'] != "yes") { $hnr = "<font color='#27B500'><b>".T_("NO")."</b></font>"; } else { $hnr = "<font color='#FF1200'><b>".T_("YES")."</b></font>"; }Add image hitnrun_list.png to images/admin folder[ATTACH]31._xfImport[/ATTACH]
Add required.php to root
