View Single Post
  #1  
Old 30th November 2018, 13:45
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 172
Default Bonus points for uploader
Here we go special thanks @dokty

SQL add

PHP Code:
DROP TABLE IF EXISTS `coins`;
CREATE TABLE `coins` (
  `
idint(10unsigned NOT NULL auto_increment,
  `
useridint(10unsigned NOT NULL default '0',
  `
torrentidint(10unsigned NOT NULL default '0',
  `
pointsint(10unsigned NOT NULL default '0',
  
PRIMARY KEY  (`id`)
TYPE=MyISAM

and this


PHP Code:
ALTER TABLE `torrentsADD `pointsint(10NOT NULL default '0' 
in detalis.php add


PHP Code:
torrents.points 
and this somewhere

PHP Code:
    $blasd sql_query("SELECT points FROM coins WHERE torrentid=".sqlesc($id)." AND userid=" .sqlesc($CURUSER["id"])) or sqlerr(__FILE____LINE__);
    
$sdsa mysql_fetch_assoc($blasd) or $sdsa["points"] = 0;
    
tr("Points""<b>In total " intval($row["points"]) . " Points given to this torrent of which " intval($sdsa["points"]) . " from you.<br /><br />By clicking on the coins you can give points to the uploader of this torrent.</b><br /><br />
    <a href='
$BASEURL/coin.php?id=$id&amp;points=10'>
    <img src='pic/10coin.jpg' alt='10 Points' title='10 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=20'>
    <img src='pic/20coin.jpg' alt='20 Points' title='20 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=50'>
    <img src='pic/50coin.jpg' alt='50 Points' title='50 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=100'>
    <img src='pic/100coin.jpg' alt='100 Points' title='100 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=200'>
    <img src='pic/200coin.gif' alt='200 Points' title='200 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=500'>
    <img src='pic/500coin.gif' alt='500 Points' title='500 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='
$BASEURL/coin.php?id=$id&amp;points=1000'>
    <img src='pic/1000coin.gif' alt='1000 Points' title='1000 Points' border='0' /></a>"
1); 
now make a file called coin.php

PHP Code:
<?php
require_once("include/bittorrent.php");
gzip();
$action $_GET["action"];
dbconn(false);
loggedinorreturn();
maxsysop ();
parked();

// / Mod by dokty - tbdev.net

$id     intval($_GET["id"]);
$points intval($_GET["points"]);
if (!
is_valid_id($id) || !is_valid_id($points))
    die();

$pointscangive = array(
    
"10",
    
"20",
    
"50",
    
"100",
    
"200",
    
"500",
    
"1000"
);
if (!
in_array($points$pointscangive))
    
stderr("Error""You can't give that amount of points!!!");

$sdsa sql_query("SELECT 1 FROM coins WHERE torrentid=" sqlesc($id) . " AND userid =" sqlesc($CURUSER["id"])) or sqlerr(__FILE____LINE__);
$asdd mysql_fetch_array($sdsa);
if (
$asdd)
    
stderr("Error""You already gave points to this torrent.");

$res sql_query("SELECT owner,name FROM torrents WHERE id = " sqlesc($id)) or sqlerr(__FILE____LINE__);
$row mysql_fetch_assoc($res) or stderr("Error""Torrent was not found");
$userid intval($row["owner"]);

if (
$userid == $CURUSER["id"])
    
stderr("Error""You can't give your self points!");

if (
$CURUSER["seedbonus"] < $points)
    
stderr("Error""You dont have enough points");

sql_query("INSERT INTO coins (userid, torrentid, points) VALUES (" sqlesc($CURUSER["id"]) . ", " sqlesc($id) . ", " sqlesc($points) . ")") or sqlerr(__FILE____LINE__);
sql_query("UPDATE users SET seedbonus=seedbonus+" sqlesc($points) . " WHERE id=" sqlesc($userid)) or sqlerr(__FILE____LINE__);
sql_query("UPDATE users SET seedbonus=seedbonus-" sqlesc($points) . " WHERE id=" sqlesc($CURUSER["id"])) or sqlerr(__FILE____LINE__);
sql_query("UPDATE torrents SET points=points+" sqlesc($points) . " WHERE id=" sqlesc($id)) or sqlerr(__FILE____LINE__);
$msg sqlesc("You have been given " $points " points by " $CURUSER["username"] . " for torrent [url=$BASEURL/details.php?id=" $id "]" htmlspecialchars($row["name"]) . "[/url].");
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject) VALUES(0, " sqlesc($userid) . ", $msg, " sqlesc(time()) . ", 'You have been given a gift')") or sqlerr(__FILE____LINE__);
stderr("Done""Successfully gave points to this torrent.");

?>
Attached Files
File Type: rar pic.rar (19.3 KB, 7 views)
Reply With Quote