-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.php
51 lines (46 loc) · 1.12 KB
/
store.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
<?php
require 'config.php';
# connect to DB
$connection = pg_connect($DBconnectionString);
# get the GET variables. We know what to expect, so
# there is little checking needed
$od_id = pg_escape_literal($_POST['od_id']);
$session_id = pg_escape_literal($_POST['session_id']);
$load_time = pg_escape_literal($_POST['load_time']);
$start_time = pg_escape_literal($_POST['start_time']);
$end_time = pg_escape_literal($_POST['end_time']);
$zoom_level = pg_escape_literal($_POST['zoom_level']);
$trace = pg_escape_string($_POST['trace']);
$map_extent = pg_escape_string($_POST['map_extent']);
$min_opacity = pg_escape_string($_POST['min_opacity']);
# select a random row
$query = "
INSERT INTO map_speed_results
(
od_id,
session_id,
trace,
map_extent,
load_time,
start_time,
end_time,
zoom_level,
min_opacity
)
VALUES
(
$od_id,
$session_id,
ST_GeomFromText('$trace',4326),
ST_GeomFromText('$map_extent',4326),
$load_time,
$start_time,
$end_time,
$zoom_level,
$min_opacity
);
";
$result = pg_query($connection,$query);
# close the connection
pg_close($connection);
?>