-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.php
65 lines (65 loc) · 1.87 KB
/
request.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
<?php
require 'lfl.php';
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
if(lfl_user_is_of_type())
{
$token = filter_input(INPUT_POST, 'tk');
$type = filter_input(INPUT_POST, 'tp');
if(lfl_token_verify($token))
{
$result = 'error';
switch($type)
{
case "test":
{
$result = (array('user' => $_SESSION['user']['username'], 'time' => time()));
break;
}
case "addlist":
{
$listname = filter_input(INPUT_POST, 'name');
$result = array('success' => lfl_add_list($_SESSION['user']['userId'], $listname));
break;
}
case "getlists":
{
$userId = $_SESSION['user']['userId'];
$s = lfl_get_user_lists($userId);
if($s)
{
$result = array('success' => true, 'data' => $s);
}
else
{
$result = array('success' => false);
}
break;
}
case "togglefav":
{
$listId = filter_input(INPUT_POST, 'listId', FILTER_VALIDATE_INT);
if($listId)
{
if(lfl_toggle_list_fav($listId)){
$result = array('success' => true);
}else{
$result = array('success' => false);
}
}
break;
}
default:
{
$result = 'error';
break;
}
}
echo json_encode($result);
exit();
}
}
echo json_encode('error');