D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
admin
/
blogs
/
Filename :
execute-blogs-details.php
back
Copy
<?php error_reporting(0); include("../include/config.php"); ########################################################################################## //For Insert Data if(array_key_exists("add_blogs_details",$_REQUEST)){ // echo "add_blogs_details vvbgbh"; die; $b_title = mysqli_real_escape_string($conn,$_POST['blogs_title']); $postedBy = mysqli_real_escape_string($conn,$_POST['post_by']); $m_keywords = mysqli_real_escape_string($conn,$_POST['keyword']); $m_matetags = mysqli_real_escape_string($conn,$_POST['metatag']); $m_desc = mysqli_real_escape_string($conn,$_POST['description']); $b_details = mysqli_real_escape_string($conn,$_POST['ckeditor_library_course_details']); $custosm_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $blogs_categ_id = mysqli_real_escape_string($conn,$_POST['blogs_categ_id']); $blogs_tags = mysqli_real_escape_string($conn,$_POST['blogs_tags']); $posted_date = $_POST['custom_date']; $current_date = date( "d-M-Y", strtotime( $posted_date ) ); $c_date = date( "d", strtotime( $posted_date ) ); $c_month = date( "M", strtotime( $posted_date ) ); if(empty($custosm_url)){ $url = create_slug($b_title); }else{ $url = create_slug($custosm_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, "blogs-files/$new_fileName"); } $query="INSERT INTO `atul_blogs`(`blogs_categ_id`, `title`, `url`, `custom_url`, `date_add`, `c_date`, `c_month`, `blogs_details`, `post_by`, `picture`, `meta_title`, `keyword`, `description`, `blog_tags`, `status`) VALUES ('$blogs_categ_id', '$b_title', '$url', '$url', '$current_date', '$c_date', '$c_month', '$b_details', '$postedBy', '$new_fileName', '$meta_title', '$m_keywords', '$m_desc', '$blogs_tags', 'active')"; // echo $query; die; if (mysqli_query($conn, $query)) { // header("Location:add-blogs.php"); // echo "in"; echo "<script>window.location.href='view-blogs.php';</script>"; exit; } else { include('include/error-modal.php'); echo "error"; } mysqli_close($conn); } ########################################################################################## //For update Data if(array_key_exists("update_blogs_details",$_REQUEST)){ // echo "update_blogs_de tails"; die; $blogs_id = mysqli_real_escape_string($conn,$_POST['blogs_id']); $blogs_categ_id = mysqli_real_escape_string($conn,$_POST['blogs_categ_id']); $blogs_images = mysqli_real_escape_string($conn,$_POST['blogs_images']); // echo "blogs id : " .$blogs_id; die; $b_title = mysqli_real_escape_string($conn,$_POST['blogs_title']); $postedBy = mysqli_real_escape_string($conn,$_POST['post_by']); $m_keywords = mysqli_real_escape_string($conn,$_POST['keyword']); $m_matetags = mysqli_real_escape_string($conn,$_POST['metatag']); $m_desc = mysqli_real_escape_string($conn,$_POST['description']); $b_details = mysqli_real_escape_string($conn,$_POST['ckeditor_library_course_details']); $customs_url = mysqli_real_escape_string($conn,$_POST['custom_url']); $meta_title = mysqli_real_escape_string($conn,$_POST['meta_title']); $blogs_tags = mysqli_real_escape_string($conn,$_POST['blogs_tags']); $posted_date = $_POST['custom_date']; $current_date = date( "d-M-Y", strtotime( $posted_date ) ); $c_date = date( "d", strtotime( $posted_date ) ); $c_month = date( "M", strtotime( $posted_date ) ); if(empty($custosm_url)){ $url = create_slug($b_title); }else{ $url = create_slug($customs_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, "blogs-files/$new_fileName"); } if(empty($_FILES['image_a']['name'])) { $new_fileName = $blogs_images; } $query1 = "UPDATE `atul_blogs` SET `blogs_categ_id` ='$blogs_categ_id',`title` = '$b_title',`date_add`='$current_date',`c_date`='$c_date',`c_month`='c_month', `url` = '$url', `custom_url` = '$url', `blogs_details` = '$b_details', `post_by` = '$postedBy', `picture` = '$new_fileName', `keyword` = '$m_keywords', `meta_title` = '$meta_title', `description` = '$m_desc', `blog_tags`='$blogs_tags' WHERE `atul_blogs`.`id` = $blogs_id"; // echo $query1; die; if (mysqli_query($conn, $query1)) { echo "<script>window.location.href='view-blogs.php';</script>"; 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 `atul_blogs` SET `status` = 'active' WHERE `atul_blogs`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:view-blogs.php"); } 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 `atul_blogs` SET `status` = 'deactive' WHERE `atul_blogs`.`id` = '$net_id'"; if (mysqli_query($conn, $query)) { header("location:view-blogs.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } ################################################################################################## //For detete data if(array_key_exists("Delete_blogs_details",$_REQUEST)){ $t_id = $_GET['id']; // echo $t_id; die; $sqlAssign1 = "SELECT * FROM `atul_blogs` WHERE `atul_blogs`.`id` = '$t_id';"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $blogs_img = $rows['picture']; } } $query="DELETE FROM `atul_blogs` WHERE `atul_blogs`.`id` = '$t_id'"; if (mysqli_query($conn, $query)) { unlink("blogs-files/$blogs_img"); header("location:view-blogs.php"); } else { include('include/error-modal.php'); } mysqli_close($conn); } #################################################################################### ?>