<?php
require __DIR__ . '/_bootstrap.php';
$id = (int)($_GET['id'] ?? 0);
$full = trim($_POST['full_name'] ?? '');
$email = trim($_POST['email'] ?? '');
$pass  = $_POST['password'] ?? '';
$params = [$full,$email];
$sql = "UPDATE admins SET full_name=?, email=?";
if ($pass) { $sql .= ", password_hash=?"; $params[] = password_hash($pass, PASSWORD_DEFAULT); }
$sql .= " WHERE id=?";
$params[] = $id;
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
header('Location: ' . url_for('/admin/admins.php'));
