$site_config['autoclean_interval'] = 600; // time to cleanup (10 minutes)
$site_config['add_bonus'] = 3600; // time to add bonus (1 hour)
floor($site_config['autoclean_interval'] / 10),
floor($site_config['add_bonus'] / 60),
// 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 <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> public function run($sql, $args = NULL)
{
if (!$args)
{
return $this->pdo->query($sql);
}
$stmt = $this->pdo->prepare($sql);
$stmt->execute($args);
return $stmt;
}
$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> }else{
$anon = "no";
} $inames = '';
$filecounts = (int)$filecount;
$ret = DB::run("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[$fname, $CURUSER['id'], $name, $descr, $inames[0], $inames[1], $catid, get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, get_date_time()]);
// 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 . "'");
} ///////LATEST REQUESTS//////
if ($site_config['REQUESTSON']){
begin_frame("Latest Requests");
?>
<?php
$categ = (int)$_GET["category"];///////LATEST REQUESTS//////
if ($site_config['REQUESTSON']){
begin_frame("Latest Requests");
$categ = (int)$_GET["category"];?>
</td><td width=100% align=right valign=bottom>
<?
$query = @mysqli_fetch_row(@SQL_Query_exec("SELECT COUNT(DISTINCT torrent) FROM `peers` WHERE `userid` = '$userid' AND `seeder`='no'"));
$queries = SQL_Query_exec("SELECT `maxslots` FROM `groups` WHERE `group_id` = $user[class]");
$row = mysqli_fetch_array($queries);
@mysqli_fetch_row(@SQL_Query_exec("SELECT COUNT(DISTINCT torrent) FROM peers WHERE userid = $CURUSER[id] AND seeder='no'"));
$slots = number_format($CURUSER["maxslots"])