-
Notifications
You must be signed in to change notification settings - Fork 1
/
all.json
41 lines (28 loc) · 996 Bytes
/
all.json
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
<?
// require local conf
require "plainnoteconf.php";
require "sqltojson.php";
// require the inspekt library
require "Inspekt/Inspekt.php";
// create a "SuperCage" to wrap all possible user input
// the SuperCage should be created before doing *anything* else
$input = Inspekt::makeSuperCage();
//ensure the user sent a user and pass
$username = $input->get->testEmail('username');
$account_id = $input->get->getRaw('account_id');
if (!$username && !$account_id) {
//bad user/account_id
echo json_encode(array ('authenticated'=>'false'));
}
else {
mysql_connect($dbHost,$dbUser,$dbPass);
@mysql_select_db($dbName) or die( "Unable to select database");
$query="SELECT lastmodified as last_modified ,note as content, noteguid as post_id from notes as n
inner join users as u on u.userpk=n.userpk
where deleted<>1 and guid='$account_id'";
$result=mysql_query($query);
echo sqltojson($result);
}
mysql_close();
//all done
?>