elvira |
30th November 2018 13:45 |
Bonus points for uploader
1 Attachment(s)
Here we go special thanks @dokty
SQL add
PHP Code:
DROP TABLE IF EXISTS `coins`; 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', PRIMARY KEY (`id`) ) TYPE=MyISAM;
and this
PHP Code:
ALTER TABLE `torrents` ADD `points` int(10) NOT NULL default '0'
in detalis.php add
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.By clicking on the coins you can give points to the uploader of this torrent.</b> <a href='$BASEURL/coin.php?id=$id&points=10'> <img src='pic/10coin.jpg' alt='10 Points' title='10 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&points=20'> <img src='pic/20coin.jpg' alt='20 Points' title='20 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&points=50'> <img src='pic/50coin.jpg' alt='50 Points' title='50 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&points=100'> <img src='pic/100coin.jpg' alt='100 Points' title='100 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&points=200'> <img src='pic/200coin.gif' alt='200 Points' title='200 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&points=500'> <img src='pic/500coin.gif' alt='500 Points' title='500 Points' border='0' /></a> <a href='$BASEURL/coin.php?id=$id&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.");
?>
|