<?
require_once("include/func.php");
require_once("functions/torrenttable.php");
dbconn(false);
loggedinorreturn();
parked();
//wyswietla kategorie
$cats = genrelist();
$searchstr = unesc($_GET["search"]);
$cleansearchstr = searchfield($searchstr);
if (empty($cleansearchstr))
$orderby = "ORDER BY torrents.id DESC";
$addparam = "";
if ($_GET["incldead"] == 1)
{
$addparam .= "incldead=1&";
if (!isset($CURUSER) || get_user_class
() < UC_ADMINISTRATOR
) $wherea[] = "banned != 'yes'";
}
elseif ($_GET["incldead"] == 2)
{
$addparam .= "incldead=2&";
$wherea[] = "visible = 'no'";
}
else
$wherea[] = "visible = 'yes'";
$category = (int)$_GET["cat"];
if (count($wherecatina) > 1
) $wherecatin = implode(",",$wherecatina); elseif (count($wherecatina) == 1
) $wherea[] = "category = $wherecatina[0]";
$wherebase = $wherea;
if (isset($cleansearchstr)) {
$wherea[] = "MATCH (search_text, ori_descr) AGAINST (" . sqlesc($searchstr) . ")";
//$wherea[] = "0";
$addparam .= "search=" . urlencode($searchstr) . "&"; $orderby = "";
}
$where = implode(" AND ", $wherea); if ($wherecatin)
$where .= ($where ? " AND " : "") . "category IN(" . $wherecatin . ")";
if ($where != "")
$where = "WHERE $where";
$count = $row[0];
if (!$count && isset($cleansearchstr)) { $wherea = $wherebase;
$orderby = "ORDER BY id DESC";
$searcha = explode(" ", $cleansearchstr); $sc = 0;
foreach ($searcha as $searchss) {
continue;
$sc++;
if ($sc > 5)
break;
foreach (array("search_text", "ori_descr") as $sss) $ssa[] = "$sss LIKE '%" . sqlwildcardesc($searchss) . "%'";
$wherea[] = "(" . implode(" OR ", $ssa) . ")"; }
if ($sc) {
$where = implode(" AND ", $wherea); if ($where != "")
$where = "WHERE $where";
$res = mysql_query("SELECT COUNT(*) FROM torrents $where"); $count = $row[0];
}
}
$torrentsperpage = $CURUSER["torrentsperpage"];
if (!$torrentsperpage)
$torrentsperpage = 15;
if ($count)
{
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "browse.php?" . $addparam);
$query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.numfiles,torrents.filename,torrents.owner,IF(torrents.nfo <> '', 1, 0) as nfoav," .
"categories.name AS cat_name, categories.image AS cat_pic, users.username, users.anonymous FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit";
"categories.name AS cat_name, categories.image AS cat_pic, users.username FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit";
}
else
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> My homepage </title>
<script src="torrents/jquery.js" type="text/javascript"></script>
<script src="torrents/jquery_ui.js" type="text/javascript"></script>
<script src="torrents/global.js" type="text/javascript"></script>
<script type="text/javascript">var $j = jQuery;</script>
<script src="torrents/browse.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div id="naglowek">
<div id="grants"><br><br></div>
</div>
<div id="content">
<br><form name="filter" method="get" action="">
<div class="filter_torrents">
<div class="box pad">
<table>
<tr>
<td class="label">Search terms:</td>
<td colspan="3"><input type="text" size="40" style="width: 98%;" name="search" class="inputtext" value="" /></td>
</tr>
</table>
<table class="cat_list hide" id="taglist">
<tr class="genre_list">
<?
$i = 0;
foreach ($cats as $cat)
{
$catsperrow = 7;
print(($i && $i % $catsperrow == 0) ?
"</tr><tr>" : ""); print("<td class=\"bottom\" style=\"padding-bottom: 2px; padding-left: 10px;\"><input name=\"c$cat[id]\" type=\"checkbox\" " . (in_array($cat[id
],$wherecatina) ?
"checked " : "") . "value=\"1\">" . htmlspecialchars($cat[name
]) . "</td>\n"); $i++;
}
?>
</tr>
<tr class="cat_img">
<td class="label" colspan="2">Szukaj w:</td>
<td colspan="6">
<select name="incldead">
<option value="0">tylko aktywne</option>
<option value="1"
<? print($_GET["incldead"] == 1 ?
" selected" : ""); ?>>wraz z martwymi</option>
<option value="2"
<? print($_GET["incldead"] == 2 ?
" selected" : ""); ?>>tylko martwe</option>
</select>
</td>
</tr>
</table>
<table class="cat_list" width="100%">
<tr class="cat_img">
<td class="label2">
<a href="#" onclick="$j('#taglist').toggle('blind', {}, 500); return false;" id="swaptags">Zaawansowane wyszukiwanie</a></td>
</tr>
</table>
<div class="submit">
<input type="submit" value="Filter Torrents">
<input type="button" value="Reset" onclick="location.href='browse.php'">
</div>
</div>
</div>
</form>
</div></div>
</body>
</html>
to jak pomoże ktoś.?