View Single Post
  #1  
Old 29th January 2016, 10:13
Chez's Avatar
Chez Chez is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 278
Default Transfer bonus points [jQuery]
A simple mod that allows you to send bonus points to a user with just one click.

Click the image to open in full size.

So to use this mode, you must have registered library jQuery.

Open userdetails.php and add this code in any place you want to show:

PHP Code:
?>
<script language="javascript" type="text/javascript">
function present(from, to, amount) {
    jQuery.post("present.php",{"from":from,"to":to,"amount":amount},function (response) {
       alert(response);
    });
};
</script>
<tr><td class="rowhead">Give Bonuses</td><td align="left">
<img src="pic/10.png" alt="10" title="Send 10 bonus points" onclick="javascript:present('<?=$CURUSER["id"];?>', '<?=$user["id"];?>', '10');" />
<img src="pic/25.png" alt="25" title="Send 25 bonus points" onclick="javascript:present('<?=$CURUSER["id"];?>', '<?=$user["id"];?>', '25');" />
<img src="pic/50.png" alt="50" title="Send 50 bonus points" onclick="javascript:present('<?=$CURUSER["id"];?>', '<?=$user["id"];?>', '50');" />
<img src="pic/100.png" alt="100" title="Send 100 bonus points" onclick="javascript:present('<?=$CURUSER["id"];?>', '<?=$user["id"];?>', '100');" />
</td>
</tr>
<br>
<?
Create a file called present.php and add this code then put it in your root:

PHP Code:
<?
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn(); 

$from = (int) $_POST["from"];
$to = (int) $_POST["to"];
$amount = (int) $_POST["amount"];

if (empty(
$from)) {
    
stdmsg("Error, If you are not a hacker - try again.");


sql_query("UPDATE users SET seedbonus = seedbonus + '$amount' WHERE id = '$to' LIMIT 1");
sql_query("UPDATE users SET seedbonus = seedbonus - '$amount' WHERE id = '$from' LIMIT 1"); 

if(
$CURUSER["id"] == $to) {
print(
"You can not pass bonuses themselves.");
} elseif(
$CURUSER["seedbonus"] <= $amount) {
print(
"You do not have enough bonuses");
} else {
print(
"You have successfully sent $amount bonus points.");
}
?>
Download attached icons and put them in your pic folder.

Enjoy!
Attached Images
       
__________________
http://www.bvlist.com/images/avatars/signaturepics/sigpic16443_2.gif

Last edited by Chez; 29th January 2016 at 12:05.
Reply With Quote
The Following User Says Thank You to Chez For This Useful Post:
BamBam0077 (23rd August 2022)