This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtakefilesearch.php
66 lines (51 loc) · 1.91 KB
/
takefilesearch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/*
+------------------------------------------------
| TBDev.net BitTorrent Tracker PHP
| =============================================
| by CoLdFuSiOn
| (c) 2003 - 2011 TBDev.Net
| http://www.tbdev.net
| =============================================
| svn: http://sourceforge.net/projects/tbdevnet/
| Licence Info: GPL
+------------------------------------------------
| $Date$
| $Revision$
| $Author$
| $URL$
+------------------------------------------------
*/
ob_start('ob_gzhandler');
require_once 'include/bittorrent.php';
require_once 'include/user_functions.php';
require_once "include/html_functions.php";
//require_once "include/pager_functions.php";
dbconn(false);
loggedinorreturn();
$lang = array_merge( load_language('global'), load_language('takefilesearch') );
if(isset($_POST['search']) && !empty($_POST['search'])) {
$cleansearchstr = sqlesc($_POST['search']);
//print $cleansearchstr;
}
else
stderr($lang['tfilesearch_oops'], $lang['tfilesearch_nuffin']);
$query = mysql_query("SELECT id, filename, MATCH (filename)
AGAINST ($cleansearchstr IN BOOLEAN MODE) AS score
FROM files WHERE MATCH (filename) AGAINST ($cleansearchstr IN BOOLEAN MODE)
ORDER BY score DESC");
if(mysql_num_rows($query) == 0)
stderr($lang['tfilesearch_error'], $lang['tfilesearch_nothing']);
$HTMLOUT = '';
$HTMLOUT .= begin_table();
$HTMLOUT .= "<tr>
<td class='colhead'>{$lang['tID']}</td>
<td class='colhead' align='left'>{$lang['tfilename']}</td>
<td class='colhead' align='left'>{$lang['tscore']}</td>";
while($row = mysql_fetch_assoc($query))
{
$HTMLOUT .= "<tr><td>{$row['id']}</td><td>".htmlsafechars($row['filename'])."</td><td>{$row['score']}</td></tr>";
}
$HTMLOUT .= end_table();
print stdhead($lang['tstdhead']) . $HTMLOUT . stdfoot();
?>