Updated for V3 credit to Original Author
[color=rgb(251, 160, 38)]SQL:[/color]
[color=rgb(251, 160, 38)]blocks/login_blocks.php find[/color]
Add after
Search (at end of line)
Add after :
[color=rgb(251, 160, 38)]backend/Cleanup.php find[/color]
Add after :
[color=rgb(251, 160, 38)]in backend/config.php find[/color]
After add
[color=rgb(251, 160, 38)]in account.php find[/color]
Add below
[color=rgb(251, 160, 38)]in admincp.php find[/color]
Add below
Search
Add after
in images/admin folder add seedbonus.png
upload to root bonus.php
[color=rgb(251, 160, 38)]SQL:[/color]
CREATE TABLE IF NOT EXISTS `bonus` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`cost` decimal(10,1) unsigned NOT NULL DEFAULT '0.0',
`value` bigint(20) unsigned NOT NULL DEFAULT '0',
`descr` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`type` enum('traffic','invite','VIP','other','HnR') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'other',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7;
INSERT INTO `bonus` (`id`, `title`, `cost`, `value`, `descr`, `type`) VALUES
(1, '1GB Uploaded', '70.0', 1073741824, 'Exchange 70 points for 1 GB upload.', 'traffic'),
(2, '2 GB Uploaded', '100.0', 2147483648, 'Exchange 100 points for GB upload.', 'traffic'),
(3, '5 GB Uploaded', '250.0', 5368709120, 'Exchange 250 points for 5 GB upload.', 'traffic'),
(4, '10 GB Uploaded', '500.0', 10737418240, 'Exchange 500 points for 10 GB upload.', 'traffic'),
(5, 'Invitations', '1000.0', 2, 'Receive 2 Invites for 1000.00 seedbonus points.', 'invite');
ALTER TABLE users ADD `seedbonus` decimal(10,1) NOT NULL;
[color=rgb(251, 160, 38)]blocks/login_blocks.php find[/color]
$privacylevel = T_($CURUSER["privacy"]);
Add after
$bonus = $CURUSER['seedbonus'];
Search (at end of line)
". T_("RATIO") .": $userratio
Add after :
<br>Seedbonus : <b><a href=mybonus.php>".$bonus."</a></b>
[color=rgb(251, 160, 38)]backend/Cleanup.php find[/color]
//LOCAL TORRENTS - MAKE NON-ACTIVE/OLD TORRENTS INVISIBLE
$deadtime = gmtime() - $site_config["max_dead_torrent_time"];
SQL_Query_exec("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders = '0' AND leechers = '0' AND external !='yes'");
Add after :
// Seedbonus
$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'";
$res = 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 . "'");
}
// End
[color=rgb(251, 160, 38)]in backend/config.php find[/color]
$site_config['blocks_dir'] = getcwd().'/blocks';
After add
$site_config["bonuspertime"] = 0.5;
[color=rgb(251, 160, 38)]in account.php find[/color]
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>
|
Add below
|
<?php print("<a href='mybonus.php'><b>My Seedbonus</b></a>");?>
[color=rgb(251, 160, 38)]in admincp.php find[/color]
<td align="center"><a href="admincp.php?action=sqlerr"><img src="images/admin/sql_error.png" border="0" width="32" height="32" alt="" /><br />SQL Error<br /></a></td>
Add below
<td colspan="5"> </td>
</tr>
<tr>
<td align="center"><a href=admincp.php?action=seedbonus><img src="images/admin/seedbonus.png" border=0 width=32 height=32><br>Management of Seed Bonus</a></td>
</tr>
Search
} // End Forum management
Add after
#======================================================================#
# Seedbonus Manager
#======================================================================#
if ($action == "seedbonus" && $do != "change")
{
if (get_user_class() < 3)
show_error_msg("STOP", "Area reserved for people entitled! and you do not have permission !!!");
if ($do == "del")
{
if (!@count($_POST["ids"])) show_error_msg("Error", "select nothing.", 1);
$ids = array_map("intval", $_POST["ids"]);
$ids = implode(", ", $ids);
SQL_Query_exec("DELETE FROM `bonus` WHERE `id` IN ($ids)");
autolink("admincp.php?action=seedbonus", "deleted entries");
}
$count = get_row_count("bonus");
list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=seedbonus&');
$res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` ORDER BY `type` $limit");
stdhead("Seedbonus Manager");
navmenu();
begin_frame("Management of Seed Bonus");
?>
<center>
This page displays all available options trade which users can exchange for seedbonus.<?php echo number_format($count); ?> ; <br><br><a href="admincp.php?action=seedbonus&do=change&id=null">Add</a> a new option?
</center>
<?php if ($count > 0): ?>
<br />
<form id="seedbonus" method="post" action="admincp.php?action=seedbonus">
<input type="hidden" name="do" value="del" />
<table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head">Title</th>
<th class="table_head">Description</th>
<th class="table_head">Points</th>
<th class="table_head">Valeur</th>
<th class="table_head">Type</th>
<th class="table_head">Edit</th>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
</tr>
<?php while ($row = mysqli_fetch_object($res)):
$row->value = ( $row->type == "traffic" ) ? mksize( $row->value ) : ( int ) $row->value;
?>
<tr>
<td class="table_col1" align="center"><?php echo htmlspecialchars($row->title); ?></td>
<td class="table_col2"><?php echo htmlspecialchars($row->descr); ?></td>
<td class="table_col1" align="center"><?php echo $row->cost; ?></td>
<td class="table_col2" align="center"><?php echo $row->value; ?></td>
<td class="table_col1" align="center"><?php echo $row->type; ?></td>
<td class="table_col2" align="center"><a href="admincp.php?action=seedbonus&do=change&id=<?php echo $row->id; ?>">Edit</a></td>
<td class="table_col1" align="center"><input type="checkbox" name="ids[]" value="<?php echo $row->id; ?>" /></td>
</tr>
<?php endwhile; ?>
<tr>
<td colspan="7" align="right">
<input type="submit" value="Remove Selected" />
</td>
</tr>
</table>
</form>
<?php
endif;
if ($count > 25) echo $pagerbottom;
end_frame();
stdfoot();
}
if ($action == "seedbonus" && $do == "change")
{
$row = null;
if ( is_valid_id($_REQUEST['id']) )
{
$res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` WHERE `id` = '$_REQUEST[id]'");
$row = mysqli_fetch_object($res);
}
if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if ( empty($_POST['title']) or empty($_POST['descr']) or empty($_POST['type']) or !is_numeric($_POST['cost']) )
{
autolink($_SERVER['HTTP_REFERER'], "missing information.");
}
$_POST["value"] = ( $_POST["type"] == "traffic" ) ? strtobytes( $_POST["value"] ) : ( int ) $_POST["value"];
$var = array_map('sqlesc', $_POST);
extract( $var );
if ( $row == null )
{
SQL_Query_exec("INSERT INTO `bonus` (`title`, `descr`, `cost`, `value`, `type`) VALUES ($title, $descr, $cost, $value, $type)");
}
else
{
SQL_Query_exec("UPDATE `bonus` SET `title` = $title, `descr` = $descr, `cost` = $cost, `value` = $value, `type` = $type WHERE `id` = $id");
}
autolink("admincp.php?action=seedbonus", "Updating the bonus seed.");
}
stdhead("Seedbonus Management");
navmenu();
begin_frame("Seedbonus Management");
?>
<form method="post" action="admincp.php?action=seedbonus&do=change">
<?php if ($row != null): ?>
<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
<?php endif; ?>
<table border="0" class="table_table" width="90%" cellpadding="3" align="center">
<tr>
<th class="table_head" colspan="2">Seedbonus Management</th>
</tr>
<tr>
<td class="table_col1"><b>Title:</b></td>
<td class="table_col2"><input type="text" name="title" value="<?php echo ( $row != null ? $row->title : null ); ?>" size="50" /></td>
</tr>
<tr>
<td class="table_col1"><b>Points:</b></td>
<td class="table_col2"><input type="text" name="cost" value="<?php echo ( $row != null ? $row->cost : null ); ?>" size="5" /></td>
</tr>
<tr>
<td class="table_col1"><b>Type:</b></td>
<td class="table_col2">
<select name="type">
<?php foreach (array('invite', 'traffic','VIP', 'other') as $type): ?>
<option value="<?php echo $type; ?>" <?php echo ( $row != null && $row->type == $type ? 'selected="selected"' : null ); ?>><?php echo $type; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td class="table_col1"><b>Value:</b></td>
<td class="table_col2"><input type="text" name="value" value="<?php echo ( $row != null ? $row->value : null ); ?>" size="10" /></td>
</tr>
<tr>
<td class="table_col1" valign="top"><b>Description:</b></td>
<td class="table_col2"><textarea name="descr" rows="5" cols="38"><?php echo ( $row != null ? $row->descr : null ); ?></textarea></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="reset" value="Cancel" />
<input type="submit" value="To send" />
</td>
</tr>
</table>
</form>
<?php
end_frame();
stdfoot();
}
in images/admin folder add seedbonus.png
upload to root bonus.php

