fixed photo quotations

This commit is contained in:
Claudio 2025-09-22 11:22:05 +02:00
parent df5e6d5656
commit 57ddd4bb5a

View File

@ -8,8 +8,8 @@ $file = $_FILES['file'] ?? null;
$filename = $_POST['filename'] ?? null;
$idquotations = $_POST['idquotations'] ?? null;
if (!$file || !$filename || !$idquotations) {
echo json_encode(['success' => false, 'message' => 'Dati mancanti']);
if (!$file || !$filename || !$idquotations || !isset($iduserlogin)) {
echo json_encode(['success' => false, 'message' => 'Dati mancanti o utente non autenticato']);
exit;
}
@ -32,7 +32,7 @@ if (!in_array($file['type'], $allowedTypes)) {
try {
$dbHandler = DBHandlerSelect::getInstance();
$pdo = $dbHandler->getConnection();
$stmt = $pdo->prepare("SELECT idquotations FROM quotations WHERE idquotations = :idquotations");
$stmt = $pdo->prepare("SELECT id FROM quotations WHERE id = :idquotations");
$stmt->execute([':idquotations' => $idquotations]);
if (!$stmt->fetch()) {
echo json_encode(['success' => false, 'message' => 'idquotations non valido']);