www/cmd_ispindel.php

Wed, 04 Mar 2020 10:48:21 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 04 Mar 2020 10:48:21 +0100
changeset 622
39902353b159
parent 593
e0230bf4ac3f
child 628
a42166cbb19a
permissions
-rw-r--r--

Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.

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
e0230bf4ac3f Less logging noise.
Michiel Broek <mbroek@mbse.eu>
parents: 578
diff changeset
20 } else {
e0230bf4ac3f Less logging noise.
Michiel Broek <mbroek@mbse.eu>
parents: 578
diff changeset
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 ?>

mercurial