diff --git a/public/photostrf/296-20250509071709-images.jpg b/public/photostrf/296-20250509071709-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/296-20250509071709-images.jpg differ
diff --git a/public/photostrf/298-20250509072550-images.jpg b/public/photostrf/298-20250509072550-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/298-20250509072550-images.jpg differ
diff --git a/public/photostrf/300-20250509081112-images.jpg b/public/photostrf/300-20250509081112-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/300-20250509081112-images.jpg differ
diff --git a/public/photostrf/302-20250509081917-images.jpg b/public/photostrf/302-20250509081917-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/302-20250509081917-images.jpg differ
diff --git a/public/photostrf/304-20250509082403-images.jpg b/public/photostrf/304-20250509082403-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/304-20250509082403-images.jpg differ
diff --git a/public/photostrf/306-20250509083003-images.jpg b/public/photostrf/306-20250509083003-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/306-20250509083003-images.jpg differ
diff --git a/public/photostrf/308-20250509084245-images.jpg b/public/photostrf/308-20250509084245-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/308-20250509084245-images.jpg differ
diff --git a/public/photostrf/310-20250509085003-images.jpg b/public/photostrf/310-20250509085003-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/310-20250509085003-images.jpg differ
diff --git a/public/photostrf/312-20250509090555-images.jpg b/public/photostrf/312-20250509090555-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/312-20250509090555-images.jpg differ
diff --git a/public/photostrf/314-20250509112753-images.jpg b/public/photostrf/314-20250509112753-images.jpg
new file mode 100644
index 0000000..78882ed
Binary files /dev/null and b/public/photostrf/314-20250509112753-images.jpg differ
diff --git a/public/photostrf/annotated/aaaaphoto_296_2025-05-09T07-18-45-278Z_2025-05-09T07-18-45-278Z.png b/public/photostrf/annotated/aaaaphoto_296_2025-05-09T07-18-45-278Z_2025-05-09T07-18-45-278Z.png
new file mode 100644
index 0000000..92cf250
Binary files /dev/null and b/public/photostrf/annotated/aaaaphoto_296_2025-05-09T07-18-45-278Z_2025-05-09T07-18-45-278Z.png differ
diff --git a/public/photostrf/annotated/eeephoto_312_2025-05-09T09-09-18-509Z_2025-05-09T09-09-18-509Z.png b/public/photostrf/annotated/eeephoto_312_2025-05-09T09-09-18-509Z_2025-05-09T09-09-18-509Z.png
new file mode 100644
index 0000000..c2c57f7
Binary files /dev/null and b/public/photostrf/annotated/eeephoto_312_2025-05-09T09-09-18-509Z_2025-05-09T09-09-18-509Z.png differ
diff --git a/public/photostrf/annotated/photo_314_2025-05-09T13-07-08-581Z_2025-05-09T13-07-08-581Z.png b/public/photostrf/annotated/photo_314_2025-05-09T13-07-08-581Z_2025-05-09T13-07-08-581Z.png
new file mode 100644
index 0000000..b46e56b
Binary files /dev/null and b/public/photostrf/annotated/photo_314_2025-05-09T13-07-08-581Z_2025-05-09T13-07-08-581Z.png differ
diff --git a/public/photostrf/qrcodes/qrcode_296.png b/public/photostrf/qrcodes/qrcode_296.png
new file mode 100644
index 0000000..d77fe98
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_296.png differ
diff --git a/public/photostrf/qrcodes/qrcode_298.png b/public/photostrf/qrcodes/qrcode_298.png
new file mode 100644
index 0000000..4b73509
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_298.png differ
diff --git a/public/photostrf/qrcodes/qrcode_300.png b/public/photostrf/qrcodes/qrcode_300.png
new file mode 100644
index 0000000..4b5b3bf
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_300.png differ
diff --git a/public/photostrf/qrcodes/qrcode_302.png b/public/photostrf/qrcodes/qrcode_302.png
new file mode 100644
index 0000000..9893564
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_302.png differ
diff --git a/public/photostrf/qrcodes/qrcode_304.png b/public/photostrf/qrcodes/qrcode_304.png
new file mode 100644
index 0000000..ea409d8
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_304.png differ
diff --git a/public/photostrf/qrcodes/qrcode_306.png b/public/photostrf/qrcodes/qrcode_306.png
new file mode 100644
index 0000000..8b831c9
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_306.png differ
diff --git a/public/photostrf/qrcodes/qrcode_308.png b/public/photostrf/qrcodes/qrcode_308.png
new file mode 100644
index 0000000..45512e7
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_308.png differ
diff --git a/public/photostrf/qrcodes/qrcode_310.png b/public/photostrf/qrcodes/qrcode_310.png
new file mode 100644
index 0000000..15d4047
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_310.png differ
diff --git a/public/photostrf/qrcodes/qrcode_312.png b/public/photostrf/qrcodes/qrcode_312.png
new file mode 100644
index 0000000..16d257e
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_312.png differ
diff --git a/public/photostrf/qrcodes/qrcode_314.png b/public/photostrf/qrcodes/qrcode_314.png
new file mode 100644
index 0000000..2895bf1
Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_314.png differ
diff --git a/public/userarea/auth_proxy.php b/public/userarea/auth_proxy.php
new file mode 100644
index 0000000..b844a7b
--- /dev/null
+++ b/public/userarea/auth_proxy.php
@@ -0,0 +1,83 @@
+ 'WebApiUser',
+ 'Password' => 'webapiuser01'
+];
+
+// Inizializza cURL
+$ch = curl_init($api_url);
+
+// Configura le opzioni di cURL
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_POST, true);
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($credentials));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'User-Agent: Mozilla/5.0 (compatible; PHP cURL)'
+]);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL (solo test)
+curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host (solo test)
+curl_setopt($ch, CURLOPT_VERBOSE, true); // Abilita debug
+$log = fopen('curl_debug.log', 'a'); // Usa 'a' per appendere al log
+
+// Gestione degli errori di apertura del file di log
+if ($log === false) {
+ http_response_code(500);
+ echo json_encode([
+ 'error' => 'Impossibile aprire il file di log per il debug'
+ ]);
+ exit;
+}
+curl_setopt($ch, CURLOPT_STDERR, $log);
+
+// Esegui la richiesta
+$response = curl_exec($ch);
+$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+$curl_error = curl_error($ch);
+
+fclose($log);
+
+// Log della risposta per debug
+file_put_contents('curl_response.log', "HTTP Code: $http_code\nResponse: $response\n\n", FILE_APPEND);
+
+// Verifica errori di esecuzione cURL
+if ($response === false) {
+ http_response_code($http_code ? $http_code : 500);
+ echo json_encode([
+ 'error' => 'Errore nella richiesta API',
+ 'http_code' => $http_code,
+ 'curl_error' => $curl_error
+ ]);
+ curl_close($ch);
+ exit;
+}
+
+// Rimuovi eventuali virgolette e spazi dalla risposta
+$trimmed_response = trim($response, '" \t\n\r\0\x0B');
+
+// Se la risposta è una stringa non vuota, considerala il token
+if (is_string($trimmed_response) && !empty($trimmed_response)) {
+ http_response_code($http_code);
+ echo json_encode(['token' => $trimmed_response]);
+} else {
+ // Tenta di decodificare la risposta come JSON
+ $decoded = json_decode($response, true);
+ if (json_last_error() === JSON_ERROR_NONE && isset($decoded['token']) && is_string($decoded['token']) && !empty($decoded['token'])) {
+ http_response_code($http_code);
+ echo json_encode(['token' => $decoded['token']]);
+ } else {
+ http_response_code($http_code);
+ echo json_encode([
+ 'error' => 'Risposta non valida o token non trovato',
+ 'http_code' => $http_code,
+ 'response' => substr($response, 0, 1000)
+ ]);
+ }
+}
+
+curl_close($ch);
diff --git a/public/userarea/class/connectapi.php b/public/userarea/class/connectapi.php
new file mode 100644
index 0000000..f9905a8
--- /dev/null
+++ b/public/userarea/class/connectapi.php
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+ VisualLims Authentication
+
+
+
+
+ VisualLims Authentication
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/userarea/connectapi.php b/public/userarea/connectapi.php
new file mode 100644
index 0000000..41252b9
--- /dev/null
+++ b/public/userarea/connectapi.php
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+ Autenticazione e Recupero Clienti VisualLims
+
+
+
+
+ Autenticazione e Recupero Clienti VisualLims
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/userarea/curl_debug.log b/public/userarea/curl_debug.log
new file mode 100644
index 0000000..08b8b1a
--- /dev/null
+++ b/public/userarea/curl_debug.log
@@ -0,0 +1,302 @@
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: iftm.it]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: iftm.it
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:34:52 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 83.149.157.58:443...
+* Connected to iftm.it (83.149.157.58) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: CN=*.iftm.it
+* start date: Oct 8 07:42:11 2024 GMT
+* expire date: Oct 8 07:42:11 2025 GMT
+* issuer: C=IT; ST=Bergamo; L=Ponte San Pietro; O=Actalis S.p.A.; CN=Actalis Domain Validation Server CA G3
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://iftm.it/visuallimswebapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: iftm.it]
+* [HTTP/2] [1] [:path: /visuallimswebapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 64]
+> POST /visuallimswebapi/api/authentication/authenticate HTTP/2
+Host: iftm.it
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 64
+
+< HTTP/2 401
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< date: Tue, 03 Jun 2025 09:41:50 GMT
+<
+* Connection #0 to host iftm.it left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:43:41 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:45:25 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:47:45 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:48:27 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:50:49 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
+* Trying 93.43.5.102:443...
+* Connected to 93.43.5.102 (93.43.5.102) port 443
+* ALPN: curl offers h2,http/1.1
+* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
+* ALPN: server accepted h2
+* Server certificate:
+* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
+* start date: Feb 17 00:00:00 2025 GMT
+* expire date: Feb 17 23:59:59 2026 GMT
+* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
+* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
+* using HTTP/2
+* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
+* [HTTP/2] [1] [:method: POST]
+* [HTTP/2] [1] [:scheme: https]
+* [HTTP/2] [1] [:authority: 93.43.5.102]
+* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
+* [HTTP/2] [1] [content-type: application/json]
+* [HTTP/2] [1] [accept: application/json]
+* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
+* [HTTP/2] [1] [content-length: 51]
+> POST /limsapi/api/authentication/authenticate HTTP/2
+Host: 93.43.5.102
+Content-Type: application/json
+Accept: application/json
+User-Agent: Mozilla/5.0 (compatible; PHP cURL)
+Content-Length: 51
+
+< HTTP/2 200
+< cache-control: max-age=0
+< content-type: application/json; charset=utf-8
+< server: Microsoft-IIS/10.0
+< strict-transport-security: max-age=2592000
+< x-powered-by: ASP.NET
+< x-content-type-options: nosniff
+< date: Tue, 03 Jun 2025 09:55:50 GMT
+<
+* Connection #0 to host 93.43.5.102 left intact
diff --git a/public/userarea/curl_response.log b/public/userarea/curl_response.log
new file mode 100644
index 0000000..19d055d
--- /dev/null
+++ b/public/userarea/curl_response.log
@@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5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTc1MCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.FCAm5sWed1Q-QiIsctMgSBfEd4sfN3kfVR3Mqd3XQz0"
+
diff --git a/public/userarea/get_clienti.php b/public/userarea/get_clienti.php
new file mode 100644
index 0000000..ba91a75
--- /dev/null
+++ b/public/userarea/get_clienti.php
@@ -0,0 +1,50 @@
+
+ 'Errore nell\'autenticazione', 'http_code' => $http_code, 'response' => $response]);
+ exit;
+}
+
+$token = trim($response); // Rimuove spazi o newline dal token
+
+// Usa il token per richiedere la lista dei clienti
+$clienti_url = 'https://93.43.5.102/limsapi/api/odata/Cliente';
+$ch = curl_init($clienti_url);
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPGET, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer ' . $token,
+ 'Accept: application/json',
+ 'Host: iftm.it'
+]);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL
+curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host
+
+$response = curl_exec($ch);
+$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+$curl_error = curl_error($ch);
+curl_close($ch);
+
+if ($http_code != 200) {
+ echo json_encode(['error' => 'Errore nella richiesta dei clienti', 'http_code' => $http_code, 'curl_error' => $curl_error, 'response' => $response]);
+} else {
+ echo $response; // Restituisce la lista completa dei clienti in JSON
+}
+?>
diff --git a/public/userarea/imported_trf/1-20250509104938-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx b/public/userarea/imported_trf/1-20250509104938-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx
new file mode 100644
index 0000000..8c3b7e0
Binary files /dev/null and b/public/userarea/imported_trf/1-20250509104938-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx differ
diff --git a/public/userarea/imported_trf/1-20250509132735-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx b/public/userarea/imported_trf/1-20250509132735-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx
new file mode 100644
index 0000000..8c3b7e0
Binary files /dev/null and b/public/userarea/imported_trf/1-20250509132735-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx differ
diff --git a/public/userarea/imported_trf/1-20250528112950-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx b/public/userarea/imported_trf/1-20250528112950-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx
new file mode 100644
index 0000000..8c3b7e0
Binary files /dev/null and b/public/userarea/imported_trf/1-20250528112950-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx differ
diff --git a/public/userarea/imported_trf/1-20250529101051-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx b/public/userarea/imported_trf/1-20250529101051-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx
new file mode 100644
index 0000000..8c3b7e0
Binary files /dev/null and b/public/userarea/imported_trf/1-20250529101051-MONCLER TRF - 21.11.2024_CHIARA_SS25_2C PER PELLI.xlsx differ
diff --git a/public/userarea/load_photo.php b/public/userarea/load_photo.php
new file mode 100644
index 0000000..34ca8e2
--- /dev/null
+++ b/public/userarea/load_photo.php
@@ -0,0 +1,29 @@
+getConnection();
+
+$iddatadb = $_GET['iddatadb'] ?? null;
+
+if (!$iddatadb) {
+ echo json_encode(['success' => false, 'message' => 'ID TRF mancante']);
+ exit;
+}
+
+try {
+ $stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb LIMIT 1");
+ $stmt->execute([':iddatadb' => $iddatadb]);
+ $photo = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($photo && $photo['file_path']) {
+ $fullPath = '../photostrf/' . $photo['file_path']; // Assumi che le foto siano nella cartella photostrf
+ echo json_encode(['success' => true, 'file_path' => $fullPath]);
+ } else {
+ echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
+ }
+} catch (PDOException $e) {
+ echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]);
+}
diff --git a/public/userarea/modal_parts.php b/public/userarea/modal_parts.php
index d0c12b4..6ea998c 100644
--- a/public/userarea/modal_parts.php
+++ b/public/userarea/modal_parts.php
@@ -7,29 +7,47 @@
-
+
+
+
+
Foto del Campione
+
+
![Foto del campione]()
+
+
+
+
+
+
@@ -50,7 +68,6 @@
#partsTable th {
padding: 0.2rem;
vertical-align: middle;
- /* Allinea verticalmente il contenuto */
}
#partsTable input {
@@ -71,4 +88,49 @@
width: 100% !important;
max-width: 100% !important;
}
+
+ #partsList .list-group-item {
+ cursor: pointer;
+ transition: background-color 0.2s;
+ }
+
+ #partsList .list-group-item:hover {
+ background-color: #f5f5f5;
+ }
+
+ .draggable-description {
+ position: absolute;
+ background: rgba(255, 255, 255, 0.8);
+ padding: 5px;
+ font-size: 10px;
+ font-family: Arial, sans-serif;
+ color: #000000;
+ cursor: move;
+ user-select: none;
+ z-index: 1000;
+ }
+
+ .draggable-marker {
+ position: absolute;
+ width: 16px;
+ height: 16px;
+ background: rgba(255, 0, 0, 0.5);
+ border: 1px solid #ff0000;
+ border-radius: 50%;
+ color: #ffffff;
+ text-align: center;
+ line-height: 16px;
+ font-size: 8px;
+ cursor: move;
+ user-select: none;
+ z-index: 1000;
+ }
+
+ #markerContainer {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ }
\ No newline at end of file
diff --git a/public/userarea/parts.js b/public/userarea/parts.js
index cc43652..9427811 100644
--- a/public/userarea/parts.js
+++ b/public/userarea/parts.js
@@ -17,11 +17,55 @@ $(document).ready(function () {
$("#trfHeader").text(`${iddatadb} - ${importRef} - ${description}`);
$("#partsModal").data("iddatadb", iddatadb);
+ loadPhoto(iddatadb);
loadExistingParts(iddatadb);
$("#partsModal").modal("show");
});
+ function loadPhoto(iddatadb) {
+ $.ajax({
+ url: "load_photo.php",
+ method: "GET",
+ data: { iddatadb: iddatadb },
+ success: function (response) {
+ if (response.success && response.file_path) {
+ const img = $("#samplePhoto");
+ img.attr("src", response.file_path);
+ img.on("load", function () {
+ const container = img.parent();
+ const canvas = document.getElementById("photoCanvas");
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const scaleX = containerWidth / img[0].naturalWidth;
+ const scaleY = containerHeight / img[0].naturalHeight;
+ const scale = Math.min(scaleX, scaleY);
+ canvas.width = img[0].naturalWidth * scale;
+ canvas.height = img[0].naturalHeight * scale;
+ canvas.style.width = `${containerWidth}px`;
+ canvas.style.height = `${containerHeight}px`;
+ const ctx = canvas.getContext("2d");
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.drawImage(
+ img.get(0),
+ 0,
+ 0,
+ canvas.width,
+ canvas.height,
+ );
+ updateMarkers();
+ });
+ } else {
+ $("#samplePhoto").attr("src", "");
+ alert("Nessuna foto trovata per questo TRF.");
+ }
+ },
+ error: function (xhr, status, error) {
+ alert("Errore nel caricamento della foto: " + error);
+ },
+ });
+ }
+
function addNewRow(nextPartNumber) {
const newRow = `
@@ -62,6 +106,7 @@ $(document).ready(function () {
.get(),
);
addNewRow(maxPartNumber + 1);
+ updatePartsList();
});
$(document).on("click", ".remove-row", function (e) {
@@ -71,7 +116,8 @@ $(document).ready(function () {
const partId = $row.data("part-id");
console.log("ID parte da eliminare:", partId);
- if (partId !== "new") {
+ if (partId !== "new" && partId !== undefined && partId !== null) {
+ console.log("Procedo con la cancellazione dal database");
$.ajax({
url: "delete_part.php",
method: "POST",
@@ -88,6 +134,8 @@ $(document).ready(function () {
if (response.success) {
$row.remove();
updateRowButtons();
+ updatePartsList();
+ clearCanvasMarkers();
} else {
alert("Errore nell'eliminazione: " + response.message);
}
@@ -105,8 +153,12 @@ $(document).ready(function () {
},
});
} else {
+ console.log(
+ 'Riga non salvata nel database (partId = "new" o non definito), rimuovo solo visivamente',
+ );
$row.remove();
updateRowButtons();
+ updatePartsList();
}
});
@@ -140,8 +192,16 @@ $(document).ready(function () {
contentType: "application/json",
success: function (response) {
if (response.success) {
+ if (response.part_id) {
+ $row.data("part-id", response.part_id);
+ console.log(
+ "Aggiornato partId della riga:",
+ response.part_id,
+ );
+ }
$saveLoading.hide();
$saveStatus.show();
+ updatePartsList();
setTimeout(() => $saveStatus.hide(), 2000);
} else {
alert("Errore nel salvataggio: " + response.message);
@@ -184,6 +244,7 @@ $(document).ready(function () {
addNewRow(1);
}
updateRowButtons();
+ updatePartsList();
} else {
alert(
"Errore nel caricamento delle parti: " +
@@ -199,6 +260,308 @@ $(document).ready(function () {
});
}
+ function updatePartsList() {
+ $("#partsList").empty();
+ $("#partsTableBody tr").each(function () {
+ const partNumber = $(this).find(".part-number").val();
+ const partDescription = $(this).find(".part-description").val();
+ if (partNumber && partDescription) {
+ const listItem = `${partNumber} - ${partDescription}`;
+ $("#partsList").append(listItem);
+ }
+ });
+ }
+
+ let selectedPartNumber = null;
+ let markers = [];
+ let descriptionPosition = { x: 10, y: 10 };
+ let hasDescriptions = false;
+
+ $("#partsList").on("click", "li", function () {
+ selectedPartNumber = $(this).data("part-number");
+ console.log("Part number selezionato:", selectedPartNumber);
+ $(this).addClass("active").siblings().removeClass("active");
+ });
+
+ const canvas = document.getElementById("photoCanvas");
+ const ctx = canvas.getContext("2d");
+
+ $("#markerContainer").on("click", function (e) {
+ console.log("Click sul markerContainer rilevato"); // Debug
+ if (selectedPartNumber !== null) {
+ const img = $("#samplePhoto");
+ const canvas = document.getElementById("photoCanvas");
+ const rect = canvas.getBoundingClientRect();
+ const container = img.parent();
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const scaleX = containerWidth / img.get(0).naturalWidth;
+ const scaleY = containerHeight / img.get(0).naturalHeight;
+ const scale = Math.min(scaleX, scaleY);
+ const x = (e.clientX - rect.left) / scale;
+ const y = (e.clientY - rect.top) / scale;
+
+ console.log("Coordinate cliccate (x, y):", x, y); // Debug
+
+ const existingMarker = markers.find(
+ (m) => m.partNumber == selectedPartNumber,
+ );
+ if (existingMarker) {
+ existingMarker.x = x;
+ existingMarker.y = y;
+ } else {
+ markers.push({ partNumber: selectedPartNumber, x, y });
+ }
+ console.log("Markers aggiornati:", markers); // Debug
+ updateMarkers();
+ if (hasDescriptions) {
+ drawDescriptions(descriptionPosition.x, descriptionPosition.y);
+ }
+ selectedPartNumber = null;
+ $("#partsList li").removeClass("active");
+ } else {
+ console.log("Nessun part number selezionato"); // Debug
+ }
+ });
+ function updateMarkers() {
+ const img = $("#samplePhoto");
+ const container = img.parent();
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const scaleX = containerWidth / img.get(0).naturalWidth;
+ const scaleY = containerHeight / img.get(0).naturalHeight;
+ const scale = Math.min(scaleX, scaleY);
+
+ const markerContainer = $("#markerContainer");
+ markerContainer.empty();
+
+ markers.forEach((marker) => {
+ const scaledX = marker.x * scale;
+ const scaledY = marker.y * scale;
+ console.log(
+ "Aggiungo marker:",
+ marker.partNumber,
+ "a posizione (scaledX, scaledY):",
+ scaledX,
+ scaledY,
+ ); // Debug
+ const $marker = $(
+ `${marker.partNumber}
`,
+ ).css({
+ left: scaledX - 8 + "px",
+ top: scaledY - 8 + "px",
+ });
+ markerContainer.append($marker);
+ makeDraggable($marker, marker, scale);
+ });
+ }
+
+ function makeDraggable($element, item, scale) {
+ let isDragging = false;
+ let currentX = parseFloat($element.css("left")) || 0;
+ let currentY = parseFloat($element.css("top")) || 0;
+ let initialX, initialY;
+
+ $element.on("mousedown", function (e) {
+ e.preventDefault();
+ isDragging = true;
+ initialX = e.clientX - currentX;
+ initialY = e.clientY - currentY;
+ $element.css("z-index", 1001);
+ });
+
+ $(document).on("mousemove", function (e) {
+ if (isDragging) {
+ e.preventDefault();
+ currentX = e.clientX - initialX;
+ currentY = e.clientY - initialY;
+ const container = $("#photoCanvas").parent();
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const maxX = containerWidth - $element.width();
+ const maxY = containerHeight - $element.height();
+
+ currentX = Math.max(0, Math.min(currentX, maxX));
+ currentY = Math.max(0, Math.min(currentY, maxY));
+
+ $element.css({
+ left: currentX + "px",
+ top: currentY + "px",
+ });
+
+ if (item.partNumber) {
+ // È un marker
+ item.x = (currentX + 8) / scale;
+ item.y = (currentY + 8) / scale;
+ } else {
+ // È la lista
+ descriptionPosition.x = (currentX + 5) / scale;
+ descriptionPosition.y = (currentY + 5) / scale;
+ }
+ }
+ });
+
+ $(document).on("mouseup", function () {
+ isDragging = false;
+ $element.css("z-index", 1000);
+ });
+ }
+
+ function drawDescriptions(x, y) {
+ const img = $("#samplePhoto");
+ const container = img.parent();
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const scaleX = containerWidth / img.get(0).naturalWidth;
+ const scaleY = containerHeight / img.get(0).naturalHeight;
+ const scale = Math.min(scaleX, scaleY);
+
+ const partsList = [];
+ $("#partsTableBody tr").each(function () {
+ const partNumber = $(this).find(".part-number").val();
+ const partDescription = $(this).find(".part-description").val();
+ if (partNumber && partDescription) {
+ partsList.push(`${partNumber} ${partDescription}`);
+ }
+ });
+
+ const descriptionList = $("#descriptionList");
+ descriptionList.empty();
+ descriptionList.css({
+ display: "block",
+ top: y * scale + "px",
+ left: x * scale + "px",
+ width: "200px",
+ });
+ partsList.forEach((part) => {
+ descriptionList.append(`${part}
`);
+ });
+
+ updateMarkers();
+ }
+
+ function clearCanvasMarkers() {
+ markers = [];
+ hasDescriptions = false;
+ $("#descriptionList").css("display", "none");
+ $("#markerContainer").empty();
+ const canvas = document.getElementById("photoCanvas");
+ const img = $("#samplePhoto");
+ const ctx = canvas.getContext("2d");
+ const container = img.parent();
+ const containerWidth = container.width();
+ const containerHeight = container.height();
+ const scaleX = containerWidth / img.get(0).naturalWidth;
+ const scaleY = containerHeight / img.get(0).naturalHeight;
+ const scale = Math.min(scaleX, scaleY);
+
+ canvas.width = img.get(0).naturalWidth * scale;
+ canvas.height = img.get(0).naturalHeight * scale;
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.drawImage(img.get(0), 0, 0, canvas.width, canvas.height);
+ }
+
+ $("#addDescriptionsBtn").on("click", function () {
+ hasDescriptions = true;
+ descriptionPosition = { x: 10, y: 10 };
+ drawDescriptions(descriptionPosition.x, descriptionPosition.y);
+ makeDraggable(
+ $("#descriptionList"),
+ descriptionPosition,
+ Math.min(
+ $("#photoCanvas").parent().width() /
+ $("#samplePhoto").get(0).naturalWidth,
+ $("#photoCanvas").parent().height() /
+ $("#samplePhoto").get(0).naturalHeight,
+ ),
+ );
+ });
+
+ $("#removeAnnotationsBtn").on("click", function () {
+ clearCanvasMarkers();
+ });
+
+ $("#savePhotoBtn").on("click", function () {
+ const canvas = document.getElementById("photoCanvas");
+ const img = $("#samplePhoto");
+ const ctx = canvas.getContext("2d");
+
+ canvas.width = img.get(0).naturalWidth;
+ canvas.height = img.get(0).naturalHeight;
+ ctx.drawImage(img.get(0), 0, 0);
+
+ const partsList = [];
+ $("#partsTableBody tr").each(function () {
+ const partNumber = $(this).find(".part-number").val();
+ const partDescription = $(this).find(".part-description").val();
+ if (partNumber && partDescription) {
+ partsList.push(`${partNumber} ${partDescription}`);
+ }
+ });
+
+ if (hasDescriptions) {
+ ctx.fillStyle = "rgba(255, 255, 255, 0.8)";
+ ctx.fillRect(
+ descriptionPosition.x,
+ descriptionPosition.y,
+ 200,
+ partsList.length * 12 + 10,
+ );
+ ctx.fillStyle = "#000000";
+ ctx.font = "10px Arial";
+ partsList.forEach((part, index) => {
+ ctx.fillText(
+ part,
+ descriptionPosition.x + 5,
+ descriptionPosition.y + 12 + index * 12,
+ );
+ });
+ }
+
+ markers.forEach((marker) => {
+ ctx.beginPath();
+ ctx.arc(marker.x, marker.y, 8, 0, 2 * Math.PI);
+ ctx.fillStyle = "rgba(255, 0, 0, 0.5)";
+ ctx.fill();
+ ctx.strokeStyle = "#ff0000";
+ ctx.lineWidth = 1;
+ ctx.stroke();
+ ctx.fillStyle = "#ffffff";
+ ctx.font = "bold 8px Arial";
+ ctx.textAlign = "center";
+ ctx.textBaseline = "middle";
+ ctx.fillText(marker.partNumber, marker.x, marker.y);
+ });
+
+ const dataURL = canvas.toDataURL("image/png");
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
+ const defaultName = `photo_${$("#partsModal").data("iddatadb")}_${timestamp}.png`;
+ const newName = prompt(
+ "Inserisci il nome del file (senza estensione):",
+ defaultName.split(".png")[0],
+ );
+ if (newName) {
+ const finalName = newName + "_" + timestamp + ".png";
+ $.ajax({
+ url: "save_annotated_photo.php",
+ method: "POST",
+ data: { dataURL: dataURL, filename: finalName },
+ success: function (response) {
+ if (response.success) {
+ alert(
+ "Foto salvata con successo: " + response.file_path,
+ );
+ } else {
+ alert("Errore nel salvataggio: " + response.message);
+ }
+ },
+ error: function (xhr, status, error) {
+ alert("Errore nel salvataggio della foto: " + error);
+ },
+ });
+ }
+ });
+
$(document).on("mouseenter", "tr", function () {
console.log("Mouse entrato su riga");
});
diff --git a/public/userarea/save_annotated_photo.php b/public/userarea/save_annotated_photo.php
new file mode 100644
index 0000000..244d36b
--- /dev/null
+++ b/public/userarea/save_annotated_photo.php
@@ -0,0 +1,25 @@
+ false, 'message' => 'Dati mancanti']);
+ exit;
+}
+
+try {
+ $data = explode(',', $dataURL)[1];
+ $decodedData = base64_decode($data);
+ $filePath = '../photostrf/annotated/' . $filename; // Crea una sottocartella 'annotated' per le foto modificate
+ if (!file_exists('../photostrf/annotated')) {
+ mkdir('../photostrf/annotated', 0777, true);
+ }
+ file_put_contents($filePath, $decodedData);
+ echo json_encode(['success' => true, 'file_path' => $filePath, 'message' => 'Foto salvata con successo']);
+} catch (Exception $e) {
+ echo json_encode(['success' => false, 'message' => 'Errore nel salvataggio: ' . $e->getMessage()]);
+}