View Single Post
  #1  
Old 8th December 2007, 22:25
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 984
Unhappy Screenshot for Torrents
This is the Screenshot Hack Updated for TorrentTrader Classic Beta 4

Open torrents-upload.php
Search for:

Code:
move_uploaded_file($tmpname, "$torrent_dir/$id.torrent");
if (isset($_FILES['nfo'])) {
move_uploaded_file($nfofilename, "$nfo_dir/$id.nfo");
}

Insert below:

Code:
$foldername = "uploads/";
if (isset($_FILES['img'])) {
//move_uploaded_file($imgfilename, $torrent_dir/.$_FILES['img']['name'].);
move_uploaded_file($_FILES['img']['tmp_name'], $foldername. $_FILES['img']['name']);
}

Search for :

Code:
tr("" . NFO . "", "<input type=file name=nfo size=50 value=" . $_FILES['nfo']['name'] . ">
" . MAX_SIZE_N . " $max_nfo_size_nice\n", 1);

Insert below:

Code:
tr("Screenshot", "<input type=file name=img size=50 value=" . $_FILES['img']['name'] . ">
" . MAX_SIZE_I . "\n", 1);

Open take-edit.php
Search for:
Code:
preg_match('/^(.+)\.torrent$/si', $fname, $matches);
$shortfname = $matches[1];
$dname = $row["save_as"];

Insert below:

Code:
$foldername = "uploads/";
$imgaction = $_POST['imgaction'];
if ($imgaction == "update")
{
$imgfile = $_FILES['img'];
if (!$imgfile) die("No data " . var_dump($_FILES));
if ($imgfile['size'] > 165535)
 genbark("Img is too big! Max 65,535 bytes.");
$imgfilename = $imgfile['tmp_name'];
if (@is_uploaded_file($imgfilename) && @filesize($imgfilename) > 0)
move_uploaded_file($_FILES['img']['tmp_name'], $foldername. $_FILES['img']['name']);
$updateset[] = "img = " . sqlesc($_FILES['img']['name']);
}

Open torrents-edit.php
Search for:
Code:
tr("" . NFO . ": ", "<input type=radio name=nfoaction value='keep' CHECKED>" . KEEP. "" . KEEPCURRENT . ":
".
"<input type=radio name=nfoaction value='update'>". UPDATENFO . ":
<input type=file name=nfo size=80>", 1);
Insert below:

Code:
tr("Image: ", "<input type=radio name=imgaction value='keep' checked>" . KEEP. "" . KEEPCURRENT . ":
".
"<input type=radio name=imgaction value='update'>". UPDATEIMG . ":
<input type=file name=img size=80>", 1);

Open torrents-details.php
Search for:

Code:
print("<tr><td align=left>" . RATINGS . ":</td><td>" . $s . "</td></tr>");

Insert below:

Code:
print("<tr><td align=left>Screenshot:</td><td><a href=\"uploads/" . $row['img'] . "\" target=_blank><img width=270 height=200 border=0 src=\"uploads/" . $row['img'] . "\" alt='Click to Enlarge'></a></td></tr>");

Search for:

Code:
$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo AS nfo, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, 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.numfiles, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id")
Replace with:

Code:
$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.img, torrents.nfo AS nfo, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, 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.numfiles, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id")

Insert into your DB:

Code:
alter table torrents add( img varchar(255) NOT NULL default 'default.jpg')
Reply With Quote
The Following 4 Users Say Thank You to Fynnon For This Useful Post:
BamBam0077 (19th January 2022), gogo999 (6th September 2012), Legend2000 (22nd May 2012), pbobbe (27th March 2009)