D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
admin
/
services
/
Filename :
execute1.php
back
Copy
<?php include("../include/config.php"); include("../include/sessionhandle.php"); ########################################################################################## if(array_key_exists("add-new-services",$_REQUEST)){ // echo "sli"; die; $services_name = mysqli_real_escape_string($conn,$_POST['services_name']); $service_detail = mysqli_real_escape_string($conn,$_POST['service_detail']); $keyword = mysqli_real_escape_string($conn,$_POST['keyword']); $description = mysqli_real_escape_string($conn,$_POST['description']); $show_On_home_page = mysqli_real_escape_string($conn,$_POST['optradio']); $custo_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $string = strtoupper(substr("$services_name",0,3)); $queryID = "SELECT MAX(id) FROM `services`"; $resultID = mysqli_query($conn, $queryID); $rowID = mysqli_fetch_row($resultID); $cusID = $rowID[0] + 1; $serv_code = $string."".$cusID; $ser_url = create_slug($services_name); $custom_url = create_slug($custo_url); // $faqQuests = mysqli_real_escape_string($conn,$_POST['faqQuest']); // $faqAnss = mysqli_real_escape_string($conn,$_POST['faqAns']); $aa_faqq = str_replace("'","\'",$_POST['faqQuest']); $faqQuest = implode('--',$aa_faqq); $aa_faqa = str_replace("'","\'",$_POST['faqAns']); $faqAns = implode('--',$aa_faqa); // echo "faq ". $faqQuest; die; if(isset($_FILES['image_a']['name'])) { $fileName1 = time().$_FILES["image_a"]["name"]; $fileTmpLoc1 = $_FILES["image_a"]["tmp_name"]; $fileType1 = $_FILES["image_a"]["type"]; $fileSize1 = $_FILES["image_a"]["size"]; $fileErrorMsg1 = $_FILES["image_a"]["error"]; $kaboom1 = explode(".", $fileName1); $fileExt1 = end($kaboom1); $moveResult1 = move_uploaded_file($fileTmpLoc1, "upload/$fileName1"); } $query = "INSERT INTO `services`(`name`, `detail`, `image`, `service_code`, `url`, `custom_url`, `meta_title`, `keyword`, `description`, `show_On_home_page`, `faqQuestion`, `faqAanswer`, `status`) VALUES ('$services_name', '$service_detail', '$fileName1', '$serv_code', '$ser_url', '$custom_url', '$meta_title', '$keyword', '$description', '$show_On_home_page', '$faqQuest', '$faqAns', 'active');"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'services/view-services.php'); } else { echo "qu faild to update data"; } mysqli_close($conn); } ################################################################################### //For update Data if(array_key_exists("update-services",$_REQUEST)){ // echo "update_blogs_de tails"; die; $service_id = mysqli_real_escape_string($conn,$_POST['service_id']); $service_images = mysqli_real_escape_string($conn,$_POST['service_images']); $services_name = mysqli_real_escape_string($conn,$_POST['services_name']); $service_details = mysqli_real_escape_string($conn,$_POST['service_detail']); $keyword = mysqli_real_escape_string($conn,$_POST['keyword']); $description = mysqli_real_escape_string($conn,$_POST['description']); $show_On_home_page = mysqli_real_escape_string($conn,$_POST['optradio']); $customs_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $url = create_slug($services_name); $custom_url = create_slug($customs_url); $aa_faqq = str_replace("'","\'",$_POST['faqQuest']); $faqQuest = implode('--',$aa_faqq); $aa_faqa = str_replace("'","\'",$_POST['faqAns']); $faqAns = implode('--',$aa_faqa); // echo "faq ". $faqQuest; die; if(isset($_FILES['image_a']['name'])) { $fileName1 = time().$_FILES["image_a"]["name"]; $fileTmpLoc1 = $_FILES["image_a"]["tmp_name"]; $fileType1 = $_FILES["image_a"]["type"]; $fileSize1 = $_FILES["image_a"]["size"]; $fileErrorMsg1 = $_FILES["image_a"]["error"]; $kaboom1 = explode(".", $fileName1); $fileExt1 = end($kaboom1); $moveResult1 = move_uploaded_file($fileTmpLoc1, "upload/$fileName1"); } if(empty($_FILES['image_a']['name'])) { $fileName1 = $service_images; } $query1 = "UPDATE `services` SET `name` = '$services_name', `detail` = '$service_details', `image` = '$fileName1', `url` = '$url', `custom_url` = '$custom_url', `meta_title` = '$meta_title', `keyword` = '$keyword', `description` = '$description', `show_On_home_page` = '$show_On_home_page', `faqQuestion` = '$faqQuest', `faqAanswer` = '$faqAns' WHERE `services`.`id` = $service_id"; // echo $query1; die; if (mysqli_query($conn, $query1)) { echo "<script>window.location.href='view-services.php';</script>"; exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## ########################################################################################## // status active data if(array_key_exists("status_active_services",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `services` SET `status` = 'active' WHERE `services`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'services/view-services.php'); } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status deactive data if(array_key_exists("status_deactive_services",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `services` SET `status` = 'deactive' WHERE `services`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'services/view-services.php'); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For detete data if(array_key_exists("delete_services",$_REQUEST)){ $t_id = $_GET['id']; // echo $t_id; die; $sqlAssign1 = "SELECT * FROM `services` WHERE `services`.`id` = '$t_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $s_img = $rows['image']; } } $query="DELETE FROM `services` WHERE `services`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { unlink("upload/$s_img"); header("location:". $admin_baseurl . 'services/view-services.php'); } else { include('include/error-modal.php'); } mysqli_close($conn); } ?>