forked from Bigjoos/U-232-V5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.suggest.php
70 lines (64 loc) · 2.84 KB
/
ajax.suggest.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
67
68
69
70
<?php
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once INCL_DIR.'user_functions.php';
dbconn(true);
loggedinorreturn();
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
$orderby = 'ORDER BY ';
$order = array(
0 => 'seeders',
1 => 'leechers',
2 => 'id',
3 => 'size',
4 => 'hits',
5 => 'vip'
);
$outhtml = "<style>.hover:hover{color:".(isset($_POST["color"]) ? $_POST["color"] : 'green')."}</style><table border='0' style='width:100%;border:0px;' ><tr><td>";
if(empty($_POST['search'])){die(false);}
$wh = isset($_POST["order"]) ? (int)$_POST["order"] : 2;
$orderby .= isset($wh) && array_key_exists($wh,$order) ? sqlesc($order[$wh]) : 'id';
$limit = isset($_POST["limit"]) ? (int)$_POST["limit"] : 10;
$where = isset($_POST["search"]) ? sprintf('WHERE name LIKE \'%s\'','%'.$_POST["search"].'%') : die(false);
$query = "SELECT id, name FROM torrents $where $orderby LIMIT $limit";
$res = sql_query("SELECT COUNT(id) FROM torrents $where") or sqlerr(__FILE__, __LINE__);
$row = mysqli_fetch_row($res);
$count = $row[0];
if($count > 0)
{
$res = sql_query($query) or sqlerr(__FILE__, __LINE__);$ye = '';$i=1;
while ($row = mysqli_fetch_assoc($res))
{
if(empty($row['name'])){
die(false);
}
$outhtml .="$i : <a href='details.php?id=".(int)$row['id']."' class='hover'>".htmlsafechars($row['name'])."</a><br/>";
$i++;
}
echo $outhtml .= "</td></tr></table>";
}
else{die(false);}
}
else
{
header("Location: {$INSTALLER09['baseurl']}/index.php");
}
die(false);
?>