Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   Hit & Run mod (http://www.bvlist.com/showthread.php?t=11889)

elvira 16th December 2018 21:56

Hit & Run mod
 
Here I have a HitRun but dont think if this work so need a help

announce.php have this

PHP Code:

    if ( isset( $self ) && $event == "stopped" ) {
        
mysql_query"DELETE FROM peers WHERE $selfwhere) or err"D Err" );
        if ( 
mysql_affected_rows() ) {
            
$updateset[] = ( $self["seeder"] == "yes" "seeders = seeders - 1" :
                
"leechers = leechers - 1" );
            
$res mysql_query"SELECT start_date, uploaded, downloaded FROM snatched WHERE torrentid = $torrent[id] AND userid = $userid) or
            
err"hitrun Err" ); //or err(mysql_error());
            
$snatched mysql_fetch_assoc$res );
            
$hitrun = ( ( $snatched["start_date"] > get_date_timegmtime() - 86400 ) && ( $snatched["downloaded"] / 1.00 ) > $snatched["uploaded"] ) ? "IF(hitrun = '0000-00-00 00:00:00', '" .
                
get_date_time() . "', hitrun)" "hitrun" );
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . ", hitrun = $hitrun WHERE torrentid = $torrentid AND userid = $userid) or err"SL Err 1" );
        }
    } elseif ( isset( 
$self ) ) {
        
$prev_action sqlesc$self['last_action'] );
        if ( 
$event == "completed" ) {
            
$updateset[] = "times_completed = times_completed + 1";
            
$finished ", finishedat = UNIX_TIMESTAMP()";
            
$finished1 ", complete_date = '" get_date_time() . "'";
        }

        
mysql_query"UPDATE peers SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), prev_action = $prev_action, seeder = '$seeder', agent = " .
            
sqlesc$agent ) . $finished WHERE $selfwhere) or err"PL Err 1" );
        if ( 
mysql_affected_rows() ) {
            if ( 
$seeder <> $self["seeder"] )
                
$updateset[] = ( $seeder == "yes" ?
                    
"seeders = seeders + 1, leechers = leechers - 1" :
                    
"seeders = seeders - 1, leechers = leechers + 1" );
            
$anntime "timesann = timesann + 1";
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . $finished1$anntime WHERE torrentid = $torrentid AND userid = $userid) or
            
err"SL Err 2" );
        }
    } else {
        if ( 
$az["parked"] == "yes" )
            
err"Your account is parked! (Read the FAQ)" );
        elseif ( 
$az["downloadpos"] == "no" )
            
err"Your downloading priviledges have been disabled! (Read the rules)" );
        
mysql_query"INSERT INTO peers (torrent, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, started, last_action, seeder, agent, downloadoffset, uploadoffset, passkey) VALUES ($torrentid$userid, " .
            
sqlesc$peer_id ) . ", " sqlesc$ip ) . ", $port,'$connectable', $uploaded$downloaded$left, NOW(), NOW(), '$seeder', " .
            
sqlesc$agent ) . ", $downloaded$uploaded, " sqlescunesc$passkey ) ) . ")" ) or
        
err"PL Err 2" );
        if ( 
mysql_affected_rows() ) {
            
$updateset[] = ( $seeder == "yes" "seeders = seeders + 1" :
                
"leechers = leechers + 1" );
            
$anntime "timesann = timesann + 1";
            
$hitrun "IF(hitrun > '" get_date_timegmtime() - 5400 ) . "', '0000-00-00 00:00:00', hitrun)";
            
$hitrunwarn "IF(hitrun > '" get_date_timegmtime() - 5400 ) . "', 'no', hitrunwarn)";
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', to_go = $left, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . ", $anntime, hitrun = $hitrun, hitrunwarn = $hitrunwarn WHERE torrentid = $torrentid AND userid = $userid) or
            
err"SL Err 3" );
            if ( !
mysql_affected_rows() && $seeder == "no" )
                
mysql_query"INSERT INTO snatched (torrentid, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, start_date, last_action, seeder, agent) VALUES ($torrentid$userid, " .
                    
sqlesc$peer_id ) . ", " sqlesc$ip ) . ", $port, '$connectable', $uploaded$downloaded$left, '" .
                    
get_date_time() . "', '" get_date_time() . "', '$seeder', " sqlesc$agent ) . ")" ) or err"SL Err 4" );
}
}



userdetalis.php

PHP Code:

function snatchtable($res) {

$table "<table class=main border=1 cellspacing=0 cellpadding=5>
<tr>
<td class=colhead>Kategorija</td>
<td class=colhead>Torrent</td>
<td class=colhead>S.id</td>
<td class=colhead>Up.</td>
<td class=colhead>Rate</td>
<td class=colhead>Downl.</td>
<td class=colhead>Rate</td>
<td class=colhead>Ratio</td>
<td class=colhead>Akcija</td>
<td class=colhead>Zavrseno</td>
</tr>"
;

while (
$arr mysql_fetch_assoc($res)) {

$upspeed = ($arr["upspeed"] > mksize($arr["upspeed"]) : ($arr["seedtime"] > mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0)));
$downspeed = ($arr["downspeed"] > mksize($arr["downspeed"]) : ($arr["leechtime"] > mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0)));
$ratio = ($arr["downloaded"] > number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > "Inf." "---"));
$id=$arr[id];
$table .= "<tr>
<td style='padding: 0px'><img src='pic/"
.htmlspecialchars($arr["catimg"])."' alt='".htmlspecialchars($arr["catname"])."' width=42 height=42></td>
<td><a href=details.php?id=
$arr[torrentid]><b>".(strlen($arr["name"]) > 50 substr($arr["name"], 050 3)."..." $arr["name"])."</b></a></td>
<td>"
.($arr["id"])."</td>
<td>"
.mksize($arr["uploaded"])."</td>
<td>
$upspeed/s</td>
<td>"
.mksize($arr["downloaded"])."</td>
<td>
$downspeed/s</td>
<td>
$ratio</td>
<td>"
.mkprettytime($arr["seedtime"] + $arr["leechtime"])."</td>
<td>"
.($arr["complete_date"] <> "0000-00-00 00:00:00" "<font color=green><b>Da</b></font>" "<font color=red><b>Ne</b></font>")."</td>
</tr>\n"
;
}
$table .= "</table>\n";

return 
$table;



and this userdetails too


PHP Code:

//=== start snatched
if (get_user_class() >= UC_MODERATOR){

if (
$_GET["snatched_table"]){
echo 
"<tr><td class=clearalt6 align=right valign=top><b>Snatched+</b>[ <a class=altlink href=\"userdetails.php?id=$id\" class=\"sublink\">Sakrij</a> ]</td><td class=clearalt6>";

$res mysql_query(
"SELECT UNIX_TIMESTAMP(sn.start_date) AS s, UNIX_TIMESTAMP(sn.complete_date) AS c, UNIX_TIMESTAMP(sn.last_action) AS l_a, UNIX_TIMESTAMP(sn.seedtime) AS s_t, sn.seedtime, UNIX_TIMESTAMP(sn.leechtime) AS l_t, sn.leechtime, sn.downspeed, sn.upspeed, sn.uploaded, sn.downloaded, sn.torrentid, sn.start_date, sn.complete_date, sn.seeder, sn.last_action, sn.connectable, sn.agent, sn.seedtime, sn.port, sn.ip, cat.name, cat.image, t.size, t.seeders, t.leechers, t.owner, t.name AS torrent_name ".
"FROM snatched AS sn ".
"LEFT JOIN torrents AS t ON t.id = sn.torrentid ".
"LEFT JOIN categories AS cat ON cat.id = t.category ".
"WHERE sn.userid=$id ORDER BY sn.start_date DESC"
) or die(mysql_error());

echo 
"<table border=1 cellspacing=0 cellpadding=3 align=center width=750><tr><td class=colhead align=center width=50>Type</td><td class=colhead align=left>Torrent</td>".
"<td class=colhead align=center>S. / L.</td><td class=colhead align=center>Up / Down</td><td class=colhead align=center>Size / Hr / Compl</td>".
"<td class=colhead align=center width=50>Ratio</td><td class=colhead align=center>Client</td></tr>";

while (
$arr mysql_fetch_assoc($res)){
$res2 mysql_query("SELECT seeder FROM peers WHERE torrent = $arr[torrentid] AND userid=$user[id]");
$arr2 mysql_fetch_assoc($res2);

//=======change colors
$count2= (++$count2)%2;
$class 'clearalt'.($count2==0?'6':'7');

//=== speed color red fast green slow ;)
if ($arr["upspeed"] > 0)
$ul_speed = ($arr["upspeed"] > mksize($arr["upspeed"]) : ($arr["seedtime"] > mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0)));
else
$ul_speed mksize(($arr["uploaded"] / ( $arr['l_a'] - $arr['s'] + )));
if (
$arr["downspeed"] > 0)
$dl_speed = ($arr["downspeed"] > mksize($arr["downspeed"]) : ($arr["leechtime"] > mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0)));
else
$dl_speed mksize(($arr["downloaded"] / ( $arr['c'] - $arr['s'] + )));

switch (
true){
case (
$dl_speed 600):
$dlc 'red';
break;
case (
$dl_speed 300 ):
$dlc 'orange';
break;
case (
$dl_speed 200 ):
$dlc 'yellow';
break;
case (
$dl_speed 100 ):
$dlc 'chartreuse';
break;
}

if (
$arr["downloaded"] > 0){
$ratio number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio "<font color=" get_ratio_color($ratio) . "><b>Ratio:</b>$ratio</font>";
}
else
if (
$arr["uploaded"] > 0)
$ratio "Inf.";
else
$ratio "N/A";

$time mkprettytime(strtotime("now") - strtotime($arr["complete_date"]) - (($CURUSER["timezone"] + $CURUSER["dst"]) * 60));
$seedtime mkprettytime(strtotime("now") / 10800);
$days explode("d "$seedtime);
if(
sizeof($days) > 1) {
$seedtime   $arr["seedtime"] - $days[0];
}

//if ($time < 7 || $seedtime >= 259200)
if ($seedtime >= 86400)
$hr "<font color=green><b>Ne</b></font>";
else
$hr "<font color=red><b>Da</b></font>";

/// smallname torrents
$smallname3 =substr(htmlspecialchars($arr["torrent_name"]) , 048);
if (
$smallname3 != htmlspecialchars($arr["torrent_name"])) {
$smallname3 .= '...';
}

echo 
"<tr><td class=$class align=center>".($arr['owner'] == $id "<b><font color=orange>Torrent Owner</font></b>" "".($arr['complete_date'] != '0000-00-00 00:00:00' "<b><font color=green>Završeno</font></b>" "<b><font color=red>Ne Završeno</font>")."")."<img src=pic/$arr[image] alt=$arr[name]></td>".
"<td class=$class><a class=altlink href=details.php?id=$arr[torrentid]><b>$smallname3</b></a> ".($arr['complete_date'] != '0000-00-00 00:00:00' "".
"<font color=silver>Početo: ".$arr['start_date']."</font><font color=silver>Završeno: ".$arr['complete_date']."</font>" "".
"<font color=silver>Početo: ".$arr['start_date']."</font><font color=orange>Akcija: ".$arr['last_action']."</font> ".
"".($arr['complete_date'] == '0000-00-00 00:00:00' "".($arr['owner'] == $id "" "[ ".mksize($arr["size"] - $arr["downloaded"])." i još do ]")."" "")."")."".($arr['complete_date'] != '0000-00-00 00:00:00' "".
"".($arr['complete_date'] == '0000-00-00 00:00:00' "" "<font color=silver>Akcija: ".$arr['last_action']."</font>")."".
"<font color=silver>Vrijeme Downloada: ".($arr['leechtime'] != '0' mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s'])."")."</font><font color=$dlc>[ Down. at: $dl_speed ]<font>".
"" "")."<font color=blue>".($arr['seedtime'] != '0' "Totalni Seed Vrijeme: ".mkprettytime($arr['seedtime'])." <font color=$dlc> " "Totalni Seed Vrijeme: N/A")."".
"</font><font color=green> [ Up. Speed: ".$ul_speed." ] </font>".($arr['complete_date'] == '0000-00-00 00:00:00' "<font color=$dlc>Download Speed: $dl_speed</font>" "")."".
"<font color=Green>Totalni Leech Vrijeme: ".mkprettytime($arr['leechtime'])."</font><font color=olive>Announced: ".($arr['timesann'])." puta</font><font color=orange>Leech Za: ".($arr['ip'])."</font></td>"."<td align=center class=$class>Se: ".$arr['seeders']."Le: ".$arr['leechers']."</td><td align=center class=$class><font color=green>Up:".
"<b>".$uploaded =mksize($arr["uploaded"])."</b></font><font color=orange>Down:<b>".$downloaded mksize($arr["downloaded"])."</b></font></td>".
"<td align=center class=$class>Veličina: ".mksize($arr["size"])."Odvisno od: <font color=orange><b>".mksize($arr['size'] - $arr["downloaded"])."</b></font><b>Hit & Run:</b> $hr<b>Završeno:</b>$time nazad</td>".
"<td align=center class=$class>$ratio".($arr2['seeder'] == 'yes' "<font color=green><b>Seeduje</b></font>" "<font color=red><b>Ne Seeduje</b></font>")."".
"</td><td align=center class=$class>".$arr["agent"]."Port: ".$arr["port"]."".($arr["connectable"] == 'yes' "<b>Priključen: <font color=green>Da</font>".
"</b>" "<b>Priključen: <font color=red><b>Ne</b></font>")."</td></tr>\n";
}
echo 
"</table></td></tr>\n";
}
else
tr("<font color=orangered>Skinuti Torrenti:</font>","[ <a class=altlink href=\"userdetails.php?id=$id&snatched_table=1\" class=\"sublink\">Prikazi</a> ]  - $count_snatched <font color=red><b>staff jedino!!!</font></b>"1);
}
//=== end snatched 

cleanup.php

PHP Code:

function doautohitrun()
{
    global 
$SITENAME$CURUSER$DEFAULTBASEURL$autohitrun_interval$queries$query_stat;
    
set_time_limit(1200);
    
$result mysql_query("show processlist") or sqlerr(__FILE____LINE__);
    while (
$row mysql_fetch_array($result)) {
        if ((
$row["Time"] > 100) || ($row["Command"] == "Sleep")) {
            
$sql "kill " $row["Id"] . "";
            
mysql_query($sql) or sqlerr(__FILE____LINE__);
        }
    }
    
ignore_user_abort(1);
    
// Message users who have hit and run
    
$res mysql_query("SELECT s.id, userid, torrentid, name FROM snatched AS s INNER JOIN torrents AS t ON s.torrentid = t.id WHERE hitrun <> '0000-00-00 00:00:00' && hitrunwarn = 'no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
            
$torrents[$arr["userid"]] .= "\n[b][url=$DEFAULTBASEURL/details.php?id=$arr[torrentid]]$arr[name][/url][/b]";
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid) {
            
$msg sqlesc("It appears that you have hit and run on $hitrun[$userid] torrent" . ($hitrun[$userid] == "" "s") . ".\n\n We advise you to return to continue seeding " . ($hitrun[$userid] == "this" "these") . " torrent" . ($hitrun[$userid] == "" "s") . " within 1 hour or else you risk being warned, or if this happens to you regular you may even risk your account being disabled - If your a Donor you can choose to seed or not as donors wont be warned.\n\nThe torrent" . ($hitrun[$userid] == "" "s") . " on which you have been found hit and running on " . ($hitrun[$userid] == "is" "are") . ":\n$torrents[$userid]");
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $userid, 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE snatched SET hitrunwarn = 'pending' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// Process hit and runs of users that have not returned
    
$res mysql_query("SELECT id, userid FROM snatched WHERE hitrunwarn = 'pending' AND hitrun < '" get_date_time(gmtime() - 5400) . "'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid)
        
mysql_query("UPDATE users SET hitruns = hitruns + $hitrun[$userid] WHERE id = $userid") or sqlerr();
        
mysql_query("UPDATE snatched SET hitrunwarn = 'yes' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// modified Warn repeating hit and runners
    
$maxhitrun 5;
    
$res mysql_query("SELECT id FROM users WHERE hitruns > $maxhitrun AND warned = 'no' AND class < " UC_VIP " AND immun='no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$userids = array();
        
$modcomment sqlesc(gmdate("d-m-Y") . " - Warned by System for Hit and Run.\n");
        
$msg sqlesc("You have continued to hit and run on torrents even after we have notified you. Therefore you have received a five day warning with your downloads disabled. You know when you sign up to a private community we rely on you following seedtime's so hopefully you will learn the system here :), and if you dont it may result in your account being disabled.");
        while (
$arr mysql_fetch_assoc($res)) {
            
$userids[] = $arr["id"];
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $arr[id], 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE users SET warned = 'yes', warneduntil = '" get_date_time(gmtime() + (86400)) . "', downloadpos = 'no', dlremoveuntil = '" get_date_time(gmtime() + (86400)) . "', modcomment = CONCAT($modcomment, modcomment), hitruns = 0 WHERE id IN (" implode(", "$userids) . ")") or sqlerr();
        
$count mysql_affected_rows();
        
write_log("Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
        
write_log2("autohitrun""Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
    }
    
// ==New remove expired warning and download disablement's for hit and run system
    
$res sql_query("SELECT id FROM users WHERE warned='yes' AND downloadpos='no' AND dlremoveuntil < NOW() AND dlremoveuntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE____LINE__);
    
$msgs_buffer $users_buffer = array();
    if (
mysql_num_rows($res) > 0) {
        
$msg "Your downloads have been enabled and your warning removed. Please keep in your best behaviour from now on.\n";
        while (
$arr mysql_fetch_assoc($res)) {
            
$modcomment sqlesc(gmdate("Y-m-d H:i") . " - Downloads automatically enabled By System\n");
            
$msgs_buffer[] = '(0,' $arr['id'] . ',NOW(), ' sqlesc($msg) . ', \'Downloads enabled\')';
            
$users_buffer[] = '(' $arr['id'] . ',\'yes\',\'no\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',' $modcomment ')';
        }
        if (
sizeof($msgs_buffer) > 0) {
            
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " implode(', '$msgs_buffer)) or sqlerr(__FILE____LINE__);
            
sql_query("INSERT INTO users (id, downloadpos, warned, dlremoveuntil, warneduntil, modcomment) VALUES " implode(', '$users_buffer) . " ON DUPLICATE key UPDATE downloadpos=values(downloadpos),
    warned=values(warned),dlremoveuntil=values(dlremoveuntil),warneduntil=values(warneduntil),modcomment=concat(values(modcomment),modcomment)"
) or sqlerr(__FILE____LINE__);
            
$count mysql_affected_rows();
            
write_log("Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
            
write_log2("autodewarn""Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
        }
        unset (
$users_buffer);
        unset (
$msgs_buffer);
    }
    
// /////end hitrun script////////
    
write_log("----------------------Auto hit and run clean complete using $queries queries---------------------");
    
write_log2("autohitrun"" -------------------- Auto hit and run clean Complete using $queries queries --------------------");
    
// /////end hitrun script//////// 


Tedmorris 16th December 2018 22:32

Change the time limit and download a torrent, stop seeding then do a forced cleanup and see if you have a H&R

elvira 16th December 2018 22:50

if can someone post complete hitrun mod, my its not working

Napon 17th December 2018 02:31

i do have a 08 hnr made by me buts its all mysqli PHP7 7.1

elvira 17th December 2018 14:51

Can you post, please

Napon 17th December 2018 17:34

Sorry No i would not doing that or ill be takeing code from my Source Code http://bvlist.com/images/styles/vers...lapse_tcat.gif08 and i would not do that to get it you would need to have the full Source Code 08 from me and i would not upload it here as it took me alot of time to code it up and put new PHP7 7.1 on to it ...So sorry im not doing it

darkalchemy 17th December 2018 17:38

Quote:

Originally Posted by Napon (Post 53014)
Sorry No i would not doing that or ill be takeing code from my Source Code http://bvlist.com/images/styles/vers...lapse_tcat.gif08 and i would not do that to get it you would need to have the full Source Code 08 from me and i would not upload it here as it took me alot of time to code it up and put new PHP7 7.1 on to it ...So sorry im not doing it

Then why would you tell someone that you have it?

It's like the asshole on the playground, "Na-na na-na na na!!"

Napon 17th December 2018 17:39

well what can i say :drink:

elvira 17th December 2018 18:00

thank you @Napon you are very good person:ok:

Elena 19th December 2018 14:51

Ban on racing if the rating is bad
 
Open announce.php and remove this code here:
Quote:

if ($az['class'] < UC_VIP) {
if ($use_wait) {
$gigs = $az['uploaded'] / (1024*1024*1024);
$elapsed = floor((strtotime(date('Y-m-d H:i:s')) - $torrent['ts']) / 3600);
$ratio = (($az['downloaded'] > 0) ? ($az['uploaded'] / $az['downloaded']) : 1);
if ($ratio < 0.5 || $gigs < 5)
$wait = 48;
elseif ($ratio < 0.65 || $gigs < 6.5)
$wait = 24;
elseif ($ratio < 0.8 || $gigs < 8)
$wait = 12;
elseif ($ratio < 0.95 || $gigs < 9.5)
$wait = 6;
else
$wait = 0;
if ($elapsed < $wait)
err('Not authorized (' . ($wait - $elapsed) . 'h) - READ THE FAQ!');
}
}
and two queries in the 153 default line from GIT, here it is:
Quote:

$rz = mysql_query('SELECT id, uploaded, downloaded, enabled, parked, class, passkey_ip FROM users WHERE passkey = '.sqlesc($passkey).' ORDER BY last_access DESC LIMIT 1') or err('Users error 1 (select)');
namely, uploaded, downloaded, since they are NOT NEEDED there anymore.

open download.php and everything before this request:

Quote:

sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id));
change to this:
Quote:

require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
parked();

if (@ini_get('output_handler') == 'ob_gzhandler' AND @ob_get_length() !== false)
{ // if output_handler = ob_gzhandler, turn it off and remove the header sent by PHP
@ob_end_clean();
header('Content-Encoding:');
}
$id = (int) $_GET["id"];
if (!is_numeric($id))
stderr($tracker_lang['error'],$tracker_lang['invalid_id']);
if ($use_wait)
if (($CURUSER["class"] < UC_POWER_USER) && $CURUSER) {
$gigs = $CURUSER["uploaded"] / (1024*1024*1024);
$ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0);
if ($ratio < 0.5 || $gigs < 5) $wait = 48;
elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
else $wait = 0;
}
$res = mysql_query("SELECT name, filename, added, owner, banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
////////////////////////////////
$row = mysql_fetch_assoc($res);
if (!$row)
stderr($tracker_lang['error'], $tracker_lang['invalid_id']);
//////////////////////////////////
$name = $row['filename'];
$fn = "$torrent_dir/$id.torrent";
if (!$row || !is_file($fn) || !is_readable($fn))
stderr($tracker_lang['error'], $tracker_lang['unable_to_read_torrent']);
///////////////////
if ($row['banned'] == 'yes' && $row['owner'] != $CURUSER['id'] && get_user_class() < UC_MODERATOR)
stderr($tracker_lang['error'], 'Oops, and torrentik banned!');
///////////////////////////
if ($wait)
{
$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
if ($elapsed < $wait)
{
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
stderr($tracker_lang['error'], "  Raise the rating! You can download this release only through ".number_format($wait - $elapsed)." h
");
} }
////////////////////
Then play with the Details and Brows page, there you can paste the same code for the jump limit - close the download button and the message will be waiting for ** hours instead.

elvira 19th December 2018 21:30

@Elena thanks for post but this is not HitRun

Napon 19th December 2018 22:00

no its not lol

elvira 6th January 2019 01:45

is here someone who have a HitRun mod for source TBDev 08....


:welcome:

DND 6th January 2019 01:52

i could help ya with that.:coffee:

elvira 6th January 2019 02:03

so please where we start

Tedmorris 12th January 2019 11:50

I use a heavily modded TB source with a modified 09 hnr added but it would need tweaking to work on 08..

Looking at your hnr announce code and comparing it with mine theres alot of diffrence. You dont have class times defined in your stopped query. Is your db in date time for hnr? Mine doesnt use date time, it uses unix time.

Where did you get the source from that your using? What source was it coded for?

Do you have a gmtime function? Have you downloaded a torrent, completed it and then stopped it and checked the snatched table in your db to see if a hnr time was added for that user and that torrent?

elvira 12th January 2019 12:19

Here is then you see what is worng...this use from installer 09

snatched SQL

PHP Code:

DROP TABLE IF EXISTS `snatched`;
CREATE TABLE `snatched` (
  `
idint(10unsigned NOT NULL auto_increment,
  `
useridint(10unsigned NOT NULL default '0',
  `
torrentidint(10unsigned NOT NULL default '0',
  `
torrent_namevarchar(255NOT NULL default '',
  `
torrent_categoryint(10unsigned NOT NULL default '0',
  `
ipvarchar(15NOT NULL default '',
  `
portsmallint(5unsigned NOT NULL default '0',
  `
connectableenum('yes','no'NOT NULL default 'no',
  `
completedatdatetime NOT NULL default '0000-00-00 00:00:00',
  `
agentvarchar(60NOT NULL default '',
  `
peer_idvarchar(20NOT NULL default '',
  `
uploadedbigint(20unsigned NOT NULL default '0',
  `
upspeedbigint(20NOT NULL default '0',
  `
downloadedbigint(20unsigned NOT NULL default '0',
  `
downspeedbigint(20NOT NULL default '0',
  `
finishedenum('yes','no'NOT NULL default 'no',
  `
to_gobigint(20unsigned NOT NULL default '0',
  `
seederenum('yes','no'NOT NULL default 'no',
  `
seedtimeint(10unsigned NOT NULL default '0',
  `
leechtimeint(10unsigned NOT NULL default '0',
  `
start_datedatetime NOT NULL default '0000-00-00 00:00:00',
  `
last_actiondatetime NOT NULL default '0000-00-00 00:00:00',
  `
complete_datedatetime NOT NULL default '0000-00-00 00:00:00',
  `
timesannbigint(10unsigned NOT NULL default '0',
  `
sl_warnedenum('yes','no'NOT NULL default 'no',
  `
hitrundatetime NOT NULL default '0000-00-00 00:00:00',
  `
hitrunwarnenum('yes','pending','no'NOT NULL default 'no',
  `
cheatedbigint(10unsigned NOT NULL default '0',
  
PRIMARY KEY  (`id`),
  
KEY `tr_usr` (`torrentid`,`userid`)
ENGINE=MyISAM

announce.php

PHP Code:

    if ( isset( $self ) && $event == "stopped" ) {
        
mysql_query"DELETE FROM peers WHERE $selfwhere) or err"D Err" );
        if ( 
mysql_affected_rows() ) {
            
$updateset[] = ( $self["seeder"] == "yes" "seeders = seeders - 1" :
                
"leechers = leechers - 1" );
            
$res mysql_query"SELECT start_date, uploaded, downloaded FROM snatched WHERE torrentid = $torrent[id] AND userid = $userid) or
            
err"hitrun Err" ); //or err(mysql_error());
            
$snatched mysql_fetch_assoc$res );
            
$hitrun = ( ( $snatched["start_date"] > get_date_timegmtime() - 86400 ) && ( $snatched["downloaded"] / 1.00 ) > $snatched["uploaded"] ) ? "IF(hitrun = '0000-00-00 00:00:00', '" .
                
get_date_time() . "', hitrun)" "hitrun" );
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . ", hitrun = $hitrun WHERE torrentid = $torrentid AND userid = $userid) or err"SL Err 1" );
        }
    } elseif ( isset( 
$self ) ) {
        
$prev_action sqlesc$self['last_action'] );
        if ( 
$event == "completed" ) {
            
$updateset[] = "times_completed = times_completed + 1";
            
$finished ", finishedat = UNIX_TIMESTAMP()";
            
$finished1 ", complete_date = '".get_date_time()."', finished = 'yes'";
            
//$finished1 = ", complete_date = '" . get_date_time() . "'";
        
}

        
mysql_query"UPDATE peers SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', webseeder='$webseeder', uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), prev_action = $prev_action, seeder = '$seeder', agent = " .
            
sqlesc$agent ) . $finished WHERE $selfwhere) or err"PL Err 1" );
        if ( 
mysql_affected_rows() ) {
            if ( 
$seeder <> $self["seeder"] )
                
$updateset[] = ( $seeder == "yes" ?
                    
"seeders = seeders + 1, leechers = leechers - 1" :
                    
"seeders = seeders - 1, leechers = leechers + 1" );
            
$anntime "timesann = timesann + 1";
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . $finished1$anntime WHERE torrentid = $torrentid AND userid = $userid) or
            
err"SL Err 2" );
        }
    } else {
        if ( 
$az["parked"] == "yes" )
            
err"Your account is parked! (Read the FAQ)" );
        elseif ( 
$az["downloadpos"] == "no" )
            
err"Your downloading priviledges have been disabled! (Read the rules)" );
        
mysql_query"INSERT INTO peers (torrent, userid, peer_id, ip, port, webseeder, connectable, uploaded, downloaded, to_go, started, last_action, seeder, agent, downloadoffset, uploadoffset, passkey) VALUES ($torrentid$userid, " .
            
sqlesc$peer_id ) . ", " sqlesc$ip ) . ", $port,'$webseeder', '$connectable', $uploaded$downloaded$left, NOW(), NOW(), '$seeder', " .
            
sqlesc$agent ) . ", $downloaded$uploaded, " sqlescunesc$passkey ) ) . ")" ) or
        
err"PL Err 2" );
        if ( 
mysql_affected_rows() ) {
            
$updateset[] = ( $seeder == "yes" "seeders = seeders + 1" :
                
"leechers = leechers + 1" );
            
$anntime "timesann = timesann + 1";
            
$hitrun "IF(hitrun > '" get_date_timegmtime() - 5400 ) . "', '0000-00-00 00:00:00', hitrun)";
            
$hitrunwarn "IF(hitrun > '" get_date_timegmtime() - 5400 ) . "', 'no', hitrunwarn)";
            
mysql_query"UPDATE snatched SET ip = " sqlesc$ip ) . ", port = $port, connectable = '$connectable', to_go = $left, last_action = '" .
                
get_date_time() . "', seeder = '$seeder', agent = " sqlesc$agent ) . ", $anntime, hitrun = $hitrun, hitrunwarn = $hitrunwarn, mark_of_cain = 'no' WHERE torrentid = $torrentid AND userid = $userid) or
            
err"SL Err 3" );
            if ( !
mysql_affected_rows() && $seeder == "no" )
                
mysql_query"INSERT INTO snatched (torrentid, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, start_date, last_action, seeder, agent) VALUES ($torrentid$userid, " .
                    
sqlesc$peer_id ) . ", " sqlesc$ip ) . ", $port, '$connectable', $uploaded$downloaded$left, '" .
                    
get_date_time() . "', '" get_date_time() . "', '$seeder', " sqlesc$agent ) . ")" ) or err"SL Err 4" );
        }
    } 

cleanup.php

PHP Code:

    // Message users who have hit and run
    
$res mysql_query("SELECT s.id, userid, torrentid, name FROM snatched AS s INNER JOIN torrents AS t ON s.torrentid = t.id WHERE hitrun <> '0000-00-00 00:00:00' && hitrunwarn = 'no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
            
$torrents[$arr["userid"]] .= "\n[b][url=$DEFAULTBASEURL/details.php?id=$arr[torrentid]]$arr[name][/url][/b]";
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid) {
            
$msg sqlesc("It appears that you have hit and run on $hitrun[$userid] torrent" . ($hitrun[$userid] == "" "s") . ".\n\n We advise you to return to continue seeding " . ($hitrun[$userid] == "this" "these") . " torrent" . ($hitrun[$userid] == "" "s") . " within 1 hour or else you risk being warned, or if this happens to you regular you may even risk your account being disabled - If your a Donor you can choose to seed or not as donors wont be warned.\n\nThe torrent" . ($hitrun[$userid] == "" "s") . " on which you have been found hit and running on " . ($hitrun[$userid] == "is" "are") . ":\n$torrents[$userid]");
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $userid, 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE snatched SET hitrunwarn = 'pending' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// Process hit and runs of users that have not returned
    
$res mysql_query("SELECT id, userid FROM snatched WHERE hitrunwarn = 'pending' AND hitrun < '" get_date_time(gmtime() - 5400) . "'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid)
        
mysql_query("UPDATE users SET hitruns = hitruns + $hitrun[$userid] WHERE id = $userid") or sqlerr();
        
mysql_query("UPDATE snatched SET hitrunwarn = 'yes' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// modified Warn repeating hit and runners
    
$maxhitrun 5;
    
$res mysql_query("SELECT id FROM users WHERE hitruns > $maxhitrun AND warned = 'no' AND class < " UC_VIP " AND immunity='no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$userids = array();
        
$modcomment sqlesc(gmdate("d-m-Y") . " - Warned by System for Hit and Run.\n");
        
$msg sqlesc("You have continued to hit and run on torrents even after we have notified you. Therefore you have received a five day warning with your downloads disabled. You know when you sign up to a private community we rely on you following seedtime's so hopefully you will learn the system here :), and if you dont it may result in your account being disabled.");
        while (
$arr mysql_fetch_assoc($res)) {
            
$userids[] = $arr["id"];
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $arr[id], 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE users SET warned = 'yes', warneduntil = '" get_date_time(gmtime() + (86400)) . "', downloadpos = 'no', dlremoveuntil = '" get_date_time(gmtime() + (86400)) . "', modcomment = CONCAT($modcomment, modcomment), hitruns = 0 WHERE id IN (" implode(", "$userids) . ")") or sqlerr();
        
$count mysql_affected_rows();
        
write_log("Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
        
write_log2("autohitrun""Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
    }
    
// ==New remove expired warning and download disablement's for hit and run system
    
$res sql_query("SELECT id FROM users WHERE warned='yes' AND downloadpos='no' AND dlremoveuntil < NOW() AND dlremoveuntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE____LINE__);
    
$msgs_buffer $users_buffer = array();
    if (
mysql_num_rows($res) > 0) {
        
$msg "Your downloads have been enabled and your warning removed. Please keep in your best behaviour from now on.\n";
        while (
$arr mysql_fetch_assoc($res)) {
            
$modcomment sqlesc(gmdate("Y-m-d H:i") . " - Downloads automatically enabled By System\n");
            
$msgs_buffer[] = '(0,' $arr['id'] . ',NOW(), ' sqlesc($msg) . ', \'Downloads enabled\')';
            
$users_buffer[] = '(' $arr['id'] . ',\'yes\',\'no\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',' $modcomment ')';
        }
        if (
sizeof($msgs_buffer) > 0) {
            
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " implode(', '$msgs_buffer)) or sqlerr(__FILE____LINE__);
            
sql_query("INSERT INTO users (id, downloadpos, warned, dlremoveuntil, warneduntil, modcomment) VALUES " implode(', '$users_buffer) . " ON DUPLICATE key UPDATE downloadpos=values(downloadpos),
    warned=values(warned),dlremoveuntil=values(dlremoveuntil),warneduntil=values(warneduntil),modcomment=concat(values(modcomment),modcomment)"
) or sqlerr(__FILE____LINE__);
            
$count mysql_affected_rows();
            
write_log("Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
            
write_log2("autodewarn""Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
        }
        unset (
$users_buffer);
        unset (
$msgs_buffer);
    }
 }
    
// /////end hitrun script//////// 


Tedmorris 12th January 2019 12:24

Do you hve gmtime function and can you do the above debugging I've mentioned. Do you have show errors enabled?
At the top of your announce
error_reporting(E_ALL);

elvira 12th January 2019 12:26

Quote:

Originally Posted by Tedmorris (Post 53081)
Do you hve gmtime function and can you do the above debugging I've mentioned. Do you have show errors enabled?

Yes have it in globalfunctions

PHP Code:

function gmtime()
{
    return 
strtotime(get_date_time());



Tedmorris 12th January 2019 12:31

When you browse your snatched table in the db do you have anything besides zeros in the hitrun row?

elvira 12th January 2019 12:38

Look up I post snatched table no I think maybe problem is in fuctions.php and cleanup

my original fuctions.php

PHP Code:

function autoclean() {
    global 
$autoclean_interval;

    
$now time();
    
$docleanup 0;

    
$res mysql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'");
    
$row mysql_fetch_array($res);
    if (!
$row) {
        
mysql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime',$now)");
        return;
    }
    
$ts $row[0];
    if (
$ts $autoclean_interval $now)
        return;
    
mysql_query("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts");
    if (!
mysql_affected_rows())
        return;

    
docleanup();


replace with

PHP Code:

function autoclean()
{
    global 
$autoclean_interval$autoslowclean_interval$optimizedb_interval$backupdb_interval$autohitrun_interval;
    
$now gmtime();
    
/* Better cleanup function with db-optimization dbbackup - //==added hitandrun==//   by x0r @ tbdev.net */
    
$w00p sql_query("SELECT arg, value_u FROM avps") or sqlerr(__FILE____LINE__);
    while (
$row mysql_fetch_assoc($w00p)) {
        if (
$row['arg'] == "lastcleantime" && ($row['value_u'] + $autoclean_interval) < $now) {
            
sql_query("UPDATE avps SET value_u = '$now' WHERE arg = 'lastcleantime'") or sqlerr(__FILE____LINE__);
            
docleanup();
        } else if (
$row['arg'] == "lastslowcleantime" && ($row['value_u'] + $autoslowclean_interval) < $now) {
            
sql_query("UPDATE avps SET value_u = '$now' WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE____LINE__);
            
doslowcleanup();
        } else if (
$row['arg'] == "lastoptimizedbtime" && ($row['value_u'] + $optimizedb_interval) < $now) {
            
sql_query("UPDATE avps SET value_u = '$now' WHERE arg = 'lastoptimizedbtime'") or sqlerr(__FILE____LINE__);
            
dooptimizedb();
        } else if (
$row['arg'] == "lastbackupdbtime" && ($row['value_u'] + $backupdb_interval) < $now) {
            
sql_query("UPDATE avps SET value_u = '$now' WHERE arg = 'lastbackupdbtime'") or sqlerr(__FILE____LINE__);
            
dobackupdb();
        } else if (
$row['arg'] == "lastautohitruntime" && ($row['value_u'] + $autohitrun_interval) < $now) {
            
sql_query("UPDATE avps SET value_u = '$now' WHERE arg = 'lastautohitruntime'") or sqlerr(__FILE____LINE__);
            
doautohitrun();
        }
    }
    
mysql_free_result($w00p);
    return;



Tedmorris 12th January 2019 14:37

The cleanup is for a hnr warn. Your announce stopped query puts in the hitrun to the snatched tables hitrun row. I will post some code for you to try. Firstly you need to get the snatched table to accept a hitrun entry.

elvira 12th January 2019 15:25

ok please post and thanks for help

Tedmorris 12th January 2019 17:47

Is your snatched code working? Do you have any data in the snatched table?

elvira 12th January 2019 19:06

yes its working so test one torrent and got these message

Code:

Hit and Run
It appears that you have hit and run on 2 torrents.

We advise you to return to continue seeding these torrents within 1 hour or else you risk being warned, or if this happens to you regular you may even risk your account being disabled - If your a Donor you can choose to seed or not as donors wont be warned.

The torrents on which you have been found hit and running on are:


Tedmorris 12th January 2019 21:15

So then you should have a date and time in the snatched table hitrun row for that userid and torrentid yes?

PHP Code:

// Message users who have hit and run 
    
$res mysql_query("SELECT s.id, userid, torrentid, name FROM snatched AS s INNER JOIN torrents AS t ON s.torrentid = t.id WHERE hitrun <> '0000-00-00 00:00:00' && hitrunwarn = 'no'") or sqlerr(); 

The hnr message you recieved is called by WHERE hitrun <> '0000-00-00 00:00:00 which is if hitrun is not equal to 0000-00-00 00:00:00

So your hnr is working?

elvira 12th January 2019 22:04

Yes its working…


now how put in statusbar HnR, my TEST account have two Hitruns


examle:


PHP Code:

[&nbsp;<font color=><b>HnR:</font></b> <b><?=$hitruns?></b>&nbsp;]

and this


PHP Code:

// //Get H&R Total ////
$hitruns number_format($user["hitruns"]);
// ///////////// 


Tedmorris 13th January 2019 03:01

But your OP says it wasn't working. Hows it working all of a sudden?

elvira 13th January 2019 14:39

in cleanup replace this

PHP Code:

function doautohitrun()
{
    global 
$SITENAME$CURUSER$DEFAULTBASEURL$autohitrun_interval$queries$query_stat;
    
set_time_limit(1200);
    
$result mysql_query("show processlist") or sqlerr(__FILE____LINE__);
    while (
$row mysql_fetch_array($result)) {
        if ((
$row["Time"] > 100) || ($row["Command"] == "Sleep")) {
            
$sql "kill " $row["Id"] . "";
            
mysql_query($sql) or sqlerr(__FILE____LINE__);
        }
    }
    
ignore_user_abort(1);
    
// Message users who have hit and run
    
$res mysql_query("SELECT s.id, userid, torrentid, name FROM snatched AS s INNER JOIN torrents AS t ON s.torrentid = t.id WHERE hitrun <> '0000-00-00 00:00:00' && hitrunwarn = 'no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
            
$torrents[$arr["userid"]] .= "\n[b][url=$DEFAULTBASEURL/details.php?id=$arr[torrentid]]$arr[name][/url][/b]";
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid) {
            
$msg sqlesc("It appears that you have hit and run on $hitrun[$userid] torrent" . ($hitrun[$userid] == "" "s") . ".\n\n We advise you to return to continue seeding " . ($hitrun[$userid] == "this" "these") . " torrent" . ($hitrun[$userid] == "" "s") . " within 1 hour or else you risk being warned, or if this happens to you regular you may even risk your account being disabled - If your a Donor you can choose to seed or not as donors wont be warned.\n\nThe torrent" . ($hitrun[$userid] == "" "s") . " on which you have been found hit and running on " . ($hitrun[$userid] == "is" "are") . ":\n$torrents[$userid]");
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $userid, 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE snatched SET hitrunwarn = 'pending' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// Process hit and runs of users that have not returned
    
$res mysql_query("SELECT id, userid FROM snatched WHERE hitrunwarn = 'pending' AND hitrun < '" get_date_time(gmtime() - 5400) . "'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid)
        
mysql_query("UPDATE users SET hitruns = hitruns + $hitrun[$userid] WHERE id = $userid") or sqlerr();
        
mysql_query("UPDATE snatched SET hitrunwarn = 'yes' WHERE id IN (" implode(", "$ids) . ")") or sqlerr();
    }
    
// modified Warn repeating hit and runners
    
$maxhitrun 5;
    
$res mysql_query("SELECT id FROM users WHERE hitruns > $maxhitrun AND warned = 'no' AND class < " UC_VIP " AND immun='no'") or sqlerr();
    if (
mysql_num_rows($res) > 0) {
        
$userids = array();
        
$modcomment sqlesc(gmdate("d-m-Y") . " - Warned by System for Hit and Run.\n");
        
$msg sqlesc("You have continued to hit and run on torrents even after we have notified you. Therefore you have received a five day warning with your downloads disabled. You know when you sign up to a private community we rely on you following seedtime's so hopefully you will learn the system here :), and if you dont it may result in your account being disabled.");
        while (
$arr mysql_fetch_assoc($res)) {
            
$userids[] = $arr["id"];
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $arr[id], 'Hit and Run', $msg)") or sqlerr();
        }
        
mysql_query("UPDATE users SET warned = 'yes', warneduntil = '" get_date_time(gmtime() + (86400)) . "', downloadpos = 'no', dlremoveuntil = '" get_date_time(gmtime() + (86400)) . "', modcomment = CONCAT($modcomment, modcomment), hitruns = 0 WHERE id IN (" implode(", "$userids) . ")") or sqlerr();
        
$count mysql_affected_rows();
        
write_log("Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
        
write_log2("autohitrun""Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
    }
    
// ==New remove expired warning and download disablement's for hit and run system
    
$res sql_query("SELECT id FROM users WHERE warned='yes' AND downloadpos='no' AND dlremoveuntil < NOW() AND dlremoveuntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE____LINE__);
    
$msgs_buffer $users_buffer = array();
    if (
mysql_num_rows($res) > 0) {
        
$msg "Your downloads have been enabled and your warning removed. Please keep in your best behaviour from now on.\n";
        while (
$arr mysql_fetch_assoc($res)) {
            
$modcomment sqlesc(gmdate("Y-m-d H:i") . " - Downloads automatically enabled By System\n");
            
$msgs_buffer[] = '(0,' $arr['id'] . ',NOW(), ' sqlesc($msg) . ', \'Downloads enabled\')';
            
$users_buffer[] = '(' $arr['id'] . ',\'yes\',\'no\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',' $modcomment ')';
        }
        if (
sizeof($msgs_buffer) > 0) {
            
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " implode(', '$msgs_buffer)) or sqlerr(__FILE____LINE__);
            
sql_query("INSERT INTO users (id, downloadpos, warned, dlremoveuntil, warneduntil, modcomment) VALUES " implode(', '$users_buffer) . " ON DUPLICATE key UPDATE downloadpos=values(downloadpos),
    warned=values(warned),dlremoveuntil=values(dlremoveuntil),warneduntil=values(warneduntil),modcomment=concat(values(modcomment),modcomment)"
) or sqlerr(__FILE____LINE__);
            
$count mysql_affected_rows();
            
write_log("Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
            
write_log2("autodewarn""Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
        }
        unset (
$users_buffer);
        unset (
$msgs_buffer);
    }
    
// /////end hitrun script////////
    
write_log("----------------------Auto hit and run clean complete using $queries queries---------------------");
    
write_log2("autohitrun"" -------------------- Auto hit and run clean Complete using $queries queries --------------------");
    
// /////end hitrun script////////


with this

PHP Code:

    // Message users who have hit and run
    
$res mysql_query("SELECT s.id, userid, torrentid, name FROM snatched AS s INNER JOIN torrents AS t ON s.torrentid = t.id WHERE hitrun <> '0000-00-00 00:00:00' && hitrunwarn = 'no'") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
            
$torrents[$arr["userid"]] .= "\n[b][url=$DEFAULTBASEURL/details.php?id=$arr[torrentid]]$arr[name][/url][/b]";
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid) {
            
$msg sqlesc("Izgleda da imate HnR za $hitrun[$userid] torrent-a" . ($hitrun[$userid] == "" "s") . ".\n\n Savjetujemo, da se vratite na seed " . ($hitrun[$userid] == "ovog" "ovih") . " torrent" . ($hitrun[$userid] == "" "a") . " za 1 sat ili će vaš račun biti opozoren. Ako se to dogodi, da redovito dobijate upozorenja imate čak i rizik vaš račun bude blokiran - Ako ste donator sami presudite za seed ili ne, jer donatori neće biti opozoreni.\n\nTorrent" . ($hitrun[$userid] == "" "i") . " na kojem je pronaden HnR " . ($hitrun[$userid] == "je" "su") . ":\n$torrents[$userid]");
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $userid, 'HnR Torrent', $msg)") or sqlerr(__FILE____LINE__);
        }
        
mysql_query("UPDATE snatched SET hitrunwarn = 'pending' WHERE id IN (" implode(", "$ids) . ")") or sqlerr(__FILE____LINE__);
    }
    
// Process hit and runs of users that have not returned
    
$res mysql_query("SELECT id, userid FROM snatched WHERE hitrunwarn = 'pending' AND hitrun < '" get_date_time(gmtime() - 5400) . "'") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0) {
        
$ids $userids = array();
        while (
$arr mysql_fetch_assoc($res)) {
            
$ids[] = $arr["id"];
            
$userids[] = $arr["userid"];
            
$hitrun[$arr["userid"]]++;
        }
        
$userids array_unique($userids);
        foreach(
$userids as $userid)
        
mysql_query("UPDATE users SET hitruns = hitruns + $hitrun[$userid] WHERE id = $userid") or sqlerr(__FILE____LINE__);
        
mysql_query("UPDATE snatched SET hitrunwarn = 'yes' WHERE id IN (" implode(", "$ids) . ")") or sqlerr(__FILE____LINE__);
    }
    
// modified Warn repeating hit and runners
    
$maxhitrun 5;
    
$res mysql_query("SELECT id FROM users WHERE hitruns > $maxhitrun AND warned = 'no' AND class < " UC_VIP " AND immunity='no'") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0) {
        
$userids = array();
        
$modcomment sqlesc(gmdate("d-m-Y") . " - Warned by System for Hit and Run.\n");
        
$msg sqlesc("You have continued to hit and run on torrents even after we have notified you. Therefore you have received a five day warning with your downloads disabled. You know when you sign up to a private community we rely on you following seedtime's so hopefully you will learn the system here :), and if you dont it may result in your account being disabled.");
        while (
$arr mysql_fetch_assoc($res)) {
            
$userids[] = $arr["id"];
            
mysql_query("INSERT INTO messages (added, poster, sender, receiver, subject, msg) VALUES ('" get_date_time() . "', 0, 0, $arr[id], 'Hit and Run', $msg)") or sqlerr(__FILE____LINE__);
        }
        
mysql_query("UPDATE users SET warned = 'yes', warneduntil = '" get_date_time(gmtime() + (86400)) . "', downloadpos = 'no', dlremoveuntil = '" get_date_time(gmtime() + (86400)) . "', modcomment = CONCAT($modcomment, modcomment), hitruns = 0 WHERE id IN (" implode(", "$userids) . ")") or sqlerr(__FILE____LINE__);
        
$count mysql_affected_rows();
        
write_log("Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
        
write_log2("autohitrun""Auto Hit And Run Cleanup: System warned and disabed download(s) from " $count " Member(s)");
    }
    
// ==New remove expired warning and download disablement's for hit and run system
    
$res sql_query("SELECT id FROM users WHERE warned='yes' AND downloadpos='no' AND dlremoveuntil < NOW() AND dlremoveuntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE____LINE__);
    
$msgs_buffer $users_buffer = array();
    if (
mysql_num_rows($res) > 0) {
        
$msg "Your downloads have been enabled and your warning removed. Please keep in your best behaviour from now on.\n";
        while (
$arr mysql_fetch_assoc($res)) {
            
$modcomment sqlesc(gmdate("Y-m-d H:i") . " - Downloads automatically enabled By System\n");
            
$msgs_buffer[] = '(0,' $arr['id'] . ',NOW(), ' sqlesc($msg) . ', \'Downloads enabled\')';
            
$users_buffer[] = '(' $arr['id'] . ',\'yes\',\'no\',\'0000-00-00 00:00:00\',\'0000-00-00 00:00:00\',' $modcomment ')';
        }
        if (
sizeof($msgs_buffer) > 0) {
            
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " implode(', '$msgs_buffer)) or sqlerr(__FILE____LINE__);
            
sql_query("INSERT INTO users (id, downloadpos, warned, dlremoveuntil, warneduntil, modcomment) VALUES " implode(', '$users_buffer) . " ON DUPLICATE key UPDATE downloadpos=values(downloadpos),
    warned=values(warned),dlremoveuntil=values(dlremoveuntil),warneduntil=values(warneduntil),modcomment=concat(values(modcomment),modcomment)"
) or sqlerr(__FILE____LINE__);
            
$count mysql_affected_rows();
            
write_log("Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
            
write_log2("autodewarn""Delayed Cleanup: System enabled download(s) from " $count " Member(s)");
        }
        unset (
$users_buffer);
        unset (
$msgs_buffer);
    }
    
// /////end hitrun script//////// 


Tedmorris 14th January 2019 15:07

What exactly is not working?

elvira 14th January 2019 15:38

cleanup not auto refresh

Tedmorris 15th January 2019 00:32

Wheres the HNR code in your cleanup? It should be near the end.

elvira 15th January 2019 00:43

1 Attachment(s)
Here is it look


All times are GMT +2. The time now is 17:12.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.