prepare($sql); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $sql = "UPDATE allowip SET IPAddress = ? WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("si", $IPAddress, $id); $stmt->execute(); } else { $sql = "INSERT INTO allowip (IPAddress) VALUES (?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("s", $IPAddress); $stmt->execute(); } $page = $_GET['Page'] ?? ''; $keys = urlencode($_GET['Keys'] ?? ''); $ord = urlencode($_GET['Ord'] ?? ''); header("Location: ?keys=$keys&Ord=$ord&Page=$page"); exit; } else { $sql = "INSERT INTO allowip (IPAddress) VALUES (?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("s", $IPAddress); $stmt->execute(); header("Location: ?"); exit; } } if ($act == "postchk") { $keys = urlencode($_GET['Keys'] ?? ''); $ord = urlencode($_GET['Ord'] ?? ''); $page = $_GET['Page'] ?? ''; if (isset($_POST['chkbox']) && is_array($_POST['chkbox'])) { $ids = array_map('intval', $_POST['chkbox']); $sql = "DELETE FROM allowip WHERE id IN (" . implode(',', array_fill(0, count($ids), '?')) . ")"; $types = str_repeat('i', count($ids)); $stmt = $conn->prepare($sql); $stmt->bind_param($types, ...$ids); $stmt->execute(); } header("Location: ?Keys=$keys&Ord=$ord&Page=$page"); exit; } ?>