-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsavedb.php
More file actions
21 lines (15 loc) · 813 Bytes
/
savedb.php
File metadata and controls
21 lines (15 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
if(isset($_POST)){
//include conn.php to get connection to the database
include "conn.php";
$Ax = mysqli_escape_string($mysqli,$_POST['Ax']);
$Ay = mysqli_escape_string($mysqli,$_POST['Ay']);
$Az = mysqli_escape_string($mysqli,$_POST['Az']);
//The problem is, I usually run MQTT protocol using my CMD while my wemos is connected in my laptop.
$comm = "C:\\Users\\ACER\\AppData\\Local\\Programs\\Python\\Python38\\python.exe C:\\xampp\\htdocs\\Internet of Things\\MQTTtest.py -x ".sprintf("%.2f", $Ax)." -y ".sprintf("%.2f", $Ay)." -z ".sprintf("%.2f", $Az);
//Is there any possible to bring CMD into website?
$label = shell_exec($comm);
$hasilquery = mysqli_query($mysqli,"INSERT INTO iot(Ax,Ay,Az,Label) VALUES ($Ax,$Ay,$Az,'$label')");
exit('Data Has Been Inserted');
}
?>