-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostdata.php
More file actions
38 lines (31 loc) · 758 Bytes
/
Copy pathpostdata.php
File metadata and controls
38 lines (31 loc) · 758 Bytes
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
<?php
// Grava no banco de dados os dados enviados pelo Android.
// ============================
// autor: Thiago Silva
// data: 08/05/2013
// timzone
date_default_timezone_set('America/Sao_Paulo');
setlocale (LC_ALL, 'pt_BR');
include 'db.php';
header('Content-Type', 'application/json');
if ($_POST && (isset($_POST['api']) && $_POST['api'] == 'teste'))
{
$sql = sprintf("INSERT
INTO
coordenadas(telefone, longitude, latitude, data_registro)
VALUES
(?, ?, ?, '%s');", date('Y-m-d H:i:s'));
$stmt = $db->prepare($sql);
$stmt->execute(array(
$_POST['telefone'],
$_POST['longitude'],
$_POST['latitude'])
);
$return = "true";
}
else
{
$return = "false";
}
// json return
echo json_encode(array('result' => $return));