-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
executable file
·52 lines (47 loc) · 1.31 KB
/
api.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
<?php
require_once('../filehunt/lib.php');
mysql_selector();
if($_SERVER['HTTP_HOST'] == 'localhost') error_reporting(0);
if($_GET['func'] == 'login')
{
$sql = "SELECT rowID, username, email, last_sub_check FROM users WHERE username = '$_GET[u]' AND password = '$_GET[p]'";
$result = mysql_query($sql);
echo json_encode(mysql_fetch_array($result));
}
elseif($_GET['func'] == 'mysubscribers')
{
$sql = "SELECT s.rowID AS s_rowID,
s.subscriber AS s_subscriber,
s.subscribed,
u.rowID AS u_rowID,
u.username AS u_username
FROM subs s,
users u
WHERE s.subscribed=$_GET[u]
AND s.subscriber=u.rowID";
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0) echo 'false';
for ($i=0; $i < mysql_num_rows($result) ; $i++)
{
echo json_encode(mysql_fetch_array($result));
}
}
elseif($_GET['func'] == 'mysubscribtions')
{
$sql = "SELECT s.rowID AS s_rowID,
s.subscriber AS s_subscriber,
s.subscribed,
u.rowID AS u_rowID,
u.username AS u_username
FROM subs s,
users u
WHERE s.subscriber=$_GET[u]
AND s.subscribed=u.rowID";
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0) echo 'false';
for ($i=0; $i < mysql_num_rows($result) ; $i++)
{
echo json_encode(mysql_fetch_array($result));
}
}
?>