Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #21  
Old 12th January 2019, 12:38
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default
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;

Reply With Quote
  #22  
Old 12th January 2019, 14:37
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
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.
Reply With Quote
  #23  
Old 12th January 2019, 15:25
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default
ok please post and thanks for help
Reply With Quote
  #24  
Old 12th January 2019, 17:47
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
Is your snatched code working? Do you have any data in the snatched table?
Reply With Quote
  #25  
Old 12th January 2019, 19:06
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default
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:
Reply With Quote
  #26  
Old 12th January 2019, 21:15
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
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?

Last edited by Tedmorris; 12th January 2019 at 21:26.
Reply With Quote
  #27  
Old 12th January 2019, 22:04
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default
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"]);
// ///////////// 
Reply With Quote
  #28  
Old 13th January 2019, 03:01
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
But your OP says it wasn't working. Hows it working all of a sudden?
Reply With Quote
  #29  
Old 13th January 2019, 14:39
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default
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//////// 
Reply With Quote
  #30  
Old 14th January 2019, 15:07
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
What exactly is not working?
Reply With Quote
Reply

Tags
hit , hitrun , mod , run

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 13:55. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.