prepare($sql);
$stmt->execute([$id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row) {
if (strpos($row['picurl'], '/System/') === 0) {
$delfile = $_SERVER['DOCUMENT_ROOT'] . $row['picurl'];
if (file_exists($delfile)) {
unlink($delfile);
}
}
$sql = "DELETE FROM pic WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->execute([$id]);
}
}
}
header("Location: ?Keys=$keys&Ord=$ord&Page=$page&cpid=$cpid");
exit;
}
$cpid = $_GET['cpid'] ?? '';
$page = $_GET['Page'] ?? '';
$keys = urlencode($_GET['Keys'] ?? '');
$ord = urlencode($_GET['Ord'] ?? '');
if ($cpid == "" || !is_numeric($cpid)) {
header("Location: protector.php");
exit;
}
$sql = "SELECT id, picurl FROM pic WHERE cpid = ? ORDER BY id DESC";
$stmt = $conn->prepare($sql);
$stmt->execute([$cpid]);
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>