D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
admin
/
testimonials
/
Filename :
execute.php
back
Copy
<?php error_reporting(0); include("../include/config.php"); ########################################################################################## //For Insert Data if(array_key_exists("add_new_testimonials",$_REQUEST)){ // echo "add_new_testimonials"; die; $name = $_POST['name']; $comment = mysqli_real_escape_string($conn,$_POST['comment']); 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-files/$new_fileName"); } $query="INSERT INTO `testimonials`(`name`, `photo`, `feedback`, `status`) VALUES ('$name', '$new_fileName', '$comment', 'active')"; echo $query; if (mysqli_query($conn, $query)) { header("location:view-testimonials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For Update Data if(array_key_exists("update_testimonials",$_REQUEST)){ // echo "updat update_testimonials"; die; $testi_id = $_POST['testi_id']; $name = $_POST['name']; $comment = mysqli_real_escape_string($conn,$_POST['comment']); $query="UPDATE `testimonials` SET `name` = '$name' , `feedback` = '$comment' WHERE `testimonials`.`id`='$testi_id';"; echo $query; if (mysqli_query($conn, $query)) { header("location:view-testimonials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For detete Delete_ebook data if(array_key_exists("Delete_testimonial",$_REQUEST)){ $t_id = $_GET['id']; $sqlAssign1 = "SELECT * FROM `testimonials` WHERE `testimonials`.`id` = '$t_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $s_img = $rows['photo']; } } $query="DELETE FROM `testimonials` WHERE `testimonials`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { unlink("upload-files/$s_img"); header("location:view-testimonials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status active status_active_ebook data if(array_key_exists("status_active_testimoniale",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `testimonials` SET `status` = 'active' WHERE `testimonials`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:view-testimonials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status deactive status_deactive_ebook data if(array_key_exists("status_deactive_testimonial",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `testimonials` SET `status` = 'deactive' WHERE `testimonials`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:view-testimonials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //Other Material ########################################################################################## //For Insert Data of Other Material if(array_key_exists("add_other_materials",$_REQUEST)){ // echo "add_other_materials"; die; $topic_Name = $_POST['topic_Name']; $url = create_slug($topic_Name); // $image_a = $_POST['image_a']; $uploaded_date = date("d-m-Y"); $fileName = time().$_FILES["image"]["name"]; $fileTmpLoc = $_FILES["image"]["tmp_name"]; $fileType = $_FILES["image"]["type"]; $fileSize = $_FILES["image"]["size"]; $fileErrorMsg = $_FILES["image"]["error"]; $kaboom = explode(".", $fileName); $fileExt = end($kaboom); $moveResult = move_uploaded_file($fileTmpLoc, "other-material-files/$fileName"); if($moveResult!= true) { echo "ERROR: File not uploaded. Try again."; unlink($fileTmpLoc); exit(); } $query="INSERT INTO `other_materials`(`topic_name`, `url`, `upload_file`, `uploaded_date`, `status`) VALUES ('$topic_Name', '$url', '$fileName', '$uploaded_date', 'active')"; if (mysqli_query($conn, $query)) { header("location:add-other-materials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For Update Data if(array_key_exists("update_other_materials",$_REQUEST)){ $sub_id = $_POST['uploaded_id']; $topic_Name = $_POST['topic_Name']; $url = create_slug($topic_Name); $uploaded_file = $_POST['uploaded_file']; $fileName = time().$_FILES["image"]["name"]; $fileTmpLoc = $_FILES["image"]["tmp_name"]; $fileType = $_FILES["image"]["type"]; $fileSize = $_FILES["image"]["size"]; $fileErrorMsg = $_FILES["image"]["error"]; $kaboom = explode(".", $fileName); $fileExt = end($kaboom); $moveResult = move_uploaded_file($fileTmpLoc, "other-material-files/$fileName"); if(empty($_FILES['image']['name'])) { $fileName = $uploaded_file; } $query = "UPDATE `other_materials` SET `topic_name` = '$topic_Name', `url` = '$url', `upload_file` = '$fileName' WHERE `other_materials`.`id` = '$sub_id'"; echo $query; if (mysqli_query($conn, $query)) { header("location:add-other-materials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For detete data if(array_key_exists("Delete_other_material_Topic",$_REQUEST)){ $t_id = $_GET['id']; // echo Delete_other_material_Topic; die; $query="DELETE FROM `other_materials` WHERE `other_materials`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { header("location:add-other-materials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status active other other material_topic data if(array_key_exists("status_active_other_material",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `other_materials` SET `status` = 'active' WHERE `other_materials`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:add-other-materials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ########################################################################################## // status deactive other material_topic data if(array_key_exists("status_deactive_other_material",$_REQUEST)){ $net_id = $_GET['id']; $query="UPDATE `other_materials` SET `status` = 'deactive' WHERE `other_materials`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:add-other-materials.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## ?>