/***********************************************************************
torrentdb - Copyright (C) 2004 - r00t
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
/*
11123944600
http://torrentdb.yi.org/
IMPORTANT UPDATE: address changed to: torrentdb.yi.org
*/
require("xmlspecialchars.php");
// php errors mess up our xml output, let's try to handle them cleanly
error_reporting(0);
$search=$_GET['search'];
if (!isset($_GET['search'])) $search=$_GET['SEARCH'];
$newer=$_GET['newer'];
$day=$_GET['day'];
// build query - search or list
if ($search) {
// TODO: pages for search results?
// inform users about limit? (needed to avoid sending the whole db)
$search=ereg_replace("[ _%\"]","%",$search);
//$search=ereg_replace("'","\'",$search);
$qry="select date,size,url,name,date,tracker from torrentdb where name like '%" . $search . "%' or url like '%" . $search . "%' order by -date limit 200";
$selection="searched for: ".htmlentities($search) . " (200 results max)";
} else if ($newer) {
if ("hello".$newer != "hello".($newer+1-1)) $newer=9999999999;
$qry="select size,url,name,date,tracker from torrentdb where ctime>" . (0+$newer) . " order by -ctime";
$selection="torrents newer than ".date("r",$newer) ." by time of indexing";
$next="?newer=" . time();
$prev="?";
} else if ($day != ""){
// calculate start and end time
$from=strtotime((-$day)." day 00:00:00");
$to =strtotime((-$day+1)." day 00:00:00");
$qry="select size,url,name,date,tracker from torrentdb where date>" . $from . " and date<" . $to . " order by -ctime";
$selection="torrents for ". date("l, jS F Y",strtotime((-$day)." days 00:00:00"));
$prev="?day=" . ($day+1);
if ($day>0) {
$next="?day=" . ($day-1);
} else {
$next="?newer=" . time();
}
} else {
$to =strtotime("now");
$from=strtotime((-1)." day");
$qry="select size,url,name,date,tracker from torrentdb where date>" . $from . " and date<" . $to . " order by -ctime";
$selection="torrents for the last 24 Hours";
$prev="?day=1";
$next="?newer=" . time();
}
$server = mysql_connect("newone","torrentdb","l33t");
mysql_select_db("torrentdb",$server);
header("Content-type: text/xml");
print "
";
print "
";
?>
torrentdbreigning over =mysql_result(mysql_query("select COUNT(1) from torrentdb;"),0);?> torrents/*
visit #torrentdb on irc.rizon.net for discussion
also try our rss feed!
not complete enough? submit more sites to index!
want to see ONLY newly added torrents? (keep clicking the arrow to update)
/*]]>*/?>
http://torrentdb.yi.org/
=$selection?>
if ($prev) { ?>=$prev?> } ?>
if ($next) { ?>=$next?> } ?>
/*
/*]]>*/?>/*
just report them in the irc channel...
/*]]>*/?>
if (!($res=mysql_query($qry))){
// we failed, give a useless error message
?>query failed: =mysql_error()?>
} else {
?>
/*=ereg_replace("&","&",ereg_replace("[^]A-Za-z0-9 ./()[_!&-]","_",$row->name));?>*/?>
/*=xmlspecialchars(ereg_replace(" ","%20",$row->url));?>*/?>
while ($row = mysql_fetch_object($res)){ ?>
=$row->date;?>=$row->size;?>=xmlspecialchars($row->name);?>
=xmlspecialchars(ereg_replace(" ","%20",$row->url));?>
=xmlspecialchars($row->tracker);?>
/*
dead13371087168072
*/?>
} ?>
} ?>