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

"m-jay, post: 68638, member: 20288":

Updating the theme has thrown a few little things out but this is been looked at. There is no style just bootstrap so these little things will be inline css
its just a case of fixing these as we notice them

here is a example - the seedbonus template with no css ( this mod is finished just doing hitnrun )
  <center>
 This page displays the options that you can redeem accumulated points against depending on the share of torrents. <font color=yellow><b><?php echo $data['usersbonus']; ?></font></b>
 </center>
 <br />
 <div class='table-responsive'> <table class='table table-striped'><thead><tr>
     <th>Option</th>
     <th>What is it?</th>
     <th>Points</th>
     <th>Exchange</th>
 </tr></thead>
 <?php foreach ($data['bonus'] as $row): ?>
 <form method="post" action="<?php echo TTURL; ?>/bonus">
 <input type="hidden" name="id" value="<?php echo $row['id']; ?>" />
 <tbody><tr>
     <td><?php echo htmlspecialchars($row['title']); ?></td>
     <td><?php echo htmlspecialchars($row['descr']); ?></td>
     <td><?php echo $row['cost']; ?></td>
     <td><input type="submit" value="Exchange"></td>
 </tr></tbody>
 </form>
 <?php endforeach; ?>
 </table>
 <ul>
    <li>You recieve <font color=red><?php echo $data['configbonuspertime']; ?></font> points per <?php echo $data['configautoclean_interval']; ?> minutes the system registers you as a seeder by torrent.</li>
 </ul>
 <ul>
    <li><a href=<?php echo TTURL; ?>/usercp>Return to profile</a></li>
 </ul>
 </div>



Nice, looking good! I'll definitely stay with objects as all my ajax lines up nicely. Silly question.. does mod posted - POST form successfully? Didn't even work for me I just did the conversion.
You need a max-height for the height of the text area by the looks of it, append style=“max-height:220px” and see what happens
"spiritblue, post: 68631, member: 401":

thank you very much, i will add it to my next theme (stargate)  ?

Very welcome ! I love this mod
Way too much caffeine lol sorry!! Lmao
"m-jay, post: 68627, member: 20288":

yes this is a prepared statement all values are escaped as there are used with place holders ? or you can use :var

the way you use pdo is through a connection
connect->prepare->bind->execute    this is perfectly fine and is the common way

its used this way because people wrap pdo with a class like the old TT mysql where you have a count function (rowCount) a query function (prepare) a insert function all sorts of functions to do what pdo does any way.
this can be a pain because its harder to write i think its easier just to chain everything and keep it simple this was a life saver when updating

Now knowing the above we write one simple function that is the same for everything so we have a pdo wrapper but it just says the way id like to format my queries passing them as arguments
    public function run($sql, $args = NULL)
   {
       if (!$args)
       {
           return $this->pdo->query($sql);
       }
       $stmt = $this->pdo->prepare($sql);
       $stmt->execute($args);
       return $stmt;
   }


i do not use prepare, excecute anywhere in my code except this function
from this excellent guide https://phpdelusions.net/pdo/pdo_wrapper

ill remove this in few days cause codes off topic but heres the seedbonus with this class ichavent used prepared statements yet

$userid   = $CURUSER['id'];
$tid      = $_POST["torrentid"];
$uid      = $CURUSER["class"] == "1" ? (int) $_POST["userid"] : (int) $CURUSER["id"];
$retrieve = DB::run("SELECT * FROM bonus");
$usertable = DB::run("SELECT * FROM users");
if (is_valid_id($_POST['id'])) {
   if (!$row || $CURUSER['seedbonus'] < $row->cost) {
       autolink("bonus.php", "Demand not valid.");
   }
   $updateuser = DB::run("UPDATE users SET seedbonus = seedbonus - '$row->cost' WHERE id = $userid");
   $row = $retrieve->fetch(PDO::FETCH_OBJ);
   switch ($row->type) {
       case 'invite':
           DB::run("UPDATE users SET invites = invites + '$row->value' WHERE id = $userid");
           break;
       case 'traffic':
           DB::run("UPDATE users SET uploaded = uploaded + '$row->value'  WHERE id = $userid");
           break;
       case 'HnR':
           if (empty($tid))
               autolink("bonus.php", "You must fill the box with the id of the torrent.");
           if (isset($uid) && isset($tid)) {
               $res = DB::run("SELECT * FROM snatched WHERE tid = $userid AND uid = $uid AND hnr = 'yes'");
               if ($res->rowCount() < 0)
                   autolink("mybonus.php", "No HnR found with this information.");
               $res1 = DB::run("SELECT username, class FROM users WHERE id = $uid");
               $row1 = $res1->fetch(PDO::FETCH_OBJ);
               $res2 = DB::run("SELECT name FROM torrents WHERE id = $tid");
               $row2           = $res2->fetch(PDO::FETCH_OBJ);
               $username       = htmlspecialchars($row1->username);
               $torname        = htmlspecialchars($row2->name);
               $new_modcomment = gmdate("M d Y H:i:s") . " - ";
               if ($uid == $CURUSER["id"])
                   $new_modcomment .= "H&R on the torrent " . htmlspecialchars($row2->name) . " cleared against " . $row->cost . " points \n";
               else
                   $new_modcomment .= "H&R on the torrent " . $row2->name . " cleared by " . $row1->username . " \n";
               $modcom = sqlesc($new_modcomment);
               DB::run("UPDATE users SET modcomment = CONCAT($modcom,modcomment) WHERE id = :uid");
               DB::run("UPDATE snatched SET ltime = '129600', hnr = 'no' WHERE tid = $userid AND uid = $uid");
           }
break;
       case 'other':
           break;
       case 'VIP':
           $days     = $row->value;
           $class    = $row1->class;
           $vipuntil = ($CURUSER["vipuntil"] > "0000-00-00 00:00:00") ? $vipuntil = get_date_time(strtotime($CURUSER["vipuntil"]) + ($days * 86400)) : $vipuntil = get_date_time(gmtime() + ($days * 86400));
           $oldclass = ($CURUSER["vipuntil"] > "0000-00-00 00:00:00") ? $oldclass = $CURUSER["oldclass"] : $oldclass = $CURUSER["class"];
           $stmt->prepare("UPDATE users SET class = $class, oldclass = $oldclass, vipuntil = $vipuntil WHERE id = $userid");
           break;
}
}
while ($row = $retrieve->fetch(PDO::FETCH_OBJ)) {
   echo '<class="card">';
   echo '<form method="post" action="/bonus.php">';
   echo '<input type="hidden" name="id" value="' . $row->id . '" />';
   echo '<div class="card-action ng-scope" style="font-size:22px">';
   echo "<span style=\"font-size:27px;font-weight:400;padding: 7px 5px 5px 10px;border-radius:7px;background:#C0C0C0;text-align:center;color:#FFF;box-shadow: inset 1px 5px 7px -6px #000000;margin-right:15px\">" . str_replace('Uploaded', '', $row->title) . "</span>";
   echo $row->descr;
   $disabled = '';
   $inputmsg = 'Exchange';
   if ($CURUSER['seedbonus'] < $row->cost) {
       $inputmsg = 'Not Enough';
       $disabled = 'disabled';
   }
   echo '<span>';
   echo "<button class=\"btn btn-danger\" onclick=\"this.form.submit();\" style=\"font-size:15px\" $disabled>$inputmsg</button></span>";
   echo '</div></form></article>';
}
?>
<div>
You receive
<?php echo $site_config['bonuspertime']; ?>
points per
<?php echo floor($site_config['autoclean_interval'] / 10); ?>
minutes the system registers you as a seeder by torrent.
</div>



Excellent explanation and much appreciated. I only learned preparing statements with bindvalue() and execute, that’s probably whyImwas a bit lost, the code I have is all along the same so seeing tenary operators in the statement was a bit confusing when first working with the svn head.

I hope the code does well, but know that something In query is preventing successful update to user table, not sure why. The absence of SQL_Query_exec() is lacking TT SQL error logging functionality, so it’s a blind miss at the moment.. can I pass error to write_log() ??
Grab stats dynamically. Automatically updates users ratio, upload, download, slots and invites. Updates live. No need to refresh. Very good system. 1 week in use, only 1 update to byte calculation.

Here we go..

create as ajax_stats.php


<?
// Grab user Ratio, Download, Upload & Slot details dynamically
// Auto updates as they download and browse
require_once 'backend/functions.php';

$userid         = isset($_GET['id'])?intval($_GET['id']):0;

try {
   $conn = new PDO("mysql:host={$dbHost};dbname={$dbName}", $dbUsername, $dbPassword);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}

if ($CURUSER["uploaded"] > 0 && $CURUSER["downloaded"] == 0)
   $userratio = "Inf.";
elseif ($CURUSER["downloaded"] > 0)
   $userratio = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
else
   $userratio = "---";

$stmt = $conn->prepare("SELECT users.downloaded, users.uploaded, users.invites, users.id, COUNT(DISTINCT peers.torrent) AS slots FROM peers LEFT JOIN users ON peers.userid = users.id WHERE peers.userid = $userid");
$stmt->execute();
$array = array();
if ($stmt->rowCount() > 0) {
   $userlivestats = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($userlivestats as $link => $row) {

       $row['downloaded']     = $link['downloaded'];     // Downloaded
       $row['uploaded']     = $link['uploaded'];    // Uploaded
       $row['invites']     = $link['invites'];        // Invites
       $row['slots']         = $link['slots'];       // Download Slots
       $row['class']         = $link['class'];       // User class
       array_push($array, $link);
   }
}
echo json_encode($userlivestats);

?>


Now open header.php and add


<? if ($CURUSER) { ?>
<script>
function formatBytes(bytes, decimals = 2) {
   if (bytes === null) return '0.00 Bytes'; // null in place of 0 - new user byte stats fix

   const k = 1024;
   const dm = decimals < 0 ? 0 : decimals;
   const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

   const i = Math.floor(Math.log(bytes) / Math.log(k));

   return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}

function fetchUserUsage() {
   $(document).ready(function () {
       $.ajax({
           url: 'ajax_stats.php?id=<?=$CURUSER["id"]; ?>',
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               var ratio = '<? echo number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2); ?>';
               var slots = '<? $maxslot = avail_slots($CURUSER["id"], $CURUSER["class"]); echo number_format($maxslot) . "/0"; ?>';
               $.each(data, function (i, item) {
                   html_to_append +=
                       '<div style="padding-left:15px;padding-top:20px"><span style="font-size:25px"><i class="material-icons" style="color:#E72225;font-size:35px;vertical-align:bottom;padding-right:10px">cloud_download</i>' +
                       formatBytes(item.downloaded) +
                       '</span><span style="font-size:25px;padding-left:30px"><i class="material-icons" style="color:rgba(46,168,4,1);font-size:35px;vertical-align:bottom;padding-right:10px">cloud_upload</i>' +
                       formatBytes(item.uploaded) +
                       '</span><span style="font-size:25px"><span style="font-size:25px;padding-left:50px"><i class="material-icons" style="color:#C0C0C0;font-size:35px;vertical-align:bottom;padding-right:10px">timelapse</i>' +
                       ratio +
                       '</span><span style="display:none;font-size:25px;padding-left:50px"><i class="material-icons" style="color:#F4964E;font-size:35px;vertical-align:bottom;padding-right:10px">reply</i> <a href="/invite.php" style="color:#000;text-decoration:underline">' +
                       item.invites +
                       '</a></span><span style="font-size:25px;padding-left:50px"><i class="material-icons" style="color:#0079FE;font-size:35px;vertical-align:bottom;padding-right:10px">widgets</i>' +
                       slots +
                       '</span></div>';
               });
               $("#userusage").html(html_to_append);
           }
       });
   });
}
fetchUserUsage();
setInterval(function () {
   fetchUserUsage()
}, 5000);
</script>
<? } ?>


Now add to very end of header.php


<?
if (stripos($_SERVER['PHP_SELF'],'index.php') && $CURUSER) {

   // AJAX User usage - May 21, 2020
   print("My Ratio to Members will go here..");
   print("<div id=\"userusage\"></div>");
}
?>


Change the page in code above (index.php), to the page you want only to show this on. Otherwise, use this code to show on ALL pages:


<?
if ($CURUSER) {

   // AJAX User usage - May 21, 2020
   print("My Ratio to Members will go here..");
   print("<div id=\"userusage\"></div>");
}
?>


On my end (updates by staring at it)

[ATTACH type="full" alt="UsageMod.png"]5547[/ATTACH]

As you can see, I've ended up dropping the download and upload objects in JSON in place of real data, which contradicts the script a bit but until I can calc it.. this is as good as it gets! Average speed will be added later on as a test feature to our private community.
I have to ask, because I have wondered 3 times today.. is this a prepared statement? how do you know if query or execute or prepare necessary? do you use transactional selection (SELECT, INSERT, UPDATE) detection to trigger transaction case? Are values binded in a class away from core? I don't think you have to declare INT on prepared queries with binded values. Binding all of that together calls for a DB class. Have you tried organizing that statement away from (potential) DB class, and copy over?

I've rewritten torrent-upload a week ago, and works but needs more work, its a different animal. But I was on this query just earlier..
Copy and paste that text in bold. Now find what you copied in /lang/english.php (CTRL-F + CTRL-V + Enter), assuming regex off.

Copy that language string (example, HOME_USER_DYN, etc) and repeat same steps for torrents-upload. You are tracing this error messaging to the root potential cause.

Can you copy the block containing that language var and post for us to review? I don't use this release so can't help.
"Propaganda, post: 68618, member: 60":

Our current Bonus Exchange page looks like this >>

[ATTACH=full]5546[/ATTACH]


This is great! I started looking around on Google (and logged into IPTorrents to see my own account), that is more organized and modular
pointer-events disable only UI events, like click, hover, cursor sets, tool tips, etc, there are 2 statements that actually do this, yours is more cross-compatible and IE-reverted. When your working with a form input, unless specified otherwise - the browse engine will automatically fall back to system cursor. pointer-events is only really useful for links and situations when your working with JS framework and CSS mix, and overriding the plugins style decision without resorting to the less preffered !important declarations.

Remember, hidden input is never needed for any call except name & value. CSS will have no effect on inputs rendered or declared hidden. They are really intended for passing over INT or STR values over POST to pass over ID/value to the script interpreter to continue parsing. Otherwise, your relying on session data and thats a bit out of the scope here.

Declared -  visibility:hidden, display: none
Rendered - type="hidden"

HTML spec states that <button> and <input> buttons can be declared disabled by appending disabled before close. This hasn't changed across HTML 4 or 5. So a PHP condition is logical.

Also.. anyone can go into the browser and disable CSS (a click away for me on Safari), and reveal that button and start attacking the POST with requests, something I'm technically prone to using mysql_query(), but my traffic is heavily monitored and I pay for this. Use PHP conditions and while CSS will work, the PHP solution posted is server-side and is a bit more direct without potential for scripting shenanigans, and reliable as its reading $CURUSER. Just a note.
"m-jay, post: 68615, member: 20288":

nice  (y) seedbonus has been on my todo list so ill follow post :D

on v3 i had it linked to everything lol comments, upload, posts, hitnrun, vip - all through config ill start digging all little bits out

trying to pick out all the whiles and replace with foreach to update code heres one in cleanup for seedbonus
// Seedbonus
$res = DB::run("SELECT DISTINCT userid as peer, (
SELECT DISTINCT COUNT( torrent )
FROM peers
WHERE seeder = 'yes'  AND userid = peer) AS count
FROM peers WHERE seeder = 'yes'")->fetch();

foreach ( $res as $row )
{
DB::run("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
}



Good work! The mod is complete and can be seen live /bonus.php but I’m afraid a few objects in queries or at least the first UPDATE statement is failing to update user table. I gotta var_dump my way through, but there u have it lol
We all do it on our spare time, every day is a lot of learning. Best way when time allows  :LOL:
Enchanced Requests — 2020-05-20 23:14:39 in v3 Mods Completed
If it helps - test runner. Name anything you like. Use root /

<?php
require_once('backend/functions.php');
dbconn();
error_reporting(E_ALL); // E_ALL => 0 : off
stdhead("Runner");

// Code all in here

stdfoot();
?>
Converting old mod seedbonus, early test stuff. Template code included to speed up post updates.



<?
try {
   $stmt = new PDO("mysql:host={$dbHost};dbname={$dbName}", $dbUsername, $dbPassword);
   $stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$userid   = $CURUSER['id'];
$tid      = $_POST["torrentid"];
$uid      = $CURUSER["class"] == "1" ? (int) $_POST["userid"] : (int) $CURUSER["id"];
$retrieve = $stmt->prepare("SELECT * FROM bonus");
$retrieve->execute();
$usertable = $stmt->prepare("SELECT * FROM users");
$usertable->execute();
if (is_valid_id($_POST['id'])) {
   if (!$row || $CURUSER['seedbonus'] < $row->cost) {
       autolink("bonus.php", "Demand not valid.");
   }
   $updateuser = $stmt->query("UPDATE users SET seedbonus = seedbonus - '$row->cost' WHERE id = :id");
   $updateuser->bindValue(':id', $userid, PDO::PARAM_INT);
   $updateuser->execute();
   $row = $retrieve->fetch(PDO::FETCH_OBJ);
   switch ($row->type) {
       case 'invite':
           $stmt->query("UPDATE users SET invites = invites + '$row->value' WHERE id = :id");
           $stmt->bindValue(':id', $userid, PDO::PARAM_INT);
           $stmt->execute();
           break;
       case 'traffic':
           $stmt->query("UPDATE users SET uploaded = uploaded + '$row->value'  WHERE id = :id");
           $stmt->bindValue(':id', $userid, PDO::PARAM_INT);
           $stmt->execute();
           break;
       case 'HnR':
           if (empty($tid))
               autolink("bonus.php", "You must fill the box with the id of the torrent.");
           if (isset($uid) && isset($tid)) {
               $res = $stmt->prepare("SELECT * FROM snatched WHERE tid = :tid AND uid = :uid AND hnr = 'yes'");
               $res->bindValue(':tid', $userid, PDO::PARAM_INT);
               $res->bindValue(':uid', $uid, PDO::PARAM_INT);
               $res->execute();
               if ($res->rowCount() < 0)
                   autolink("mybonus.php", "No HnR found with this information.");
               $res1 = $stmt->prepare("SELECT username, class FROM users WHERE id = :uid");
               $res1->bindValue(':uid', $uid, PDO::PARAM_INT);
               $res1->execute();
               $row1 = $res1->fetch(PDO::FETCH_OBJ);
               $res2 = $stmt->prepare("SELECT name FROM torrents WHERE id = :tid");
               $res2->bindValue(':tid', $tid, PDO::PARAM_INT);
               $res2->execute();
               $row2           = $res2->fetch(PDO::FETCH_OBJ);
               $username       = htmlspecialchars($row1->username);
               $torname        = htmlspecialchars($row2->name);
               $new_modcomment = gmdate("M d Y H:i:s") . " - ";
               if ($uid == $CURUSER["id"])
                   $new_modcomment .= "H&R on the torrent " . htmlspecialchars($row2->name) . " cleared against " . $row->cost . " points \n";
               else
                   $new_modcomment .= "H&R on the torrent " . $row2->name . " cleared by " . $row1->username . " \n";
               $modcom = sqlesc($new_modcomment);
               $stmt->prepare("UPDATE users SET modcomment = CONCAT($modcom,modcomment) WHERE id = :uid");
               $stmt->prepare("UPDATE snatched SET ltime = '129600', hnr = 'no' WHERE tid = :tid AND uid = :uid");
               $stmt->bindValue(':tid', $userid, PDO::PARAM_INT);
               $stmt->bindValue(':uid', $uid, PDO::PARAM_INT);
               $stmt->execute();
           }
break;
       case 'other':
           break;
       case 'VIP':
           $days     = $row->value;
           $class    = $row1->class;
           $vipuntil = ($CURUSER["vipuntil"] > "0000-00-00 00:00:00") ? $vipuntil = get_date_time(strtotime($CURUSER["vipuntil"]) + ($days * 86400)) : $vipuntil = get_date_time(gmtime() + ($days * 86400));
           $oldclass = ($CURUSER["vipuntil"] > "0000-00-00 00:00:00") ? $oldclass = $CURUSER["oldclass"] : $oldclass = $CURUSER["class"];
           $stmt->prepare("UPDATE users SET class = :class, oldclass = :oldclass, vipuntil = :vipuntil WHERE id = :id");
           $stmt->bindValue(':class', $class, PDO::PARAM_INT);
           $stmt->bindValue(':oldclass', $oldclass, PDO::PARAM_STR);
           $stmt->bindValue(':vipuntil', $vipuntil, PDO::PARAM_STR);
           $stmt->bindValue(':id', $userid, PDO::PARAM_INT);
           $stmt->execute();
           break;
}
}
while ($row = $retrieve->fetch(PDO::FETCH_OBJ)) {
   echo '<article itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Article" class="card">';
   echo '<form method="post" class="cd-form floating-labels" action="/bonus.php">';
   echo '<input type="hidden" name="id" value="' . $row->id . '" />';
   echo '<div class="card-action ng-scope" style="font-size:22px">';
   echo "<span style=\"font-size:27px;font-weight:400;padding: 7px 5px 5px 10px;border-radius:7px;background:#C0C0C0;text-align:center;color:#FFF;box-shadow: inset 1px 5px 7px -6px #000000;margin-right:15px\">" . str_replace('Uploaded', '', $row->title) . "</span>";
   echo $row->descr;
   $disabled = '';
   $inputmsg = 'Exchange';
   if ($CURUSER['seedbonus'] < $row->cost) {
       $inputmsg = 'Not Enough';
       $disabled = 'disabled';
   }
   echo '<span style="float:right;margin-right:-125px">';
   echo "<button class=\"btn btn-danger\" onclick=\"this.form.submit();\" style=\"font-size:15px\" $disabled>$inputmsg</button></span>";
   echo '</div></form></article>';
}
?>

<div>You receive <?
echo $site_config['bonuspertime'];
?> points per <?
echo floor($site_config['autoclean_interval'] / 10);
?> minutes the system registers you as a seeder by torrent.</div>

<?
stdfoot();
?>

[ATTACH type="full"]5545[/ATTACH]
Seed Bonus [TTv3] — 2020-05-20 18:45:08 in v3 Mods Completed
"spiritblue, post: 66899, member: 401":

small complement ...

5 seedbonus points for commenting on a torrent.
[color=rgb(41, 105, 176)](it's up to you to change the number 5 to Luis himself) [/color]

Search in [color=rgb(251, 160, 38)]torrents-details.php[/color] :
SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");


Add after :

// Points Seedbonus By spiritblue
$commentaire = get_row_count("comments", "WHERE torrent = $id AND user = $CURUSER[id]");    
if ($commentaire < 1) {
   SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+5.0 WHERE id = ".$CURUSER["id"]."") ;
}
// End Points Seedbonus


Note: this line could also be used on another page, change the variable (y)


Works great! Thanks so much.

I think a second column needs to be in place, to allow checking and replacing points bonus for comment deleted. A user can go on a comment frenzy, and post 100 across the site, maybe even spam links. In turn, they boost their seed bonus and leech off the tracker. Just logic error. A lot of services ignore that, but if anyone wants a tighter situation.. this is a serious flaw. I'll see what I can do
slot peer class — 2020-05-20 17:43:12 in v3 Mods in Progress
Thank you everyone! Thread marked to be moved.
Seed Bonus [TTv3] — 2020-05-20 17:37:29 in v3 Mods Completed
Also reports in database error, disabling signup and uploading if not caught

Field 'seedbonus' doesn't have a default value

SQL Fix:


ALTER TABLE users;
ALTER seedbonus SET DEFAULT 0.0;
slot peer class — 2020-05-20 09:14:10 in v3 Mods in Progress
Is this a add-on to original mod, or a support question?
Seed Bonus [TTv3] — 2020-05-20 09:07:13 in v3 Mods Completed
Few changes, if anyone wants to pick apart. It not only disables if low on seed bonus, but also prints "not enough" in place of button text. Until I change all PHP code to PDO and retain HTML. I could use objects again or go the other way. Either way works, the original mod dev had procedural in mind.


<? while ($row = mysql_fetch_object($res)): ?>

<article itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Article" class="card">

   <form method="post" class="cd-form floating-labels" action="/seedbonus/">
       <input type="hidden" name="id" value="<? echo $row->id; ?>" />
           <div class="card-action ng-scope" style="font-size:22px">
   
               <!-- Seeder exchange -->
               <span style="font-size:27px;font-weight:400;padding: 7px 5px 5px 10px;border-radius:7px;background:#C0C0C0;text-align:center;color:#FFF;box-shadow: inset 1px 5px 7px -6px #000000;margin-right:15px">
                   <? echo str_replace('Uploaded', ' ', htmlspecialchars($row->title)); ?>
               </span>
               <? echo htmlspecialchars($row->descr); ?>
               <? echo htmlspecialchars($row->cost); ?>
               <span style="float:right;margin-right:-125px">
                   <button class="btn btn-danger" onclick="this.form.submit();" style="font-size:15px" <? echo ($CURUSER['seedbonus'] < $row->cost ? 'disabled' : null); ?>>
                       <? if ($CURUSER['seedbonus'] < $row->cost){ echo "Not Enough"; } else { echo "Exchange"; } ?>
                   </button>
               </span>
   
             </div>
   </form>

</article>

<? endwhile; ?>


[ATTACH type="full" alt="NewSeedBonusFeature.png"]5539[/ATTACH]
Seed Bonus [TTv3] — 2020-05-20 07:00:50 in v3 Mods Completed
Nice, thanks for this!, I'm going to convert it over, few issues admincp bottom has mismatched ids for both SELECT and UPDATE statements, not too sure, request[id] and $id are both stated.
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