%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_6ca89795/admin/ |
Upload File : |
<?php
include('../dbcon.php');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = intval($_POST['sid']);
$fields = [
'title1',
'address',
'email',
'email2',
'for_enquiry',
'about_details',
'contact_details',
'base_url',
'facebook',
'instagram',
'twitter',
'whatsapp',
'youtube'
];
$values = [];
$placeholders = [];
$types = '';
foreach ($fields as $field) {
if (!isset($_POST[$field])) {
echo "<script>
alert('Field $field is missing.');
window.history.back();
</script>";
exit;
}
$values[] = trim($_POST[$field]);
$placeholders[] = "`$field` = ?";
$types .= 's';
}
$values[] = $id;
$types .= 'i';
$sql = "UPDATE `app_setting` SET " . implode(', ', $placeholders) . " WHERE `id` = ?";
$stmt = $conn->prepare($sql);
if ($stmt) {
$stmt->bind_param($types, ...$values);
if ($stmt->execute()) {
echo "<script>
alert('Data Updated Successfully');
window.open('appsettingalldata.php', '_self');
</script>";
} else {
echo "<script>
alert('Failed to Update Data. Please try again.');
window.history.back();
</script>";
}
$stmt->close();
} else {
echo "<script>
alert('Failed to prepare the query.');
window.history.back();
</script>";
}
$conn->close();
} else {
echo "<script>
alert('Invalid Request Method.');
window.history.back();
</script>";
}
?>