09 Karma Points Gift For The Uploader

Started by Mindless, July 21, 2012, 09:44:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Credits to Dokty.
Xhtml valid.
You require the 09 seedbonus mod to use this modification.
Langauge file outstanding.

Run the sql :

Code (sql) Select
ALTER TABLE `torrents` ADD `points` INT( 10 ) NOT NULL default '0';

CREATE TABLE `coins` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
`torrentid` int(10) unsigned NOT NULL default '0',
`points` int(10) unsigned NOT NULL default '0',

Save and upload to root : coins.php

Code (php) Select
require_once (
$lang array_mergeload_language('global'));
// / Mod by dokty - tbdev.net

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

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

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

$res mysql_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 $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");

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


On details.php find in the large query:

Code (php) Select

change to

Code (php) Select
torrents.filename, torrents.points,

Add the code where you want to display it - probably best under the download link :)

Code (php) Select
///== Mod by dokty - Tbdev.net
    $blasd = mysql_query("SELECT points FROM coins WHERE torrentid=".sqlesc($id)." AND userid=" .sqlesc($CURUSER["id"]));
    $sdsa = mysql_fetch_assoc($blasd) or $sdsa["points"] = 0;
    $HTMLOUT .= tr("Points", "<b>In total " . htmlspecialchars($row["points"]) . " Points given to this torrent of which " . htmlspecialchars($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='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=10'>
    <img src='{$TBDEV['pic_base_url']}10coin.jpg' alt='10 Points' title='10 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=20'>
    <img src='{$TBDEV['pic_base_url']}20coin.jpg' alt='20 Points' title='20 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=50'>
    <img src='{$TBDEV['pic_base_url']}50coin.jpg' alt='50 Points' title='50 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=100'>
    <img src='{$TBDEV['pic_base_url']}100coin.jpg' alt='100 Points' title='100 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=200'>
    <img src='{$TBDEV['pic_base_url']}200coin.gif' alt='200 Points' title='200 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=500'>
    <img src='{$TBDEV['pic_base_url']}500coin.gif' alt='500 Points' title='500 Points' border='0' /></a>
    &nbsp;&nbsp;<a href='{$TBDEV['baseurl']}/coins.php?id=$id&amp;points=1000'>
    <img src='{$TBDEV['pic_base_url']}1000coin.gif' alt='1000 Points' title='1000 Points' border='0' /></a>", 1);

delete.php find (in function deletetorrent) :

Code (php) Select
mysql_query("DELETE FROM $x WHERE torrent = $id");

Under it add :

Code (php) Select
mysql_query("DELETE FROM coins WHERE torrentid = $id");

cleanup.php find :

Code (php) Select
mysql_query("DELETE FROM torrents WHERE id=$arr[id]");

under it add

Code (php) Select
mysql_query("DELETE FROM coins WHERE torrentid=$arr[id]");

Finally upload to the pic folder the attached pics

[attachment deleted by admin]