D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
designpitara.com
/
admin
/
product
/
Filename :
execute-details.php
back
Copy
<?php error_reporting(0); include("../include/config.php"); ########################################################################################## //For Insert Data if(array_key_exists("add_product_details",$_REQUEST)){ // echo "add_blogs_details vvbgbh"; die; $productName = mysqli_real_escape_string($conn,$_POST['productName']); $custom_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $product_categ_id = mysqli_real_escape_string($conn,$_POST['product_categ_id']); $productPrice = mysqli_real_escape_string($conn,$_POST['productPrice']); $product_details = mysqli_real_escape_string($conn,$_POST['product_details']); $keyword = mysqli_real_escape_string($conn,$_POST['keyword']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $description = mysqli_real_escape_string($conn,$_POST['description']); if(empty($custom_url)){ $url = create_slug($productName); }else{ $url = create_slug($custom_url); } if(isset($_FILES['image_a']['name'])) { $fileName1 = $_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); $new_fileName = time().".".$fileExt1; $moveResult1 = move_uploaded_file($fileTmpLoc1, "upload/$new_fileName"); } $query="INSERT INTO `product`(`product_category_id`, `name`, `price`, `imge`, `details`, `url`, `meta_title`, `meta_desc`, `meta_keyword`, `status`) VALUES ('$product_categ_id', '$productName', '$productPrice', '$new_fileName', '$product_details', '$url', '$meta_title', '$description', '$keyword', 'active')"; // echo $query; die; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'product/'); exit; } else { include('include/error-modal.php'); echo "error"; } mysqli_close($conn); } ########################################################################################## //For update Data if(array_key_exists("update_product_details",$_REQUEST)){ // echo "update_blogs_de tails"; die; $productName = mysqli_real_escape_string($conn,$_POST['productName']); $custom_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $product_categ_id = mysqli_real_escape_string($conn,$_POST['product_categ_id']); $productPrice = mysqli_real_escape_string($conn,$_POST['productPrice']); $product_details = mysqli_real_escape_string($conn,$_POST['product_details']); $keyword = mysqli_real_escape_string($conn,$_POST['keyword']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $description = mysqli_real_escape_string($conn,$_POST['description']); $pro_id = mysqli_real_escape_string($conn,$_POST['productId']); $old_img = mysqli_real_escape_string($conn,$_POST['product_images']); if(empty($custom_url)){ $url = create_slug($productName); }else{ $url = create_slug($custom_url); } $sqlAssign1 = "SELECT * FROM `product` WHERE `product`.`id` = '$pro_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $pblogs_img = $rows['imge']; } } if(isset($_FILES['image_a']['name'])) { $fileName1 = $_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); $new_fileName = time().".".$fileExt1; $moveResult1 = move_uploaded_file($fileTmpLoc1, "upload/$new_fileName"); } if(empty($_FILES['image_a']['name'])) { $new_fileName = $old_img; }else{ unlink("upload/$pblogs_img"); } $query1 = "UPDATE `product` SET `product_category_id` ='$product_categ_id',`name` = '$productName', `price` = '$productPrice', `imge` = '$new_fileName', `details` = '$product_details', `url` = '$url', `meta_title` = '$meta_title', `meta_desc` = '$description', `meta_keyword` = '$keyword' WHERE `product`.`id` = $pro_id"; // echo $query1; die; if (mysqli_query($conn, $query1)) { header("location:". $admin_baseurl . 'product/view-product.php'); exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status active data if(array_key_exists("status_active_blogs",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `product` SET `status` = 'active' WHERE `product`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'product/view-product.php'); exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status deactive data if(array_key_exists("status_deactive_blogs",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `product` SET `status` = 'deactive' WHERE `product`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'product/view-product.php'); exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For detete data if(array_key_exists("Delete_details",$_REQUEST)){ $t_id = $_GET['id']; // echo $t_id; die; $sqlAssign1 = "SELECT * FROM `product` WHERE `product`.`id` = '$t_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $blogs_img = $rows['imge']; } } $query="DELETE FROM `product` WHERE `product`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { unlink("upload/$blogs_img"); header("location:". $admin_baseurl . 'product/view-product.php'); exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } #################################################################################### ?>