Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[MOD] Thanks
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2007-10-02 10:16:38
Taken from Krapan's post [url="http://www.torrenttrader.org/index.php?showtopic=675"]here[/url] and modified to fit 2.x.

Dont forget to backup!

SQL:

CREATE TABLE `thanks` (

`torrentid` int(11) NOT NULL default '0',

`userid` int(11) NOT NULL default '0',

`id` int(11) NOT NULL auto_increment,

PRIMARY KEY  (`id`)

) TYPE=MyISAM AUTO_INCREMENT=743;
Open torrent-details.php and find (or wherever it is you want to add it...):


		$a = mysql_fetch_assoc($speedQ);

$totalspeed = mksize($a["totalspeed"]) . "/s";

}else{

$totalspeed = "No Activity";

}





Below, add:



// Thanx mod

$torrentid = $_GET["id"];

$thanks_sql = mysql_query("SELECT * FROM thanks where torrentid=$torrentid");

 $thanks_all = mysql_numrows($thanks_sql);

 if ($thanks_all) {

 while($rows_t = mysql_fetch_array($thanks_sql)) {

 $thanks_userid = $rows_t["userid"];

 $user_sql = mysql_query("SELECT * FROM users where id=$thanks_userid");

 $rows_a = mysql_fetch_array($user_sql);

 $username_t = $rows_a["username"];

 $thanksby =  $thanksby."<a href='userdetails.php?id=$thanks_userid'>$username_t</a>, ";

 }

 $t_userid = $CURUSER["id"];  

 $tsql = mysql_query("SELECT COUNT(*) FROM thanks where torrentid=$torrentid and userid=$t_userid");

 $trows = mysql_fetch_array($tsql);

 $t_ab = $trows[0];

if ($t_ab == "0" && $CURUSER["id"] != $row["owner"]) {

$thanksby = $thanksby." <form action=\"thanks.php\" method=\"post\">

<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">

<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">

</form>";

}

else {

$thanksby = $thanksby." <form action=\"thanks.php\" method=\"post\">

<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>

<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">

</form>";

}

}

else {

if ($CURUSER["id"] == $row["owner"]){

$thanksby = $thanksby." <form action=\"thanks.php\" method=\"post\">

<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>

<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">

</form>";

}

else

$thanksby = "No Thanks Yet

<form action=\"thanks.php\" method=\"post\">

<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">

<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">

</form>

";

}  print("<br><table><tr>

<td valign=top><table border=0 width=100 cellspacing=0 cellpadding=0><tr><td class=alt5 align=center><b>Thanks by</b></td>

</tr></table></td><td width=100%>" . $thanksby . "</td></tr></table>");



//Thanx mod end







Create a file called thanks.php and paste this:



<?

require("backend/functions.php");

dbconn();



$userid = $CURUSER["id"];

$torrentid = $_POST["torrentid"];

if (isset($userid) && isset($torrentid))

{

$res = mysql_query("INSERT INTO thanks (torrentid, userid) VALUES ($torrentid, $userid)");





header("Location: $SITEURL/torrents-details.php?id=$torrentid&thanks=1");

}

else {



header("Location: $SITEURL/index.php");  



}



?>



And voila, thanks mod works on 2.x  :P

Tested and working.
Unknown User
2007-10-02 12:47:31
i try now tank s gia
2007-10-02 13:04:17
remember to add a line to the delete torrent function in backend/cleanup.php and functions.php otherwise they will not be deleted
Unknown User
2007-10-02 13:16:24
this hack working but when a push the thanks buttom i have this message and when i do back page and refresh the site  i see thank by gia

Not Found

The requested URL /new/torrents-details.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Unknown User
2007-10-02 14:18:32
"giajane, post: 33188":
this hack working but when a push the thanks buttom i have this message and when i do back page and refresh the site  i see thank by giaNot Found

The requested URL /new/torrents-details.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


remove the "/new" from thanks.php
Unknown User
2007-10-02 16:19:46
"Tilburg, post: 33191":
remove the "/new" from thanks.php


very good thanks

gia
Unknown User
2007-10-02 17:40:27
Sorry, I missed that one, edited first post.
Unknown User
2007-10-02 21:40:49
really there is a better way that would save an extra 2 queries in torrents-details... i'll probably do it when i get some time
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728