Hi
Credit reviens a war02
Update : spiritblue and the community
SQL: Yes
Important to know : You need to install before the Seed Bonus mod [TTv3] here
mod allows to give seedbonus points to upload for encouragement of the good work done.
*Always make a backup before making the change.
SQL:
Create a file named corners.php :
In torrents-details.php add or you like it :
Search :
Add after :
In functions.php find :
Add after :
~ Add the file corners.php to the root of the site
~ In folder images you will create a folder of the point name and add the images inside
Credit reviens a war02
Update : spiritblue and the community
SQL: Yes
Important to know : You need to install before the Seed Bonus mod [TTv3] here
mod allows to give seedbonus points to upload for encouragement of the good work done.
*Always make a backup before making the change.
SQL:
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',
PRIMARY KEY (`id`)
) ;
Create a file named corners.php :
<?php
require "backend/functions.php";
dbconn();
loggedinonly();
$id = 0 + $_GET["id"];
$points = 0 + $_GET["points"];
if (!is_valid_id($id) || !is_valid_id($points))
die();
$pointscangive = array("10","20","50","100");
if (!in_array($points, $pointscangive))
stderr("Error","You can't give that amount of points!!!");
$sdsa = SQL_Query_exec("SELECT 1 FROM coins WHERE torrentid=".sqlesc($id)." AND userid =" .sqlesc($CURUSER["id"]));
$asdd = mysqli_fetch_array($sdsa);
if ($asdd)
show_error_msg("Error","You already gave points to this torrent.");
$res = SQL_Query_exec("SELECT owner FROM torrents WHERE id = ".sqlesc($id));
$row = mysqli_fetch_assoc($res) or stderr("Error","Torrent was not found");
$userid = $row["owner"];
if ($userid == $CURUSER["id"])
show_error_msg("Error","You can't give your self points!");
if ($CURUSER["seedbonus"] < $points)
show_error_msg("Error","You dont have enough points");
SQL_Query_exec("INSERT INTO coins (userid, torrentid, points) VALUES (".sqlesc($CURUSER["id"]).", ".sqlesc($id).", ".sqlesc($points).")");
SQL_Query_exec("UPDATE users SET seedbonus=seedbonus+".$points." WHERE id=".sqlesc($userid));
SQL_Query_exec("UPDATE users SET seedbonus=seedbonus-".$points." WHERE id=".sqlesc($CURUSER["id"]));
SQL_Query_exec("UPDATE torrents SET points=points+".$points." WHERE id=".sqlesc($id));
header("Refresh: 3;url=torrents-details.php?id=$id");
show_error_msg("Success", "Successfully gave points to this torrent.<br/>Redirection...", 1);
?>
In torrents-details.php add or you like it :
// Add points to torrent
$blasd = SQL_Query_exec("SELECT points FROM coins WHERE torrentid=$id AND userid=".$CURUSER["id"]);
$sdsa = mysqli_fetch_assoc($blasd) or $sdsa["points"] = 0;
tr("Points: ","<b>In total ".$row["points"]." Points given to this torrent of which ".$sdsa["points"]." from you.
By clicking on the coins you can give points to the uploader of this torrent.</b>
<a href=coins.php?id=$id&points=10><img src=images/point/10points.png border=0></a> <a href=coins.php?id=$id&points=20><img src=images/point/20points.png border=0></a> <a href=coins.php?id=$id&points=50><img src=images/point/50points.png border=0></a> <a href=coins.php?id=$id&points=100><img src=images/point/100points.png border=0></a>", 1);
// End Add points to torrent
Search :
torrents.filename,Add after :
torrents.points,In functions.php find :
SQL_Query_exec("DELETE FROM torrents WHERE id = $id"); Add after :
SQL_Query_exec("DELETE FROM coins WHERE torrentid = $id");~ Add the file corners.php to the root of the site
~ In folder images you will create a folder of the point name and add the images inside
Last edited by spiritblue on 2022-01-19 22:19:12
