View Single Post
  #2  
Old 13th April 2011, 15:09
Gouald Gouald is offline
Member
 
Join Date: Sep 2010
P2P
Posts: 7
Default
Credits to putyn for this version
Rss.php with passkey
Not tested - Not Xhtml valid

Here you go - Taken from the Codexv4 Installer, everyone knows the history there and why you cant get these 08 mods.


PHP Code:
<?php
//== Made by Putyn @09source.kicks-ass.net
require "include/bittorrent.php";
dbconn();
if ((
$fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w"))) {
    
$cats "";
    
$res sql_query("SELECT id, name FROM categories");
    while (
$arr mysql_fetch_assoc($res))
    
$cats[$arr["id"]] = $arr["name"];
    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" "<title>TorrentBits</title>\n<description>0-week torrents</description>\n<link>$DEFAULTBASEURL/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    
$r sql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") or sqlerr(__FILE____LINE__);
    while (
$a mysql_fetch_assoc($r)) {
        
$cat $cats[$a["category"]];
        
$s "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" "<description>" htmlspecialchars($a["descr"]) . "</description>\n";
        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$DEFAULTBASEURL/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$DEFAULTBASEURL/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}
$passkey $_GET["passkey"];
if (
$passkey) {
    
$user mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM users WHERE passkey =" sqlesc($passkey) . ""));
    if (
$user[0] != 1)
        exit();
}
$feed $_GET["feed"];
$cat $_GET["cat"];
// name a category
$res mysql_query("SELECT id, name FROM categories");
while (
$cat mysql_fetch_assoc($res))
$category[$cat['id']] = $cat['name'];
// RSS Feed description
$DESCR "This is a private tracker, and you have to register before you can get full access to the site. Before you do anything here at YourSite we suggest you read the rules! There are only a few rules to abide by, and we do enforce them!";
// by category ?
if ($cat)
    foreach (
$_GET["cat"] as $cat)
    
$cats[] = $cat;
if (
$cats)
    
$where "category IN (" implode(", "$cats) . ") AND";
// start the RSS feed output
header("Content-Type: application/xml");
print(
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" "<title>" $SITENAME "</title>\n<link>" $BASEURL "</link>\n<description>" $DESCR "</description>\n" "<language>en-usde</language>\n<copyright>Copyright ? 2004 " $SITENAME "</copyright>\n<webMaster>" $SITEEMAIL "</webMaster>\n" "<image><title>" $SITENAME "</title>\n<url>" $BASEURL "/favicon.ico</url>\n<link>" $BASEURL "</link>\n" "<width>16</width>\n<height>16</height>\n<description>" $DESCR "</description>\n</image>\n");
// get all vars
$res mysql_query("SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE $where visible='yes' ORDER BY added DESC") or sqlerr(__FILE____LINE__);
while (
$row mysql_fetch_row($res)) {
    list(
$id$name$descr$filename$size$cat$seeders$leechers$added$catname) = $row;
    
// seeders ?
    
if (($seeders) != 1) {
        
$s "s";
        
$aktivs "$seeders seeder$s";
    } else
        
$aktivs "no seeders";
    
// leechers ?
    
if ($leechers != 1) {
        
$l "s";
        
$aktivl "$leechers leecher$l";
    } else
        
$aktivl "no leecher";
    if (isset(
$_GET["feed"])) $feed $_GET["feed"];
    else 
$feed " ";
    
// ddl or detail ?
    
if ($feed == "dl")
        
$link "$BASEURL/rssdownload.php/$id/" . ($passkey "$passkey/" "") . "$filename";
    else
        
$link "$BASEURL/details.php?id=$id&amp;hit=1";
    
// measure the totalspeed
    
if ($seeders >= && $leechers >= 1) {
        
$spd mysql_query("SELECT (t.size * t.times_completed + SUM(p.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC") or sqlerr(__FILE____LINE__);
        
$a mysql_fetch_assoc($spd);
        
$totalspeed mksize($a["totalspeed"]) . "/s";
    } else
        
$totalspeed "no traffic";
    
// output of all data
    
echo("<item><title>" htmlspecialchars($name) . "</title>\n<link>" $link "</link>\n<category>\nCategory: " $category[$cat] . " </category>\n<size> Size: " mksize($size) . "</size>\n<status> Status: " $aktivs " and " $aktivl "</status>\n<speed> Speed: " $totalspeed "</speed>\n<added> Added: " $added "</added>\n<description> Description:\n " htmlspecialchars($descr) . "\n</description>\n</item>\n");
}
echo(
"</channel>\n</rss>\n");

?>
Im sorry i cannot test the script i just lifted it from a working archive from my old source code but will eventually begin assisting/supporting 08 once again, worse case you'll need to alter it slightly but it should be good to go

Last edited by Gouald; 13th April 2011 at 15:56.
Reply With Quote