www/includes/db_inventory_hops.php

changeset 785
aa79acfdf8a9
parent 767
08c0343b622b
--- a/www/includes/db_inventory_hops.php	Sun Feb 06 20:06:46 2022 +0100
+++ b/www/includes/db_inventory_hops.php	Thu Feb 10 22:15:10 2022 +0100
@@ -24,8 +24,14 @@
 	if (isset($_POST['update'])) {
 		$sql  = "UPDATE `inventory_hops` SET ";
 	}
-
-	$sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']);
+ 
+	if (isset($_POST['uuid']) && (strlen($_POST['uuid']) == 36)) {
+                $sql .= "uuid='" . $_POST['uuid'];
+        } else {
+                $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
+                $sql .= "uuid='" . $uuid;
+        }
+	$sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']);
 	$sql .= "', alpha='" . $_POST['alpha'];
 	$sql .= "', beta='" . $_POST['beta'];
 	$sql .= "', humulene='" . $_POST['humulene'];
@@ -83,6 +89,7 @@
 		$hops[] = array(
 			'record' => $row['record'],
 			'name' => $row['name'],
+			'uuid' => $row['uuid'],
 			'alpha' => $row['alpha'],
 			'beta' => $row['beta'],
 			'humulene' => $row['humulene'],

mercurial