-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelayDemoStop.php
More file actions
44 lines (35 loc) · 1.09 KB
/
relayDemoStop.php
File metadata and controls
44 lines (35 loc) · 1.09 KB
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
<?php
header("Content-type:application/json");
$_SERVER['CONTENT_TYPE'] = "application/x-www-form-urlencoded";
error_reporting (E_ALL ^ E_WARNING && E_NOTICE);
//Response class
class DemoStartResponse {
var $successful;
function __construct () {
$this->successful = false;
}
}
//Connection properties
$servername = "localhost";
$username = "root";
$password = "admin";
//Create connection
$conn = new mysqli($servername, $username, $password);
//Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//Run query for inserting values to room status table for demo
$demoStopQuery = "TRUNCATE db_classroom_management.tbl_room_status";
$demoStopQueryReult = mysqli_query($conn, $demoStopQuery);
//Handle inserting values to room status table for demo response
$numberOfRows = mysqli_num_rows($demoStartQueryResult);
$response = new DemoStartResponse();
//Check if query worked properly
if ($demoStartQueryResult == true) {
$response->successful = true;
} else {
$response->roomIsActive = false;
}
echo json_encode($response);
?>