Primo commit: trasferimento del progetto PPEasy
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// fillrisk.php
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id'], $_POST['field'], $_POST['value'])) {
|
||||
include '../Connections/cmctrfdb.php'; // Assicurati di avere un file per la connessione al database
|
||||
|
||||
$id = $_POST['id'];
|
||||
$field = $_POST['field'];
|
||||
$value = $_POST['value'];
|
||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||
// Sanifica il campo per sicurezza, e controlla che sia uno dei campi consentiti
|
||||
if (in_array($field, ['applicable', 'coveredby'])) {
|
||||
$stmt = $conn->prepare("UPDATE fillrisk_td SET $field = ? WHERE idfillrisk_td = ?");
|
||||
$stmt->bind_param("si", $value, $id);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->affected_rows > 0) {
|
||||
echo "Aggiornamento effettuato con successo";
|
||||
} else {
|
||||
echo "Nessun aggiornamento effettuato";
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
$conn->close();
|
||||
} else {
|
||||
// Gestire l'accesso non valido a questo file
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
echo "Accesso negato.";
|
||||
}
|
||||
Reference in New Issue
Block a user