View Single Post
  #8  
Old 21st February 2010, 01:26
Timisoreanul's Avatar
Timisoreanul Timisoreanul is offline
Senior Member
 
Join Date: Apr 2008
P2P
Posts: 211
Default
cekosexama i found recommend torrents on torrentstrike forum, thanks to nicky, here is the code
sql
Code:
ALTER TABLE `torrents` ADD `recommend` ENUM( 'Yes', 'No' ) NOT NULL DEFAULT 'No';
upload add
Code:
tr("Recommend torrent","<input type=radio name=recommend" . ($row["recommend"] == "yes" ? " checked" : "") . " value=yes>Yes<input type=radio name=recommend" . ($row["recommend"] == "no" ? " checked" : "") . " value=no>No",1);
takeupload in query after
Code:
type,
add
Code:
recommend,
and after
Code:
$type,
add
Code:
$recommend,
edit add
Code:
tr("Recommend torrent","<input type=radio name=recommend" . ($row["recommend"] == "yes" ? " checked" : "") . " value=yes>Yes<input type=radio name=recommend" . ($row["recommend"] == "no" ? " checked" : "") . " value=no>No",1);
takeedit after
Code:
$updateset[] = "category = " . (0 + $type);
add
Code:
$recommend = unesc($_POST['recommend']);
$updateset[] = "recommend = " . sqlesc($recommend);
index.php add where you want
Code:
$res1 = mysql_query("SELECT torrents.id, torrents.size, torrents.name, torrents.filename, torrents.poster, torrents.leechers, torrents.seeders, torrents.times_completed, torrents.owner, users.username AS username, users.class AS class FROM torrents INNER JOIN users ON torrents.owner = users.id WHERE torrents.recommend='yes' ORDER BY torrents.times_completed DESC LIMIT 3");
if (mysql_num_rows($res1) > 0) {
begin_frame("Recommend Torrent",true,5);
while ($arr1 = mysql_fetch_assoc($res1)) {
$dispname = htmlspecialchars(trim($arr1["name"]));
$count_dispname=strlen($dispname);
$max_lenght_of_torrent_name="15"; // maximum lenght
if($count_dispname > $max_lenght_of_torrent_name){
$short_torrent_name_alt="title=\"$dispname \"";
$dispname=substr($dispname, 0, $max_lenght_of_torrent_name) . "...";
}else
$short_torrent_name_alt="$dispname";
echo "<td width=\"50%\" align=\"center\">
<br/>
<b><a href=\"./details.php?id=$arr1[id]&hit=1\"$short_torrent_name_alt><img src=\"$arr1[poster]\" border=\"0\" width=\"150\" height=\"150\"></a></b>
<br/>
<a href=\"./details.php?id=$arr1[id]&hit=1\"$short_torrent_name_alt><b>$dispname</b></a><br/><br/>
<b><a href=\"./details.php?id=$arr1[id]&dllist=1#seeders\"><font color=green>Seed ($arr1[seeders])</font> <font color=red>Leech ($arr1[leechers])</font></a> <font color=blue>Snatched ($arr1[times_completed])</font></b><br/>
<b>Size:</b> ".mksize($arr1['size'])."<br/>
<b>Upped by:</b> <a href=userdetails.php?id=$arr1[owner]><b>".$arr1['username']."</b></a><br/>
<a class=\"index\" href=\"download.php/$arr1[id]/" . rawurlencode($arr1["filename"]) . "\">" . "<font color=red>Download Torrent</font>" . "</a><br>
</td>";
}

end_frame();
}
mysql_free_result($res1);
so if you whant to show the recommend torrents on browse , use the last code end add it to browse.php
__________________
only me
Reply With Quote