Primeiro commit
Signed-off-by: Rodrigo Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
commit
a1beb6a2e0
425 files changed
+193665
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// Verificar se o usuário está logado
|
||||
session_start();
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Conectar ao banco de dados
|
||||
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
|
||||
if ($mysqli->connect_error) {
|
||||
die("Connection failed: " . $mysqli->connect_error);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id']) && isset($_POST['note'])) {
|
||||
$note_id = $_POST['id'];
|
||||
$note = $_POST['note'];
|
||||
|
||||
$stmt = $mysqli->prepare("UPDATE notes SET note = ? WHERE id = ?");
|
||||
$stmt->bind_param("si", $note, $note_id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
echo "Nota atualizada com sucesso!";
|
||||
} else {
|
||||
echo "Dados inválidos.";
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
Reference in new issue
Block a user