Mon, 20 Jan 2020 20:19:08 +0100
Checklist character encoding fixes.
570
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | require_once('config.php'); |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | #Connect to the database |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | $connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME); |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | if (! $connect) { |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | } |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | mysqli_set_charset($connect, "utf8" ); |
578
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
10 | $sql = ""; |
570
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | |
578
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
12 | if (isset($_POST['beername']) && isset($_POST['beercode']) && isset($_POST['beeruuid'])) { |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
13 | $sql = "UPDATE `mon_ispindels` SET "; |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
14 | $sql .= "beername='" . mysqli_real_escape_string($connect, $_POST['beername']); |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
15 | $sql .= "', beercode='" . mysqli_real_escape_string($connect, $_POST['beercode']); |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
16 | $sql .= "', beeruuid='" . mysqli_real_escape_string($connect, $_POST['beeruuid']); |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
17 | $sql .= "' WHERE uuid='" . $_POST['uuid'] . "';"; |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
18 | } else if (isset($_POST['mode'])) { |
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
19 | $sql = "UPDATE `mon_ispindels` SET mode='" .$_POST['mode'] . "' WHERE uuid='" . $_POST['uuid'] . "';"; |
593 | 20 | } else { |
21 | syslog(LOG_NOTICE, "cmd_ispindel: unknown POST"); | |
578
e75ce5bbda73
Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents:
570
diff
changeset
|
22 | } |
570
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | $result = mysqli_query($connect, $sql); |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | if (! $result) { |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | syslog(LOG_NOTICE, "cmd_ispindel: result: ".mysqli_error($connect)); |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | } |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | echo $result; |
c8a20234d7e7
Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | ?> |