Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #1  
Old 13th April 2011, 12:08
Sarge Sarge is offline
Member
 
Join Date: Apr 2011
P2P
Posts: 3
Default RSS with passkey (TBDev 08)
Hey there. I'm after a RSS script with passkey implemented. We brought passkey into our site a year or 2 ago but forgot about the rss part of it :P

We want to have the users take advantage of utorrents RSS downloader with our site.

Thanks in advance.
Reply With Quote
  #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
  #3  
Old 14th April 2011, 07:20
Sarge Sarge is offline
Member
 
Join Date: Apr 2011
P2P
Posts: 3
Default
thanks bud. Have run it through and found a few kinks in it.

Ill post the code with the fixes in a short while.

Bump: is there something i can do so people dont have to include the cookie uid and pass... I understand when peoples IP's changes, so does the pass.

atm at the end of the feed url (and passkey) you have to include COOKIE:uid=xxx;pass=xxxxxxx; for the feed to work.
Reply With Quote
Reply

Tags
08 , passkey , rss , tbdev

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 18:45. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.