Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

Im bringing this one back 'home'. So in return, I plan to improve and shrink the function and update it for newer PHP versions - maybe even utilize new functions.

It clearly needs a lot of work, and here will just be the updates and process along.

Original code:

function pager($rpp, $count, $href, $opts = array()) {
   $pages = ceil($count / $rpp);

   if (!$opts["lastpagedefault"])
       $pagedefault = 0;
   else {
       $pagedefault = floor(($count - 1) / $rpp);
       if ($pagedefault < 0)
           $pagedefault = 0;
   }

   if (isset($_GET["page"])) {
       $page = (int) $_GET["page"];
       if ($page < 0)
           $page = $pagedefault;
   }
   else
       $page = $pagedefault;

   $pager = "";

   $mp = $pages - 1;
   $as = "<b><< ".T_("PREVIOUS")."</b>";
   if ($page >= 1) {
       $pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">";
       $pager .= $as;
       $pager .= "</a>";
   }
   else
       $pager .= $as;
   $pager .= "      ";
   $as = "<b>".T_("NEXT")." >></b>";
   if ($page < $mp && $mp >= 0) {
       $pager .= "<a href=\"{$href}page=" . ($page + 1) . "\">";
       $pager .= $as;
       $pager .= "</a>";
   }
   else
       $pager .= $as;

   if ($count) {
       $pagerarr = array();
       $dotted = 0;
       $dotspace = 3;
       $dotend = $pages - $dotspace;
       $curdotend = $page - $dotspace;
       $curdotstart = $page + $dotspace;
       for ($i = 0; $i < $pages; $i++) {
           if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
               if (!$dotted)
                   $pagerarr[] = "...";
               $dotted = 1;
               continue;
           }
           $dotted = 0;
           $start = $i * $rpp + 1;
           $end = $start + $rpp - 1;
           if ($end > $count)
               $end = $count;
           $text = "$start - $end";
           if ($i != $page)
               $pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>";
           else
               $pagerarr[] = "<b>$text</b>";
       }
       $pagerstr = join(" | ", $pagerarr);
       $pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n";
       $pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n";
   }
   else {
       $pagertop = "<p align=\"center\">$pager</p>\n";
       $pagerbottom = $pagertop;
   }

   $start = $page * $rpp;

   return array($pagertop, $pagerbottom, "LIMIT $start,$rpp");
}


For example, this:

.=

These days are not PHP 4 anymore - so we do not need to append variables. We create a empty variable and check it along the way properly.
Data problem — 2021-09-02 17:24:08 in v2.08 Support
Keep in mind that people do download partials, if they already have the largest file and do not need that large file again only the other files. This is common with games. The opposite for movies (because you have 1 file and maybe a subtitle file).

Detecting partial downloads is nearly impossible for a few reasons, but it can be done I think. V2 was supposed to cover this and support partial and paused events but that has not gone anywhere.
error announce — 2021-08-16 16:43:46 in v3 Support
This is a fault in the TT announce logic. I had it too, I no longer have it at all.

Your best to change your column type to TEXT if not updating the PHP code to use  conditional integer checks.
AJAX Bootstrap — 2021-08-09 21:43:47 in Downloads & Updates
New Bootstrap loader to handle AJAX requests independently.

bootstrap.php

<?
// ST AJAX Bootstrapper
require_once '../config.php';

// Autoloader
spl_autoload_register(function ($className) {
   include_once '../classes/' . $className . '.php';
});

// Init objects
$account = new STAccounts;
$db = $CONFIG['db']['type'] == 'mysql' ? new MySQLConnect : new PostgreSQLConnect;

// Connect to db
$db->connect();

// Additional functions
function html_escape(string $s): ?string
{
   return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
}


AJAX files:
require_once 'bootstrap.php';


More updates will follow. This was a fluke idea I had, in order to seperate my ajax scripts and not rely on the main core files outside of the directory. Completely portable.
torrents in my profile — 2021-08-08 21:39:22 in v3 Support
So many possibilities. Pick one and we can try to port it over..







torrents in my profile — 2021-08-08 18:09:13 in v3 Support
Due to the custom function wrapper for MySQL aging driver.. I can’t be any help here lol
Bug Tracker — 2021-08-07 22:26:42 in M-BiTsy Support
Are you able to implement a bug reporting system per category? Including status progress reporting . It may help a lot but will reduce communication directly, makes sense to keep the existing forum thread while offering the bug tracker in a side block or something.
sql invite — 2021-08-07 18:11:15 in v3 Support
WHERE enabled = ‘yes’ AND email != ‘’

Checks if user is enabled, and checks if email is blank or not.
Clean Up Class — 2021-08-07 00:17:00 in Downloads & Updates
Trust me.. I plan to completely remove libraries altogether, they are just easy roads to pure code (which as we know compiles much faster than a library will). I speak for JS.

I don’t know how many hired devs have tried so hard to convince me to convert my project to Laravel. I’m so against it  :rofl
Clean Up Class — 2021-08-05 04:10:42 in Downloads & Updates
Side note: I tried 4 solutions before comitting to MariaDB and all it provides. Each was overly exotic approaches to the PHP code, highly complex queries that rely on SQL "custom functions" and plain old "connect directly and attempt to optimize", even CLI failed.. take my advice, and update the engine to InnoDB.
Clean Up Class — 2021-08-05 04:08:39 in Downloads & Updates
I dont use this method at all, as I rely on InnoDB and do nightly SQL backups all the same (so it skips this step). Im glad it has worked for you, and more specially on MyISAM database engines.
This should be achieved with CSS first before consulting a library for a simple task. Understand CSS and browser support first or you will always rely on others/github

The answer is most likely the flex property.
Clean Up Class — 2021-08-04 04:11:02 in Downloads & Updates
Also, there are several updates that can be applied as well, as I never updated the core routines, just updated the class to be current.

It has a lot to go yet. But I don’t know how long this will go as BitTorrent is partially dying out so we are just prepping for a transition toward a Reddit-like community with a rich database. The rest is smoke.
Clean Up Class — 2021-08-03 13:38:33 in Downloads & Updates
Anytime man, we needed it working so I produced this. I have mine set as a cron task every 10 minutes.

Almost 40K without issues.
Clean Up Class — 2021-08-01 23:48:16 in Downloads & Updates
class.cleanup.php

<?
interface Tasks
{
   public function seedbonus();
   public function comments();
   public function checkexpiredwarns();
   public function ratiowarn();
   public function cleanlogs();
   public function autopromote();
   public function autofreeleech();
   public function autodemote();
   public function checkdead();
   public function pendingusers();
   public function privseeders();
   public function startsync();
   public function cleanshoutbox();
}

class Database
{
   public $pdo;
   
   public function __construct($db = 'db1', $username = 'user', $password = '', $host = 'localhost', $port = 3306, $options = [])
   {
       $dsn = "mysql:host=$host;dbname=$db;port=$port;charset=utf8mb4";
       try {
           $this->pdo = new PDO($dsn, $username, $password, $options);
       }
       catch (PDOException $e) {
           $this->log_exception($e->getMessage(), $e->getLine());
       }
   }
   
   private function log_exception($msg, $line)
   {
       $query = "INSERT INTO sql_logging(exception, added) VALUES(?, NOW())";
       $stt   = $this->pdo->prepare($query);
       $stt->bindValue(1, $msg . $line);
       $stt->execute();
   }
   
   public function get_date_time($timestamp = 0)
   {
       if ($timestamp)
           return date('Y-m-d H:i:s', $timestamp);
       else
           return gmdate('Y-m-d H:i:s');
   }
   
   public function preprocess($query, $get_id)
   {
       return $query;
   }
   
   public function write_log($text)
   {
       $this->query_params('INSERT INTO log (added, txt) VALUES(NOW(), :log)', array(
           'log' => $text
       ));
   }
   
   public function sql_timestamp_to_unix_timestamp($s)
   {
       return mktime(substr($s, 11, 2), substr($s, 14, 2), substr($s, 17, 2), substr($s, 5, 2), substr($s, 8, 2), substr($s, 0, 4));
   }
   
   public function gmtime()
   {
       return $this->sql_timestamp_to_unix_timestamp($this->get_date_time());
   }
   
   public function interval($s)
   {
       return sprintf("INTERVAL '%s'", $s);
   }
   
   public function query_params($query, $params = null, $get_id = null)
   {
       if (is_null($params)) {
           $params = array();
       }
       try {
           $query = $this->preprocess($query, $get_id);
           $stmt  = $this->pdo->prepare($query);
           foreach ($params as $key => $param) {
               if ($key == "data") {
                   $stmt->bindValue(':' . $key, $param, PDO::PARAM_LOB);
               } else if ($key == "limit") {
                   $stmt->bindValue(':' . $key, (int) trim($param), PDO::PARAM_INT);
               } else {
                   $stmt->bindValue(':' . $key, $param);
               }
           }
           $stmt->execute();
           $stmt->setFetchMode(PDO::FETCH_ASSOC);
           if (is_null($get_id)) {
               return $stmt;
           } else {
               return $this->get_last_id($stmt, $get_id);
           }
       }
       catch (PDOException $e) {
           $this->log_exception($e->getMessage(), $e->getLine());
       }
   }
}

class Cleanup extends Database implements Tasks
{
   public function cleanlogs()
   {
       $ts = $this->gmtime() - 28 * 86400; // 28 days * 24 hours
       $this->query_params('DELETE FROM log WHERE added < FROM_UNIXTIME(:ts)', array(
           'ts' => $ts
       ));
   }
   
   public function checkdead()
   {
       $deadtime  = $this->gmtime() - 21600; // 6 hours
       $founddead = $this->query_params('SELECT COUNT(torrent_id) AS dead FROM torrents WHERE seeders = 0 AND leechers = 0');
       $find      = $founddead->fetch();
       $check = $this->query_params("UPDATE torrents SET marked_dead = 'yes' WHERE visible = 'yes' AND last_action < FROM_UNIXTIME(:dead_time) AND seeders = '0' AND leechers = '0' AND external != 'yes'", array(
        'dead_time' => $deadtime
       ));
       if ($check) {
       $event = "$find[dead] torrents found dead";
   $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
            'receiver' => 'NerbBot',
'event' => $event
));
       }        
   }
   
   public function seedbonus()
   {
       $res = $this->query_params("SELECT DISTINCT u.user_id as peer, u.username, (SELECT DISTINCT COUNT(torrent_id) FROM peers WHERE seeder = 'yes' AND user_id = peer) AS count FROM peers p LEFT JOIN users u ON u.user_id = p.user_id WHERE p.seeder = 'yes'");
       while ($row = $res->fetch()) {
           $update = $this->query_params('UPDATE users SET seedbonus = seedbonus + :bonustime_rowcount WHERE user_id = :peer', array(
               'bonustime_rowcount' => (0.5 * $row['count']),
               'peer' => $row['peer']
           ));
           /*
           if ($update) {
               $event = "+ Seed Bonus points granted for [url=https://domain.com/images/nerbbot/private_seeders.png[/img]";
               $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                   'receiver' => $row['username'],
                   'event' => $event
               ));
           }
           */
       }
   }
   
   public function autofreeleech()
   {
       $gigs  = 17179869184; // 16gb
       $query = $this->query_params("SELECT torrent_id, name FROM torrents WHERE banned = 'no' AND freeleech = '0' AND size >= :gigs", array(
           'gigs' => $gigs
       ));
       if ($query) {
           while ($row = $query->fetch()) {
               $event = "$row[name] cycled to Freeleech (16GB+)";
               $this->query_params("UPDATE torrents SET freeleech = '1' WHERE torrent_id = :torrent_id", array(
                   'torrent_id' => $row['torrent_id']
               ));
               $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                   'receiver' => 'NerbBot',
                   'event' => $event
               ));
               $this->write_log("Freeleech added on <a href='/details/$row[torrent_id]'>$row[name]</a> because it is larger than 16GB or larger.");
           }
       }
   }
   
   public function pendingusers()
   {
       $deadtime = $this->gmtime() - 259200; // 3 days * 72 hours
       $this->query_params("DELETE FROM users WHERE status = 'pending' AND added < FROM_UNIXTIME(:dead_time)", array(
           'dead_time' => $deadtime
       ));
   }
   
   public function cleanshoutbox()
   {
       $ts = $this->gmtime() - 1 * 86400; // 1 day * 24 hours
       $this->query_params('DELETE FROM shoutbox WHERE added < FROM_UNIXTIME(:ts)', array(
           'ts' => $ts
       ));
   }
   
   public function startsync() {
   
   // Synronize seeders/leechers from peer table => torrent table
   $collect = $this->query_params("SELECT t.torrent_id AS this, (SELECT COUNT(torrent_id) FROM peers WHERE seeder = 'yes' AND completed = 1 AND torrent_id = this) AS seeders, (SELECT COUNT(torrent_id) FROM peers WHERE seeder = 'no' AND completed = 0 AND torrent_id = this) AS leechers FROM peers LEFT JOIN torrents t ON t.torrent_id = peers.torrent_id");
   if (!is_null($collect)) {
   foreach ($collect as $row) {
   $sync = $this->query_params('UPDATE torrents SET seeders = :seeders, leechers = :leechers WHERE torrent_id = :torrent_id', array('seeders' => $row['seeders'], 'leechers' => $row['leechers'], 'torrent_id' => $row['this'])); // Update torrent table: seeders/leechers  
   }
   if ($sync) {
    $event    = "Syncing torrents completed";
$this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
'receiver' => 'System',
'event' => $event
));
        }
   }
   }
   
   public function privseeders()
   {
       $res      = $this->query_params("SELECT t.torrent_id, (SELECT COUNT(torrent_id) FROM peers WHERE seeder = 'yes' AND completed = 1) AS seeders, COUNT(seeders) AS c FROM torrents t LEFT JOIN peers p ON p.torrent_id = t.torrent_id WHERE t.banned = 'no' AND t.external = 'no'");
       $getcount = $res->fetch();
       $event    = "Bot: Found $getcount[c] Private Seeders";
       $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
           'receiver' => 'NerbBot',
           'event' => $event
       ));
   }
   
   public function comments()
   {
       $getcount = $this->query_params('SELECT COUNT(torrent) as c FROM comments');
       $restotal = $getcount->fetch();
       $event    = "Bot: $restotal[c] comments posted";
       $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
           'receiver' => 'NerbBot',
           'event' => $event
       ));
   }
   
   public function autopromote()
   {
       $limit    = 25 * 1024 * 1024 * 1024;
       $minratio = 1.05;
       $maxdt    = $this->get_date_time(time() - 86400 * 28); // 24 hours * 28 days
       $res      = $this->query_params('SELECT user_id, username FROM users WHERE class = 1 AND uploaded >= :limit AND uploaded / downloaded >= :minratio AND added < :maxdt', array(
           'limit' => $limit,
           'minratio' => $minratio,
           'maxdt' => $maxdt
       ));
       if ($res) {
           $dt  = $this->get_date_time();
           $msg = "Congratulations, you have been automatically promoted to Power User. You can now do more stuff.";
           while ($arr = $res->fetch()) {
               $this->query_params('UPDATE users SET class = 2 WHERE user_id = :user_id', array(
                   'user_id' => $arr['user_id']
               ));
               $txt   = "You have been promoted to Power User!";
               //$event = "$arr[username] has been promoted Power User";
               $this->query_params('INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES(0, :user_id, NOW(), :message, 0, :subject)', array(
                   'user_id' => $arr['user_id'],
                   'message' => $txt,
                   'subject' => 'Promoted!'
               ));
               /*
               $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                   'receiver' => $arr['username'],
                   'event' => $event
               ));
               */
               $this->write_log("The user <a href=\"/user/?id=$arr[user_id]\">$arr[username]</a> was automatically promoted to power user.");
           }
       }
   }
   
   public function autodemote()
   {
       $minratio = 0.95;
       $res      = $this->query_params('SELECT user_id, username FROM users WHERE class = 2 AND uploaded / downloaded < :minratio', array(
           'minratio' => $minratio
       ));
       if ($res) {
           $dt  = $this->get_date_time();
           $msg = "You were automatically demoted from Power User to Regular because your share ratio fell below $minratio.";
           while ($arr = $res->fetch()) {
               $this->query_params('UPDATE users SET class = 1 WHERE user_id = :user_id', array(
                   'user_id' => $arr['user_id']
               ));
               $txt   = "You have been demoted to Regular.";
               //$event = "$arr[username] has been demoted to Regular";
               $this->query_params('INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES(0, :user_id, NOW(), :message, 0, :subject)', array(
                   'user_id' => $arr['user_id'],
                   'message' => $txt,
                   'subject' => 'Demoted!'
               ));
               /*
               $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                   'receiver' => $arr['username'],
                   'event' => $event
               ));
               */
               $this->write_log("The user <a href=\"/user/?id=$arr[user_id]\">$arr[username]</a> was automatically promoted to power user.");
           }
       }
   }
   
   public function checkexpiredwarns()
   {
       $res = $this->query_params("SELECT users.user_id, users.username, warnings.expiry FROM users INNER JOIN warnings ON users.user_id=warnings.userid WHERE type != 'Poor Ratio' AND warned = 'yes' AND enabled='yes' AND warnings.active = 'yes' AND warnings.expiry < :date_time", array(
           'date_time' => $this->get_date_time()
       ));
       while ($arr1 = $res->fetch()) {
           $this->query_params("UPDATE users SET warned = 'no' WHERE user_id = :user_id", array(
               'user_id' => $arr1['user_id']
           ));
           $this->query_params("UPDATE warnings SET active = 'no' WHERE userid = :user_id AND expiry < :date_time", array(
               'user_id' => $arr1['user_id'],
               'date_time' => $this->get_date_time()
           ));
           $event = "Warning removed for $arr1[username]. Expiry: $arr1[expiry]";
           $this->write_log("Removed warning for $arr1[username]. Expiry: $arr1[expiry]");
       }
       $this->query_params("UPDATE users SET warned = 'yes' WHERE warned = 'no' AND user_id IN (SELECT userid FROM warnings WHERE active = 'yes')");
       while ($active = $res->fetch()) {
       /*
           $event = "Active warning renewed for $active[username]";
           $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
               'receiver' => 'NerbBot',
               'event' => $event
           ));
           */
       }
   }
   
   public function ratiowarn()
   {
       //if ($this->CONFIG['ratiowarn_enable']) {
           $minratio   = 0.4;
$downloaded = 4 * 1024 * 1024 * 1024;
$length     = 14;
           $res        = $this->query_params("SELECT user_id, username FROM users WHERE class = 1 AND warned = 'no' AND enabled='yes' AND uploaded / downloaded < :minratio AND downloaded >= :downloaded", array(
               'minratio' => $minratio,
               'downloaded' => $downloaded
           ));
           if ($res) {
               $timenow    = $this->get_date_time();
               $reason     = "You have been warned because of having low ratio. You need to get a " . $minratio . " before next " . $length . " days or your account may be banned.";
               $expiretime = gmdate('Y-m-d H:i:s', $this->gmtime() + (86400 * $length));
               while ($arr = $res->fetch()) {
                   /*$warneduser = $arr['username'];
                   $event      = "Low ratio warning added for [url=https://www.switch-torrents.com/user/?id=$arr[user_id]]$arr[username][/url]";
                   $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                       'receiver' => $warneduser,
                       'event' => $event
                   ));
                   */
                   $this->query_params('INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES (:user_id, :reason, NOW(), :expiretime, 0, :type)', array(
                       'user_id' => $arr['user_id'],
                       'reason' => $reason,
                       'expiretime' => $expiretime,
                       'type' => 'Poor Ratio'
                   ));
                   $this->query_params("UPDATE users SET warned = 'yes' WHERE user_id = :user_id", array(
                       'user_id' => $arr['user_id']
                   ));
                   $this->query_params('INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES (0, :user_id, NOW(), :reason, 0, :subject)', array(
                       'user_id' => $arr['user_id'],
                       'reason' => $reason,
                       'subject' => 'Warning: Poor Ratio'
                   ));
                   $this->write_log("Auto Leech warning has been <b>added</b> for <a href='/user/?id=" . $arr["user_id"] . "'>" . $arr["username"] . "</a>");
               }
           }
           $res1 = $this->query_params("SELECT users.user_id, users.username FROM users INNER JOIN warnings ON users.user_id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND warned = 'yes' AND enabled='yes' AND uploaded / downloaded >= :minratio AND downloaded >= :downloaded", array(
               'minratio' => $minratio,
               'downloaded' => $downloaded
           ));
           if ($res1) {
               $timenow = $this->get_date_time();
               $reason  = "Your warning of low ratio has been removed. We highly recommend you to keep a your ratio up to not be warned again.\n";
               while ($arr1 = $res1->fetch()) {
                   /*$warnremoved = $arr1['username'];
                   $event       = "Low ratio warning removed for [url=https://www.switch-torrents.com/user/?id=$arr1[user_id]]$arr1[username][/url]";
                   $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                       'receiver' => $warnremoved,
                       'event' => $event
                   ));
                   */
                   $this->query_params("UPDATE users SET warned = 'no' WHERE user_id = :user_id", array(
                       'user_id' => $arr1['user_id']
                   ));
                   $this->query_params("UPDATE warnings SET expiry = :time_now, active = 'no' WHERE userid = :user_id", array(
                       'time_now' => $timenow,
                       'user_id' => $arr1['user_id']
                   ));
                   $this->query_params('INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES (0, :user_id, NOW(), :reason, 0, :subject)', array(
                       'user_id' => $arr1['user_id'],
                       'reason' => $reason,
                       'subject' => 'Ratio Warning Removed'
                   ));
                   $this->write_log("Auto Leech warning has been removed for: <a href='/user/?id=" . $arr1["user_id"] . "'>" . $arr1["username"] . "</a>");
               }
           }
           $res = $this->query_params("SELECT users.user_id, users.username, users.limited, UNIX_TIMESTAMP(warnings.expiry) AS expiry FROM users INNER JOIN warnings ON users.user_id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND class = 1 AND enabled='yes' AND warned = 'yes' AND uploaded / downloaded < :minratio AND downloaded >= :downloaded", array(
               'minratio' => $minratio,
               'downloaded' => $downloaded
           ));
           if ($res->fetch() > 0) {
               $timenow = $this->get_date_time();
               $expires = (86400 * $length);
               while ($arr = $res->fetch()) {
                   if ($this->gmtime() - $arr['expiry'] >= 0) {
                       /*$limiteduser = $arr['username'];
                       $event       = "[url=https://www.switch-torrents.com/user/?id=$arr[user_id]]$arr[username][/url] has been limited (Auto Leech warning)";
                       $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
                           'receiver' => $limiteduser,
                           'event' => $event
                       ));
                       */
                       $this->query_params("UPDATE users SET limited = 'yes', warned = 'no' WHERE user_id = :user_id", array(
                           'user_id' => $arr['user_id']
                       ));
                       $this->write_log("User <a href='/user/?id=" . $arr["user_id"] . "'>" . $arr["username"] . "</a> has been <b>limited</b> (Auto Leech warning)");
                   }
               }
           }
       //}
       $res = $this->query_params("SELECT users.user_id, users.username, warnings.expiry FROM users INNER JOIN warnings ON users.user_id=warnings.userid WHERE type != 'Poor Ratio' AND warned = 'yes' AND enabled='yes' AND warnings.active = 'yes' AND warnings.expiry < :date_time", array(
           'date_time' => $this->get_date_time()
       ));
       while ($arr1 = $res->fetch()) {
           $this->query_params("UPDATE users SET warned = 'no' WHERE user_id = :user_id", array(
               'user_id' => $arr1['user_id']
           ));
           $this->query_params("UPDATE warnings SET active = 'no' WHERE userid = :user_id AND expiry < :date_time", array(
               'user_id' => $arr1['user_id'],
               'date_time' => $this->get_date_time()
           ));
           $event = "Warning removed for $arr1[username]. Expiry: $arr1[expiry]";
           $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
               'receiver' => 'NerbBot',
               'event' => $event
           ));
           $this->write_log("Removed warning for $arr1[username]. Expiry: $arr1[expiry]");
       }
       $this->query_params("UPDATE users SET warned = 'yes' WHERE warned = 'no' AND user_id IN (SELECT userid FROM warnings WHERE active = 'yes')");
       while ($active = $res->fetch()) {
           $event = "Active warning renewed for $active[username]";
           $this->query_params('INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, :receiver, :event, NOW(), 0)', array(
               'receiver' => 'NerbBot',
               'event' => $event
           ));
       }
   }
}


methods:

$task = new Cleanup;

$task->seedbonus();
$task->comments();
$task->checkexpiredwarns();
$task->ratiowarn();
$task->cleanlogs();
$task->autopromote();
$task->autofreeleech();
$task->autodemote();
$task->checkdead();
$task->pendingusers();
$task->privseeders();
$task->startsync();
$task->cleanshoutbox();
Test site with php 8 — 2021-08-01 22:28:01 in v3 Support
Your doing great - keep at it, we are all learning and love what we do on spare time  :grin
Use PHP's built-in SPL autoload class. It is faster and is the preferred way.


spl_autoload_register(function __autoload($f) {
   include_once 'backend/' . $f . '.php';
});


PHP version 5.2.1 or greater
xxx filter — 2021-07-30 02:55:19 in v2.08 Mods Completed
What is this for, the MVC edition or the live site here?
Test site with php 8 — 2021-07-30 02:47:45 in v3 Support
That says "Update the code, we expect to check these variables now", you want a updated codebase. You want a light-weight solution to all 4 corners, and never seeing any of those warnings. Not errors, warnings.. its training wheels for developers getting into later versions of the PHP intrepeter.

Those warnings should never be noted. But the code is being reworked, and currently as my own edition is too much I think for average user.. await the updates you see posted here!
xxx filter — 2021-07-25 23:07:05 in v2.08 Mods Completed
this sounds like a function callback to filter keywords upon a given array (like descr), is that right?
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 7
  • Members: 0
  • Guests online: 7
  • Comments: 3
  • Messages: 1,728