added api
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include('include/headscript.php');
|
||||
|
||||
$dbHandler = DBHandlerSelect::getInstance();
|
||||
$pdo = $dbHandler->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()]);
|
||||
}
|
||||
Reference in New Issue
Block a user