<?
////////////////////////////////////////////////////////
// Bonus Mod by TvRecall.org
// Bonus Mod Updated by nav
// Version 0.31
// Updated 04/05/2006
// under GPL-License
///////////////////////////////////////////////////////
require_once('include/bittorrent.php');
dbconn(false);
loggedinorreturn();
stdhead($CURUSER['username'] . "'s Bonus");
$bonus = number_format($CURUSER['seedbonus'], 1);
//begin_frame("Seeder Bonus Exchange");
?>
<table align="center" width="600" border="1" cellspacing="0" cellpadding="5">
<tr><td class="tabletitle" width="600">Seeder Bonus</td></tr></table>
<table class="tableb" align="center" width="600" border="1" cellspacing="0" cellpadding="5">
<tr><td align="center">Here you can exchange your Seeder-Bonus (current <?=$bonus?>).
<br>
(If the buttons deactivated, you have not enough to trade.)
<br>
<table border="1" cellspacing="0" cellpadding="5" width="500">
<tr>
<td class="tabletitle" align="left">Option</td>
<td class="tabletitle" align="left">Whats this about?</td>
<td class='tabletitle" align="left">Points</td>
<td class="tabletitle" align="left">Trade</td>
</tr>
<?
$res = mysql_query("SELECT * from bonus order by id");
while ($gets = mysql_fetch_assoc($res))
{
print('<tr class=tableb><td>'.$gets["id"].'</td><td align="left"><b>'.$gets["bonusname"].'</b><br>'.$gets["description"].'</td><td align="right">'.$gets["points"]."</td>");
print("<form action=\"mybonus.php?action=exchange\" method=\"post\">\n");
print('<input type="hidden" name="id" value="'.$gets["id"]."\">\n");
print('<td><input type="submit" name="submit" value="Exchange!"' . ($bonus >= $gets["points"] ? '' : ' disabled="disabled"') . "></td></form>");
}
?>
</table><br><br><br>
<blockquote><p align=left><b>For what I get points?</b><br>
You receive for every hour the system is registering you as a seeder 0.5 points.
</p></blockquote>
</td></tr>
<tr><td><a href=my.php>back to your profile</a></td></tr>
</table>
<?
if ($action == "exchange")
{
$userid = $_POST["userid"];
$option = (int)$_POST["id"];
$res = mysql_query("SELECT b.points,b.art,b.menge FROM bonus b WHERE id=".$option);
list($points,$art,$menge) = mysql_fetch_assoc($res)
$modcomment = $CURUSER['modcomment'];
$bpoints = $CURUSER['seedbonus'];
if($bpoints >= $points)
{
if($art == "traffic")
{
$modcomment = gmdate("Y-m-d") . " - User has trade " .$points. " Points for traffic.\n " .$modcomment;
mysql_query('UPDATE users SET uploaded = uploaded + '.$menge.', seedbonus = seedbonus - '.$points.' WHERE id = '.$CURUSER['id']) or sqlerr(__FILE__, __LINE__);
}
elseif($art == "invite")
{
$modcomment = gmdate("Y-m-d") . " - User has trade " .$points. " Points for invites.\n " .$modcomment;
mysql_query('UPDATE users SET invites = invites+ '.$menge.', seedbonus = seedbonus - '.$points.' WHERE id = '.$CURUSER['id']) or sqlerr(__FILE__, __LINE__);
}
else
{
echo "No valid type";
}
}
else
{
echo "not enough points to trade...";
}
}
//end_frame();
stdfoot();
?>