%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_7c8ed5ef/admin/manage_clients/ |
Upload File : |
<?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'];
?>
<!-- [ 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> Update Clients</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> <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> <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 clients_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">Content1</label>
<textarea name="content1" class="form-control"><?php if($id!=''){ echo $fetchData['content1']; } ?></textarea>
</div>
</div> -->
<!-- <div class="gap-2" id="input-container">
<div class="row">
<div class="col-lg-10">
<h5>Content Atb</h5>
<textarea rows="3" name="content1_atb" class="form-control" id="content_atb"><?php if($id!=''){ echo $fetchData['content1_atb']; } ?></textarea>
</div>
<div class="col-lg-2">
<h5>Add Content Atb</h5>
<a id="myButton" class="bg-success form-control text-center text-white fw-bold mt-1 mb-2">Add More</a>
</div>
</div>
</div>
-->
<!-- Muliple Product images color etc start edit --->
<!-- <?php
$attribute=mysqli_query($conn,"SELECT * FROM `project_content_atb_tbl` WHERE project_id='".$_REQUEST['id']."'");
if(mysqli_num_rows($attribute)>0){ ?>
<?php
$Atb=mysqli_query($conn,"SELECT * FROM `project_content_atb_tbl` WHERE project_id='".$_REQUEST['id']."'");
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-10">
<h4>Content Atb</h4>
<input type="text" name="content_edit_atb[]" class="form-control" value="<?=$row["content_atb"];?>">
</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 } ?> -->
<!-- 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/Clients/'.$fetchData['image1'].'" 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=clients">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> -->
<?php
if (isset($_POST['edit'])) {
// $title=$_POST['title'];
// $title=str_replace("'", "\'", $title);
// $title=$_POST['title'];
// $title=str_replace("'", "\'", $title);
// $content1=$_POST['content1'];
// $content1=str_replace("'","\'",$content1);
// $content1_atb=$_POST['content1_atb'];
// $content1_atb=str_replace("'","\'",$content1_atb);
// $title3=$_POST['title3'];
// $title3=str_replace("'","\'",$title3);
// $content1=$_POST['content1'];
// $content1=str_replace("'", "\'", $content1);
// $content2=$_POST['content2'];
// $content2=str_replace("'", "\'", $content2);
$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/Clients/" . $new_file_name;
if (move_uploaded_file($file_tmp, $file_path)) {
$dlt = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `clients_tbl` WHERE id = '" . $_REQUEST['id'] . "'"));
$dlt_path = "../../images/Upload/Clients/" . $dlt['image1'];
if (file_exists($dlt_path)) {
unlink($dlt_path);
}
$sql = mysqli_query($conn, "UPDATE `clients_tbl` SET `image1` = '$new_file_name' WHERE id = '" . $_REQUEST['id'] . "'");
}
}
// Update popular_packages_tbl content
mysqli_query($conn, "UPDATE `clients_tbl` SET
`status`='$status' WHERE
`id` = '" . $_REQUEST['id'] . "'");
echo "<script>window.location='show.php?page=proj';</script>";
$_SESSION['message']="Service Updated successfully";
}
?>