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

I should make likes for comments
Announce - BIGINT Errors — 2020-06-11 01:53:49 in v3 Support
Thank you guys! I'll look into date format and see what might be going on.
Announce - BIGINT Errors — 2020-06-09 10:17:43 in v3 Support
I have torrent/seeders/leechers set to INT length of 10, is that value sufficient? I can't remember changing it, but did look at it some months ago
Announce - BIGINT Errors — 2020-06-09 02:12:06 in v3 Support
I have been trying to tackle for this quite a while, and I know I can take this to stack-overflow, but as we all use the same script its better to ask here.

Ive been dealing with this for months:


Database Error in announce.php on line 379: BIGINT UNSIGNED value is out of range in '`db1`.`torrents`.`leechers` - 1'. Query was: UPDATE torrents SET leechers = leechers - 1,seeders = seeders + 1,visible = 'yes',last_action = '2020-06-08 20:46:39' WHERE id=1017


I can't figure this out, I've increased and tried modifying field type in database, but it creeps back to the error above anyway. Does anyone know what this is about?
This is being taken down in place of a new user class, offering sessions and bcrypt that will be posted soon.
— 2020-06-03 16:23:52 in
"Madness85, post: 68333, member: 20433":

I agree, bvlist is a bit dated and could do with an upgrade.

That being said, this attempt didn't go very far. Nobody uploaded any sources.


Nah, we just sit back and chill  :LOL:
I've made BCrypt and PDO registration script I'm staging to redo my signup page and get rid 90% of the current file size.

So I forgot to include a form last time, i've included one this time. It works as it is. Next will be a stand-alone login form supporting this script. PDO Edition does the same thing, only different code.
This is about as simple as it gets. This bypasses TT entirely this time.. as do all my mods, just for kicks ?

In this release, I transferred over my avatar upload feature with thumbnail resizing (image_thumb.ext) and original (original filename). It's saved me many GB's worth of bandwidth alone since February. Its a must-have for high traffic and a lot of users.

Add to backend/functions.php


function imageResize($imageSrc, $imageWidth, $imageHeight)
{
   $newImageWidth  = 200;
   $newImageHeight = 200;
   $newImageLayer  = imagecreatetruecolor($newImageWidth, $newImageHeight);
   imagecopyresampled($newImageLayer, $imageSrc, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $imageWidth, $imageHeight);
   return $newImageLayer;
}


Now create register.php


<?
require_once 'backend/functions.php';
if (isset($_POST['submit'], $_POST['username'], $_POST['password'])) {
   if (is_array($_FILES)) {
       $uploadedFile     = $_FILES['avatar']['tmp_name'];
       $sourceProperties = getimagesize($uploadedFile);
       $newFileName      = sha1_file($uploadedFile);
       $dirPath          = "images/avatars/";
       $ext              = pathinfo($_FILES['avatar']['name'], PATHINFO_EXTENSION);
       $imageType        = $sourceProperties[2];
       switch ($imageType) {
           case IMAGETYPE_PNG:
               $imageSrc = imagecreatefrompng($uploadedFile);
               $tmp      = imageResize($imageSrc, $sourceProperties[0], $sourceProperties[1]);
               imagepng($tmp, $dirPath . $newFileName . "_thumb." . $ext);
               break;
           case IMAGETYPE_JPEG:
               $imageSrc = imagecreatefromjpeg($uploadedFile);
               $tmp      = imageResize($imageSrc, $sourceProperties[0], $sourceProperties[1]);
               imagejpeg($tmp, $dirPath . $newFileName . "_thumb." . $ext);
               break;
           case IMAGETYPE_GIF:
               $imageSrc = imagecreatefromgif($uploadedFile);
               $tmp      = imageResize($imageSrc, $sourceProperties[0], $sourceProperties[1]);
               imagegif($tmp, $dirPath . $newFileName . "_thumb." . $ext);
               break;
           default:
               echo "Invalid avatar image. Please <a href='" . $site_config['SITEURL'] . "/signup/'>go back</a> and try again.";
               exit;
               break;
       }
       move_uploaded_file($uploadedFile, $dirPath . $newFileName . "." . $ext);
   }
   try {
       $dsn      = 'mysql:dbname=database;host=localhost';
       $user     = 'username';
       $password = 'password';
       $conn     = new PDO($dsn, $user, $password);
       if (function_exists("filter_var")) {
           $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
           $email    = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
       } else {
           echo "Filter extension for PHP " . phpversion() . " not found. Using unsafe instead.";
           $username = $_POST["username"];
           $email    = $_POST["email"];
       }
       $avatar          = $dirPath . $newFileName . "." . $ext;
       $avatar_thumb    = $dirPath . $newFileName . "_thumb." . $ext;
       $password        = $_POST["password"];
       $saltstr         = '_salt56789012345678901';
       $salt            = password_hash($password, PASSWORD_BCRYPT, array(
           'salt' => $saltstr
       ));
       $cryptedPassword = password_hash($password, PASSWORD_BCRYPT, array(
           'cost' => 11
       ));
       $sql             = "INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, avatar, avatar_thumb) VALUES (:username, :cryptedPassword, :secret, :email, 'confirmed', NOW(), NOW(), 29, 1, 'Male', 'uTorrent', 1, 1, 1, :avatar, :avatar_thumb)";
       $stmt            = $conn->prepare($sql);
       if ($stmt) {
           $stmt->bindParam(":username", $username);
           $stmt->bindParam(":cryptedPassword", $cryptedPassword);
           $stmt->bindParam(":email", $email);
           $stmt->bindParam(":secret", $salt);
           $stmt->bindParam(":avatar", $avatar);
           $stmt->bindParam(":avatar_thumb", $avatar_thumb);
           $result = $stmt->execute();
           echo $result ? 'ok' : 'Query successful';
       } else {
           throw new Exception('Preparing Query Failed');
       }
   }
   catch (Exception $e) {
       echo $e->getMessage();
   }
}
?>


Now create images/avatars and CHMOD 777.

Create as account-register.php


<?
require_once("backend/functions.php");
dbconn(true); stdhead("Sign Up"); begin_frame("Register");
?>

<form method="POST" enctype="multipart/form-data" action="/register.php" autocomplete="off">
   <input type="text" name="username" placeholder="Your Username" /><br><br>
   <input type="email" name="email" placeholder="Your E-mail" /><br><br>
   <input type="password" name="password" placeholder="Your Password" /><br><br>
   <input type="file" name="avatar" accept="image/*"><br><br>
   <button type="submit" name="submit">Sign Up</button>
</form>

<? end_frame(); stdfoot(); ?>


I added the filter module check, and fallback to unsafe vars if not installed.
Just a working basic skeleton that needs a dress. I don't know bootstrap, and it breaks everything I use so I'll leave that up to you.
NOTE: The salt attribute for BCrypt are depreciated as of PHP 7.0 and is encouraged to let password_hash() do it instead. I've put it in anyway for compatibility.

[ATTACH type="full" alt="Register.png"]5574[/ATTACH]
"shadows, post: 68691, member: 20311":

Remove for loop from regex it is performance hungry.

if (preg_match("/(\.php*|\.htm*|\.pl|\.cgi|\.htaccess)/i", $_FILES['file']['name'])) {
exit;
}


I thought so too! Its actually the lazy-mans security approach. Quick and dirty I suppose lol
Look into the docs for that, you will most deffentely will require IIS with .NET support for that language. Does it comes with snap-in modules for IIS? TT is written with Unix filesystem in mind, while it will run in windows, you'll need to adjust paths and ensure it all works on your stack.

Suggestively, I would look into a alternative in respect to PHP/TT.
Here is the working and testing and secured AJAX PDO Torrent Uploader. Wrote for my site as we are in strong need for something better and aim to introduce multi-uploading after this post.

Users like it. It makes my life a lot easier as i don't have to spend endless time filling out every torrent, deal with constant errors of who knows what (torrents-upload.php) and took forever to parse torrents and handle images on high end hardware. So here we have it.

Create ajax_torrentupload.php and add this:



<?

/*  AJAX Torrent Uploader - May 27, 2020

Using Parsing class - Torrent()->object()
Replaces old torrents-upload.php and related classes: BDecode(), BEncode()
Triggered by AJAX call.

Accepts .torrent: Parses data => Inserts to DB => Redirects to edit page

STorrents @ TorrentTrader.xyz

*/

// Required for successful redirect
error_reporting(0);
$blacklist = array(
   ".php",
   ".phtml",
   ".php3",
   ".php4",
   ".pl",
   ".html",
   ".cgi",
   ".htaccess"
);
foreach ($blacklist as $item) {
   if (preg_match("/$item$/i", $_FILES['file']['name'])) {
       exit;
}
}
if (0 < $_FILES['file']['error']) {
   echo 'Error: ' . $_FILES['file']['error'] . '<br>';
} else {
   require_once('backend/class.parse.php');
   $parsepath     = 'uploads/' . $_FILES['file']['name'];
   $torrent       = new Torrent($parsepath);
   $torr_hash     = $torrent->hash_info();
   $torr_announce = $torrent->announce();
   $torr_size     = $torrent->size();
   $torr_saveas   = $torrent->name();
   $torr_private  = $torrent->is_private() ? 'yes' : 'no';
   $userid        = (int) $_POST['userid'];
   require_once 'backend/functions.php';
   try {
       $dsn      = 'mysql:dbname=database;host=localhost';
       $user     = 'username';
       $password = 'password';
       $conn     = new PDO($dsn, $user, $password);
       $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   }
   catch (PDOException $e) {
       die('Error: Unable to connect to database');
   }
   $sql   = "INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, visible, last_action)
   VALUES ('" . $torr_saveas . ".torrent', " . $userid . ", '" . $torr_saveas . "', '" . $torr_saveas . " is currently being updated.', '', '', '1', NOW(), '" . $torr_hash . "', '" . $torr_size . "', 3, '" . $torr_saveas . ".torrent', '" . $torr_announce . "', '" . $torr_private . "', 'no', 1, 'no', 'yes', NOW())";
   $query = $conn->prepare($sql);
   $query->execute();
   $id     = $conn->lastInsertId();
   $rename = "uploads/" . $id . ".torrent";
   if (move_uploaded_file($_FILES['file']['tmp_name'], $rename)) {
       echo $site_config["SITEURL"] . '/torrent-edit.php?id=' . $id;
   }
}
?>


Now add this to header.php


<script>
// AJAX Torrent Upload
$(document).ready(function(a) {
   $("#form-torupload").on("change", function(a) {
   var file_data = $('#uploadTorrent').prop('files')[0];
   var form_data = new FormData();
   form_data.append('file', file_data);      
   $.ajax({
       url: "ajax_torrentupload.php",
       dataType: 'html',
       cache: false,
       contentType: false,
       processData: false,
       data: form_data,    
       type: "POST",
       beforeSend: function () {
           $("#upload-progress").html("Uploading Torrent...").delay(3000).fadeIn().delay(4000).fadeOut();
       },
       success: function(torrent_complete){
           window.location.href = torrent_complete;
       }
    });
   });
});
</script>


Thats it! Just make sure you have jQuery already, and your good to go. This will probably end up on a function someplace far away, but the AJAX is brilliant.

[ATTACH type="full" alt="NewUploader.png"]5565[/ATTACH]

On my end. Your use may greatly vary, but this is what I'm using it for. Use clicks UPLOAD, and it goes to torrent-edit immediately. File downloading is flawless, as we had to ensure our .torrent renames to the new table ID for downloading (download.php) so out of the box compatible.

You can literally take this, and create upload-only torrent tracker posting to this script (dump it in a HTML form page or menu), make a PHP index table of recent uploads and if your feeling creative, follow a signup/login script tutorial for MySQL (really easy, I’ve done it twice), create your users table and upload. You can use your existing torrent table (with all the data), and plug it into the same index. Read from it. It’s too easy. As you see, this script is portable. I did not find a single search engine link to exactly this, why? I dunno.

With this you don’t need TT anymore really, because you plug in everything around it in a template utilizing this uploader. This is the whole reason for using torrent trader, is it’s upload function and announce/web tracker features, The rest is expected, and great but not really necessary, technically.

I will make a zip and create what I just explained. It will work for you, upload your first torrent and scrape it as you visit ?
[URL unfurl="true"]https://stackoverflow.com/questions/8454961/php-fulltext-search-with-pdo[/url]
Let's try this updater code I'm posting later, and see what comes of it. A HTML page will need to be made with a form to send to it (takes a few minutes), otherwise its great. Tested on several public linux torrents from public trackers respectfully, and brings up all data quickly. Images should fly too, no messing around really
"Propaganda, post: 68673, member: 60":

Thanks ST, changed, and once more here is the error log on this one.  typed t'est and the attached error appeared.


Sounds like the column needs to be escaped. I’ll check the log.
"Propaganda, post: 68669, member: 60":

Updating your Signature field, either from you profile or from your account page would not work. It Throws the following error :

Warning: Cannot modify header information - headers already sent by (output started at site/views/themes/u2torrents/topnavbar.php:53) in site/helpers/exception_helper.php on line 94 Call Stack: 0.0142 597408 1. handleUncaughtException() site/helpers/exception_helper.php:0 0.0142 597488 2. header() site/helpers/exception_helper.php:94 Warning: error_log(exception_log.txt): failed to open stream: Permission denied in site/helpers/exception_helper.php on line 104 Call Stack: 0.0142 597408 1. handleUncaughtException() site/helpers/exception_helper.php:0 0.0144 599456 2. error_log() site/helpers/exception_helper.php:104

This seems to be related to the "[color=rgb(250, 197, 28)] ' [/color]" character. Inserting Text, works. Inserting Te'xt throws the error.

In the same area, clicking on the "javascript:popMoreTags();" (HTML is not allowed.  [url='https://www.torrenttrader.xyz/javascript%3APopMoreTags();']Click here[/url] for available tags) link - does not popup the tags, but instead loads index.php in popup.


Man.. that error exception is something else, I can't imagine its ever easy reading that. CHMOD 777 exception_log.txt
Long Load time — 2020-05-25 20:41:36 in M-BiTsy Support
Are you guys on VPS/shared?
It’s because your logged in as admin, so you get the user edit form and fields, and since there is a password field to edit for that user ID, the browser thinks you want to login or change your password. I don’t know why this field is filled in already.
Tried of the old template system. Ugly. Time for change. Here I've decided to strip away further out of TT and plug into a template engine, that allows me to code much more efficiently, use plugins and really extend data the way I want to. Not to mention, its caching feature on all TPL files.

Take lines and lines of code, and compare that to a single tag, example

Hello, [color=rgb(41, 105, 176)]{$username}[/color]. You have [color=rgb(41, 105, 176)]{$totalinvites}[/color] remaining.

$smarty->assign('username', $CURUSER["username"]);


And on and on. Passing variables over to the template engine. Really read about  Smarty first. I've converted almost all pages on my site, reducing code and file size by a lot. Its done my design work and rendering a world of difference.

This is [color=rgb(226, 80, 65)]not compatible[/color] with PDO edition, which uses MVC framework and as Smarty claims to work with all of them, I wouldn't recommend it. I can't imagine that is a easy experience.
This mod will replace torrent index, header and footer - leaving all other pages the exact same!

Read about it here - https://www.smarty.net

So I'll log what I've done so far along. It's constantly changing.

First, upload contents of ZIP to root /

Open backend/functions.php and find:

require_once(BACKEND."/languages.php");


And add under:


// Smarty PHP Compiling Template Engine 3.1.34 (latest dev)
require_once(BACKEND."/Smarty/Smarty.class.php");
$smarty = new Smarty();

$smarty->setTemplateDir('../templates/');
$smarty->setCompileDir('../templates_c/');
$smarty->setConfigDir('../configs/');
$smarty->setCacheDir('../cache/');


We are going to bypass by ignoring this present in backend/functions.php and leave as-is.

require_once("themes/" . $THEME . "/block.php");
require_once("themes/" . $THEME . "/header.php");

Because we are now phasing out stdhead() and stdfoot() effectively removing the forced header/footer of the /theme directory.

For the simplicity of the walkthrough (because its worth it), use this developed index2.php and now you will be phasing out the old torrenttable()

Create as index2.php and copy to root (also included in ZIP):


<?
require_once 'backend/functions.php';
dbconn(true);

// PDO Connection
$db = new PDO("mysql:host={$dbHost};dbname={$dbName};charset=utf8", $dbUsername, $dbPassword);
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

$admin     = $CURUSER["class"] == 7;
$avatar    = $CURUSER["avatar"];
$class     = $CURUSER["class"];
$themename = mysql_fetch_assoc(SQL_Query_exec("SELECT uri FROM stylesheets WHERE id='" . ( $CURUSER ? $CURUSER['stylesheet'] : $site_config['default_theme'] )  . "'"));
$theme     = $themename['uri'];
$siteurl   = $site_config["SITEURL"];
$torrentid = $id;
$userid    = $CURUSER["id"];
$date_time = get_date_time(gmtime()-(3600*24));
$usersadded = number_format(get_row_count("users", "WHERE users.added>='$date_time'"));

if (stripos($_SERVER['PHP_SELF'],'index.php')) {
   $indexonly = true;
}

// Messages
$mail = $db->prepare("SELECT COUNT(id) FROM messages WHERE receiver = :userid AND unread = 'yes' AND location IN ('in','both') LIMIT 1");
$mail->bindParam(":userid", $userid, PDO::PARAM_INT);
$mail->execute();
$messages = $mail->fetchColumn();

// Conditions
$smarty->assign('loggedin', $CURUSER);
$smarty->assign('admin', $admin);
$smarty->assign('avatar', $avatar);
$smarty->assign('theme', $theme);
$smarty->assign('unreadmail', $messages);
$theme = $site_config['default_theme_name'];

if ($CURUSER){
$lastchance = isset($_GET['lc']);
$maxslot     = avail_slots($userid, $class);
$userslots  = number_format($maxslot) . "/0";
$userratio  = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
}

// Spotlight
$spotlight = $db->prepare("SELECT id, name, cover1 FROM torrents ORDER BY added DESC LIMIT 8");
$spotlight->execute();
$spotlight->setFetchMode(PDO::FETCH_ASSOC);

// Languages
$language = $db->prepare("SELECT id, name, uri FROM languages");
$language->execute();
$language->setFetchMode(PDO::FETCH_ASSOC);

// Stylesheets (legacy)
$stylesheet = $db->prepare("SELECT id, name FROM stylesheets");
$stylesheet->execute();
$stylesheet->setFetchMode(PDO::FETCH_ASSOC);

// Torrent Comments
$comments = $db->prepare("SELECT comments.id, comments.text, comments.user, comments.added, users.avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = torrents.id ORDER BY comments.id LIMIT 2");
$comments->execute();
$comments->setFetchMode(PDO::FETCH_ASSOC);

// Torrent Table
$results = 13;
$torrenttable = $db->prepare("SELECT torrents.id, torrents.hits, torrents.views, torrents.image1, torrents.anon, torrents.announce, torrents.category, torrents.leechers, torrents.nfo, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments AS commentcount, torrents.numfiles, torrents.filename, torrents.owner, torrents.external, torrents.freeleech, categories.name AS cat_name, categories.image AS cat_pic, categories.parent_cat AS cat_parent, users.username, users.avatar, users.privacy, IF(torrents.numratings < 1, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE visible = 'yes' AND banned = 'no' ORDER BY torrents.added DESC LIMIT :limit");
$torrenttable->bindParam(":limit", $results, PDO::PARAM_INT);

if ($CURUSER)
   $db->query("UPDATE users SET last_browse=" . gmtime() . " WHERE id=$CURUSER[id]");

$torrenttable->execute();
$torrenttable->setFetchMode(PDO::FETCH_BOTH);

// Assign
$smarty->assign('username', $CURUSER["username"]);
$smarty->assign('userid', $CURUSER["id"]);
$smarty->assign('avatar', $avatar);
$smarty->assign('url', $siteurl);
$smarty->assign('indexonly', $indexonly);
$smarty->assign('lastchance', $lastchance);
$smarty->assign('torrentid', $torrentid);
$smarty->assign('usersadded', $usersadded);
$smarty->assign('languages', $language);
$smarty->assign('stylesheet', $stylesheet);
$smarty->assign('spotlight', $spotlight);
$smarty->assign('comments', $comments);
$smarty->assign('slots', $userslots);
$smarty->assign('ratio', $userratio);
$smarty->assign('torrenttable', $torrenttable); // torrenttable

// Display
$smarty->display('index.tpl');
?>


You have several vars assigned, allowing to easily pull any data out. Torrent index is now independent. Compare that to existing torrent table in functions file (y)

Now create index.tpl and copy this to /templates


{include file='header.tpl'}

{include file='footer.tpl'}


Now create footer.tpl and copy this to /templates


<!-- HTML footer -->


Now create header.tpl and copy this to /templates


{* MAIN HEADER *}

<!DOCTYPE html>
<html lang="en-US"
   itemscope
   itemtype="http://schema.org/WebSite"
   prefix="og: http://ogp.me/ns#" >
<head>

   {include file='header_resource.tpl'}

<style>

   {include file='header_extracss.tpl'}

</style>

<script>

   {include file='header_javascript.tpl'}

</script>

</head>

<body>

{include file='header_nav.tpl'}

<div class="container-main">

   <div class="primary"><!-- *** START PRIMARY *** -->

{if $loggedin}

<!-- logged in HTML -->

{include file='ajax_shoutbox.tpl'}

{/if}

<div class="content-inner">

<!-- Migrate -->
                           
 <div class='myTable'>
   <div class='myTrow'>
     <div class='main'>
       <table width='100%' border='0' cellspacing='10' cellpadding='0'>
         <tr>
           <td valign='top'>


{include file='torrentindex.tpl'}


Lastly, create torrentindex.tpl and copy this to /templates


{* MAIN TORRENT INDEX *}

{foreach $torrenttable as $item}

<a href="{$url}/torrents-details.php?id={$item.id}">
     
<img src="{$url}/uploads/images/{$item.image1}" />

<span>{$item.added|date_format} by <a href='{$url}/user/?id={$item.owner}'> {$item.username}</a> <img src='{$url}/{$item.avatar}' /></span>

<span>{$item.views}</span>
<span>{$item.hits}</span>
<span>{$item.speed}</span>
           
<a title="{$item.name}" href="/details/{$item.id}/">{$item.name|truncate:29}</a>

<span>{if $item.rating}{$item.rating} / 5.0{/if}</span>

<span><a href='{$url}/cat/{$item.category}/' title='Browse {$item.category} Torrents'>{$item.cat_name}</a></span>
           
<span>{$item.size|filesize}</span>

<span>{$item.seeders}</span>

<span>{$item.leechers}</span>

{/foreach}


--

Working and running Live on my site with flying colours. Everything works and the files are all much smaller and less lines by far!
Enchanced Requests — 2020-05-24 12:57:22 in v3 Mods Completed
Anything missing, add to language file
Seed Bonus [TTv3] — 2020-05-24 09:59:23 in v3 Mods Completed
"m-jay, post: 68645, member: 20288":

noticed a error with this mod when updating

in config we use

$site_config['autoclean_interval'] = 600; // time to cleanup (10 minutes)


we need new config time

$site_config['add_bonus'] = 3600; // time to add bonus (1 hour)


so bonus is not correct its more like this
You recieve X points per 10 minutes the system registers you as a seeder by torrent.

so in mybonus change

floor($site_config['autoclean_interval'] / 10),


to [color=rgb(250, 197, 28)]should be 60 for seconds[/color]


floor($site_config['add_bonus'] / 60),


then we put new condition on cleanup - the auto cleanup 10 minutes the seedbonus 1 hour

// Seedbonus Mod
   $now = gmtime();
   $dobonus = 0;

   $res = SQL_Query_exec("SELECT last_time FROM tasks WHERE task='bonus'");
   while ( $row = mysqli_fetch_object($res) )

   if (!$row) {
       SQL_Query_exec("INSERT INTO tasks (task, last_time) VALUES ('bonus',$now)");
       // write_log("theres was no row silly we need one to start");
   }

   $ts = $row['last_time']; // $row['0'] returned null

   if ($ts + $site_config['add_bonus'] < $now){

   $qry = "SELECT DISTINCT userid as peer, (
   SELECT DISTINCT COUNT( torrent )
   FROM peers
   WHERE seeder = 'yes'  AND userid = peer) AS count
   FROM peers WHERE seeder = 'yes'";

   $res1 = SQL_Query_exec($qry);
   while ( $row = mysqli_fetch_object($res) )
   {
       SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
       SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='bonus'");
       // write_log("bonus and task inserted every hour");
   }
   }
   // End


use the writelog function to log cleanups to makes sure its correct
// write_log("bonus and task inserted every hour");


Thanks!! I will try this
"shadows, post: 68643, member: 20311":

This is SQL injectable.
$torrentid = $_GET['id'];
$stmt = $conn->prepare("SELECT id, announce, info_hash FROM torrents WHERE external = 'yes' AND id = $torrentid LIMIT 1");

[ICODE]yoursite.com/trader-scrape.php?id='1;UPDATE users SET email = "shadows@mail.com" WHERE id = 1'[/ICODE]


I dont don't hope this doesn't go unnoticed to those using it. Will update post. Aside, fix it up & enjoy the mod ;)
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728