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
[FIX] Anonymous uploads
Controls ·  Search New posts · Mark unread

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

Unknown User
2008-01-21 08:36:22
Ok due to growing amount of requests relating to, or limited by, anonymous uploads, I wrote a quick fix for it. The idea is to always insert an owner, but check for an anonymity flag for the torrent. That way mods will be easier to write, and stats and such would be easier to gather.

I'm hoping TS will add this into 2.04 if enough people want mods requiring this fix.

ALTER TABLE `torrents` ADD `anon` ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'no' AFTER `owner`;


torrents-upload.php

find:

		//anonymous upload

$anonyupload = unesc($_POST["anonycheck"]);

if ($anonyupload == "yes") {

$uploaderid = "0";

}else{

$uploaderid = $CURUSER["id"];

}
replace with:


		//anonymous upload

$anonyupload = unesc($_POST["anonycheck"]);

$uploaderid = $CURUSER["id"];



if ($anonyupload == "yes")  {

$anon = "yes";  

} else {

$anon = "no";

}





find:



		$ret = mysql_query("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash,		 

size, numfiles, save_as, announce, external, nfo, torrentlang) VALUES (".sqlesc($fname).", '".$uploaderid."',

".sqlesc($name).", ".sqlesc($descr).", '".$inames[0]."', '".$inames[1]."', '".$type."', '" . get_date_time() . "',

'".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."',

'".$langid."')");





replace with:



$ret = mysql_query("INSERT INTO torrents (filename, owner, anon, name, descr, image1, image2, category, added, info_hash,		 

size, numfiles, save_as, announce, external, nfo, torrentlang) VALUES (".sqlesc($fname).", '".$uploaderid."', '".$anon."',

".sqlesc($name).", ".sqlesc($descr).", '".$inames[0]."', '".$inames[1]."', '".$type."', '" . get_date_time() . "',

'".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."',

'".$langid."')");



(Or just add anon and '".$anon."' to the query if you're using a modified one...)





torrents-details.php



find:



//GET ALL MYSQL VALUES FOR THIS TORRENT

$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or die(mysql_error());





replace with:



//GET ALL MYSQL VALUES FOR THIS TORRENT

$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.anon,torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or die(mysql_error());



(or add torrents.anon to the query if you're using a modified one)





find:



if ($row["username"])





replace with:



if ($row["anon"] == "no")







torrents-edit.php

find:



$updateset[] = "freeleech = '".$_POST["freeleech"]."'";





below, add:



$updateset[] = "anon = '" . ($_POST["anon"] ? "yes" : "no") . "'";







find:



if ($row["external"] != "yes"){

echo "<tr><td align=right><B>Free Leech: </b></TD><TD><input type=\"checkbox\" name=\"freeleech\"" . (($row["freeleech"] == "1") ? " checked=\"checked\"" : "" ) . " value=\"1\" />Leeching is free? (Only Uploading Counts)<br>";  

}





below, add:



if (($site_config['ANONYMOUSUPLOAD']) && ($row['owner'])) {

echo "<tr><td align=right><B>Upload anonymous: </b></TD><TD><input type=\"checkbox\" name=\"anon\"" . (($row["anon"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"1\" />(Your userid will not be associated to this upload)<br>";

}




That should be it. Tested on my test site, working fine. Now we can get to work on those mods requiring an owner :)
Unknown User
2008-01-21 16:56:05
Tkssss :)
Unknown User
2008-01-21 17:45:16
just updated SVN
Unknown User
2008-01-21 21:31:00
Cool, thanks :)
Unknown User
2008-01-21 21:43:16
wooo another step on TT v 2.xx ! great !

I didnt find exactly :

  if ($row["username"])
Unknown User
2008-01-21 22:25:12
"alamandra, post: 37801":
wooo another step on TT v 2.xx ! great !
I didnt find exactly :

  if ($row["username"])


On version previous to 2.03, it's
I think

if ($row["owner"])
Unknown User
2008-01-21 22:49:00
MAY U post several lines ABOVE dat point ?

I found some

if ($owned)

echo "[<a href=torrents-edit.php?id=$row[id]><B>Edit Torrent</B></a>]";
also :


stdhead("Details for torrent \"" . $row["name"] . "\"");



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



Am on v 2.01 and a little bit scared to quit to 2.03, I dont want to be obligied to re modify all my files again
Unknown User
2008-01-21 22:54:57
print("<tr><td align=left><b>" . TOTAL_SIZE . ":</b></td><td>" . mksize($row["size"]) . " </td></tr>\n");

print("<tr><td align=left><b>" . INFO_HASH . ":</b></td><td>" . $row["info_hash"] . "</td></tr>\n");

print("<tr><td align=left><b>" . ADDED_BY . ":</b></td><td>");



if ($row["owner"]) {

print("<a href=account-details.php?id=" . $row["owner"] . ">" . $row["username"] . "</a></td></tr>\n");
Unknown User
2008-01-21 23:33:54
OK but there is no "if" in 2.01,  its a ">"  , here am I :

print("<tr><td align=left><b>" . ADDED_BY . ":</b></td><td><a href=account-details.php?id=" . $row["owner"] . ">" . $row["username"] . "</a></td></tr>\n");


Last but not Least...yooooooo have a good night !
Unknown User
2008-01-21 23:36:51
if ($row["anon"] == "yes" && !$owned)

print("<tr><td align=left><b>" . ADDED_BY . ":</b></td><td>Anonymous</td></tr>");

elseif ($row["username"])

print("<tr><td align=left><b>" . ADDED_BY . ":</b></td><td><a href=account-details.php?id=" . $row["owner"] . ">" . $row["username"] . "</a></td></tr>");

else

print("<tr><td align=left><b>" . ADDED_BY . ":</b></td><td>Unknown</td></tr>");


^ that's the code i used in SVN.
Unknown User
2008-01-22 00:10:23
yoooooooo this time all situations are in count ! great !
Unknown User
2008-01-22 01:53:56
thank youuu :)
Unknown User
2008-01-22 20:05:03
Thanks for this great fix, the last issue I am seeing and then this should be completed I would imagine is that the name is blank on torrents.php in the added by field it would be awesome if we could get that to say Unknown or Anonymous instead of being blank thanks again for your great work and also the speedy addition to svn, seems like v2.03 is going at a rapid pace finally :)
Unknown User
2008-01-22 20:44:13
There is no Uploader name listed on torrents.php in standard 2.x, if you do you've applied a mod to do so and I'd need to see your torrenttable function to see how to adjust it correctly....
Unknown User
2008-01-22 21:07:21
I have not applied a mod thats why I was saying its showing up blank but it would be a good addition is all  :)  thanks ezerbeth
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728