-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetData.php
More file actions
48 lines (34 loc) · 876 Bytes
/
Copy pathGetData.php
File metadata and controls
48 lines (34 loc) · 876 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
39
40
41
42
43
44
45
46
47
48
<?php
$con=mysql_connect("localhost","snapxyco_kh","qwe123qwe123");
if(!$con)
{
die('Error 1 :'.mysql_error());
}
mysql_select_db("beacondemo",$con);
$sql="INSERT INTO beacon_info(uuid,major,minor,regid)
VALUES
('$_POST[uuid]','$_POST[major]','$_POST[minor]','$_POST[regid]')";
$files = glob('image/*.*');
$file = array_rand($files);
// echo $files[$file];
$json = array();
$json[] = array(
'uuid' => $_POST[uuid],
'major' => $_POST[major],
'minor' => $_POST[minor],
'regid' => $_POST[regid],
'isDetectBeacon' => $_POST[isDetectBeacon],
'Image_URL'=>$files[$file],
'Message'=> 'Discount 30 %'
);
if(!mysql_query($sql,$con))
{
//die('Error 2 :'.mysql_error());
echo json_encode($json, JSON_UNESCAPED_SLASHES);
}
else
{
echo json_encode($json, JSON_UNESCAPED_SLASHES);
}
mysql_close($con);
?>