forked from bferster/VisualEyes-5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdata.php
31 lines (27 loc) · 1.21 KB
/
getdata.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
<?php
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Expires: Sun, 01 Jul 2005 00:00:00 GMT');
header('Pragma: no-cache');
require_once('config.php');
$type="KML"; // Default to KML
if (isSet($_REQUEST['type'])) // If set
$type=addslashes($_REQUEST['type']); // Get type
$query="SELECT * FROM qdata WHERE type = '$type'"; // Query start
if (isSet($_REQUEST['email'])) // If set
$query.=" AND email = '".addslashes($_REQUEST['email'])."' ORDER by date DESC"; // WHERE email search
$result=mysql_query($query); // Query
if ($result == false) { // Bad query
print("-1\n"); // Return error
exit(); // Quit
}
$num=mysql_numrows($result); // Get num rows
print("popListFiles([\n"); // Function
for ($i=0;$i<$num;$i++) { // For each row
print("{\"id\":\"".mysql_result($result,$i,"id")."\","); // Id
print("\"title\":\"".mysql_result($result,$i,"title")."\","); // Title
print("\"date\":\"".mysql_result($result,$i,"date")."\"}"); // Date
if ($i != $num-1) print(",\n"); // Comma
}
print("\n])"); // Close function
mysql_close(); // Close session
?>