View Single Post
  #3  
Old 7th July 2009, 09:00
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
thanks m8 it lists them but needs a corection because i use those images to not use checkboxes any way thanks
got it work
here is my new browse.php
[php]<?
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
parked();
maxsysop ();

$cats = genrelist();
$searchstr = unesc($_GET["search"]);
$cleansearchstr = searchfield($searchstr);
if (empty($cleansearchstr))
unset($cleansearchstr);
if ($_GET['sort'] && $_GET['type']) {
$column = '';
$ascdesc = '';
switch($_GET['sort']) {
case '1': $column = "name"; break;
case '2': $column = "numfiles"; break;
case '3': $column = "comments"; break;
case '4': $column = "added"; break;
case '5': $column = "size"; break;
case '6': $column = "times_completed"; break;
case '7': $column = "seeders"; break;
case '8': $column = "leechers"; break;
case '9': $column = "owner"; break;
default: $column = "id"; break;
}
switch($_GET['type']) {
case 'asc': $ascdesc = "ASC"; $linkascdesc = "asc"; break;
case 'desc': $ascdesc = "DESC"; $linkascdesc = "desc"; break;
default: $ascdesc = "DESC"; $linkascdesc = "desc"; break;
}
$orderby = "ORDER BY torrents." . $column . " " . $ascdesc;
$pagerlink = "sort=" . intval($_GET['sort']) . "&type=" . $linkascdesc . "&";
} else {
$orderby = "ORDER BY torrents.id DESC";
$pagerlink = "";
}
$addparam = "";
$wherea = array();
$wherecatina = array();
if ($_GET["incldead"] == 1)
{
$addparam .= "incldead=1&amp;";
if (!isset($CURUSER) || get_user_class() < UC_ADMINISTRATOR)
$wherea[] = "banned != 'yes'";
}
elseif ($_GET["incldead"] == 2)
{
$addparam .= "incldead=2&amp;";
$wherea[] = "visible = 'no'";
}
else
$wherea[] = "visible = 'yes'";
$category = (int)$_GET["cat"];
$all = $_GET["all"];
if (!$all)
if (!$_GET && $CURUSER["notifs"])
{
$all = True;
foreach ($cats as $cat)
echo "<option value='".$cat['id']."'>".$cat['name']."</option>";
}

if ($all)
{
$wherecatina = array();
$addparam = "";
}
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) . "&amp;";
//$orderby = "";
}
$where = implode(" AND ", $wherea);
if ($wherecatin)
$where .= ($where ? " AND " : "") . "category IN(" . $wherecatin . ")";
if ($where != "")
$where = "WHERE $where";
$res = mysql_query("SELECT COUNT(*) FROM torrents $where") or die(mysql_error());
$row = mysql_fetch_array($res);
$count = $row[0];
if (!$count && isset($cleansearchstr)) {
$wherea = $wherebase;
//$orderby = "ORDER BY id DESC";
$searcha = explode(" ", $cleansearchstr);
$sc = 0;
foreach ($searcha as $searchss) {
if (strlen($searchss) <= 1)
continue;
$sc++;
if ($sc > 5)
break;
$ssa = array();
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");
$row = mysql_fetch_array($res);
$count = $row[0];
}
}
$torrentsperpage = $CURUSER["torrentsperpage"];
if (!$torrentsperpage)
$torrentsperpage = 15;
if ($addparam != "") {
if ($pagerlink != "") {
if ($addparam{strlen($addparam)-1} != ";") { // & = &amp;
$addparam = $addparam . "&" . $pagerlink;
} else {
$addparam = $addparam . $pagerlink;
}
}
} else {
$addparam = $pagerlink;
}

if ($count)
{
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "browse.php?" . $addparam);
$query = "SELECT torrents.id, torrents.nuked, torrents.category, torrents.leechers, torrents.seeders, torrents.request, torrents.scene, torrents.free, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.numfiles,torrents.filen ame,torrents.description,torrents.owner,IF(torrent s.nfo <> '', 1, 0) as nfoav," .
// "IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, 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";
"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";
$res = mysql_query($query) or die(mysql_error());
}
else
unset($res);
if (isset($cleansearchstr))
stdhead("Search results for \"$searchstr\"");
else
stdhead("Failu saraksts");
?>
<table class="categ" border="1" cellpadding="0" cellspacing="5" width="950">
<tbody>
<tr>
<td width="950"><center>
<form method="get" action="browse.php">
<a href="viewrequests.php"><img src="pic/reqs.png" border=0></a><b>Meklēt:</b>
<input name="search" size="40" value="" type="text">
<select name="cat">
<option value="0">(Visi)</option>
<option value="6">Anime/Cartoon</option>
<option value="2">Appz</option>
<option value="13">Docs</option>
<option value="4">Games/PC</option>
<option value="17">Games/PS2</option>
<option value="22">Games/PS3</option>
<option value="23">Games/PSP</option>
<option value="24">Games/Wii</option>
<option value="25">Games/X360</option>
<option value="14">Images</option>
<option value="18">Hentai</option>
<option value="2">MiSC</option>
<option value="12">Mobile</option>
<option value="16">Movies/DVD-RO</option>
<option value="11">Movies/SVCD</option>
<option value="8">Movies/Oldies</option>
<option value="3">Movies/XVID</option>
<option value="7">Linux/Unix</option>
<option value="15">Music/Video</option>
<option value="5">Music/Mp3</option>
<option value="26">Movies/DVDR</option>
<option value="10">Tv/Episodes</option>
<option value="21">Tv/Boxsets</option>
</select>
</select>
<input value="Ok!" type="submit">
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apskatīt failus</b>
<select name="incldead">
<option value="0">Aktīvos</option>
<option value="1">Arī miru
Reply With Quote