Location: PHPKode > projects > H-tracker > mybonus.php
<?
//
//  H-Tracker v0.2
//    http://h-tracker.org
//    Based on TorrentTrader (http://www.torrenttrader.org)
//
//
////////////////////////////////////////////////////////
// Bonus Mod by TvRecall.org
// Bonus Mod Updated by devin
// Version 0.3
// under GPL-License
///////////////////////////////////////////////////////

require_once('backend/functions.php');
dbconn(false);
loggedinonly();

if ($action == "exchange") {

$userid = $CURUSER["id"];
$option = (int)$_POST["option"];

$art = $_POST["art"];
$modcomment = $CURUSER['modcomment'];
$upload = $CURUSER['uploaded'];

$res = mysql_query("SELECT * FROM bonus WHERE id='$option'");
$row = mysql_fetch_assoc($res);
if (!$row)
show_error_msg("Error", "Invalid request.", 1);


$up = $row['menge'];
$invites = $CURUSER['invites'];
$inv = $row['menge'];
$points = $row['points'];

if($CURUSER['seedbonus'] >= $points) {

if($art == "traffic") {
$modcomment = gmdate("Y-m-d") . " - User has traded " .$points. " Points for traffic.\n " .$modcomment;
mysql_query("UPDATE users SET uploaded = uploaded+$up, seedbonus = seedbonus-$points, modcomment = '$modcomment' WHERE id = '$userid'") or die(mysql_error());
show_success_msg("Success", "Account updated.");
} elseif($art == "invite") {
$modcomment = gmdate("Y-m-d") . " - User has traded " .$points. " Points for invites.\n " .$modcomment;
mysql_query("UPDATE users SET modcomment = '$modcomment', invites = invites+$inv, seedbonus = seedbonus-$points WHERE id = '$userid'") or die(mysql_error());
show_success_msg("Success", "Account updated.");
}
else {
show_error_msg("Error", "No valid type");
}

} else {
show_error_msg("Error", "Not enough points to trade...");
}
}

stdhead($CURUSER['username'] . "'s Bonus");

$bonus = $CURUSER['seedbonus'];
$userid = $CURUSER['id'];

begin_frame("Seeder Bonus Exchange");
print("<table align=center width=100% border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
Print("<tr><td class=ttable_headinner width=100% align=center>Seeder Bonus</td></tr></table>");
print("<table class=ttable_head  align=center width=100% border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
?>
<tr><td align=center>Here you can exchange your Seeder-Bonus (currently: <?echo "$bonus";?>).
<br>
(If the button's deactivated, you do not have enough to trade.)
<br>
<?php

print("<table border=1 cellspacing=0 cellpadding=5 width=100%><tr>".
"<td class=ttable_col1 align=left>Option</td>".
"<td class=ttable_col1 align=left>What's this about?</td>".
"<td class=ttable_col1 align=left>Points</td>".
"<td class=ttable_col1 align=left>Trade</td>".

"</tr>");

$res = mysql_query("SELECT * from bonus order by id");

while ($gets = mysql_fetch_assoc($res))
{
print("<tr class=ttable_col2><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=\"option\" value=\"".$gets["id"]."\">\n");
print("<input type=\"hidden\" name=\"art\" value=\"".$gets["art"]."\">\n");
if($bonus >= $gets["points"]) {
print("<td><input type=submit name=submit class= lbutton value=\"Exchange!\"></td></form>");
} else {
print("<td><input type=submit name=submit class lbutton value=\"Exchange!\" disabled></td></form>");
}
}
print("</table><br><br><br>");
?>
<blockquote><p align=left><b>How do I get points?</b><br>
You receive <?=$site_config['points_per_hour']?> points for every hour the system registers you as being a seeder.
</p></blockquote>
</td></tr>
<tr><td><a href=account.php>Back to your profile</a></td></tr>

</table>
<?php
end_frame();
stdfoot();
?>
Return current item: H-tracker