D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
admin
/
gallery
/
Filename :
execute-img.php
back
Copy
<?php error_reporting(0); include("../include/config.php"); ########################################################################################## //For Insert Data if(array_key_exists("add_new_gallery",$_REQUEST)){ // echo "add_designer_details vvbgbh"; die; $gallery_categ_id = mysqli_real_escape_string($conn,$_POST['gallery_categ_id']); $imgtitle = mysqli_real_escape_string($conn,$_POST['imgtitle']); 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_file_name1 = "dks-".time().".".$fileExt1; $moveResult1 = move_uploaded_file($fileTmpLoc1, "upload/$new_file_name1"); } $query="INSERT INTO `gallery`(`img`, `img_categ`, `img_name`, `status`) VALUES ('$new_file_name1', '$gallery_categ_id', '$imgtitle', 'active');"; if (mysqli_query($conn, $query)) { header("location:". $admin_baseurl . 'gallery/add-gallery.php'); exit; }else { include('include/error-modal.php'); echo "error"; } mysqli_close($conn); } ################################################################################################## //For detete data if(array_key_exists("delete_gallery_img",$_REQUEST)){ $t_id = $_GET['id']; // echo $t_id; die; $sqlAssign1 = "SELECT * FROM `gallery` WHERE `gallery`.`id` = '$t_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $main_img = $rows['img']; } } $query="DELETE FROM `gallery` WHERE `gallery`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { unlink("upload/$main_img"); header("location:". $admin_baseurl . 'gallery/view-gallery.php'); exit; } else { include('include/error-modal.php'); } mysqli_close($conn); } #################################################################################### ?>