Mini Shell
<?php
include("../config.php");
$conn = dbconnect();
// error_reporting(0);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('Asia/Kolkata');
session_start();
$admin_id = $_SESSION['admin_id'];
$today = date('Y-m-d H:i:s');
$type = $_POST['type'];
$name = $_POST['name'];
$position = $_POST['position'];
if ($type == 'active') {
$slider_id = $_POST['slider_id'];
$sql = "UPDATE tb1_director SET status=1,crm_id='$admin_id',upldated_log='$today' WHERE id='$slider_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else if ($type == 'inactive') {
$slider_id = $_POST['slider_id'];
$sql = "UPDATE tb1_director SET status=0,crm_id='$admin_id',upldated_log='$today' WHERE id='$slider_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else if ($type == 'update') {
$slider_id = $_POST['slider_id'];
$new_file_name1 = $_FILES["files"]["name"];
$url_query = "SELECT * FROM tb1_url WHERE url_title='slider'";
$res_url = mysqli_query($conn, $url_query);
$fetch_url = mysqli_fetch_object($res_url);
$url_path = $fetch_url->url_path;
$filepath = '../dynamic_image/directors';
if ($new_file_name1 != '') {
$new_file_name1 = $_FILES["files"]["name"];
$lname1 = "slider";
$emrand1 = $lname1 . rand(1000, 2000);
$fileType1 = $_FILES["files"]["type"];
$str1 = explode("/", $fileType1);
$new_file_name1 = $emrand1 . '.' . $str1[1];
$target_path1 = $filepath . '/' . basename($new_file_name1);
move_uploaded_file($_FILES['files']['tmp_name'], $target_path1);
$sql = "UPDATE tb1_director SET image='$new_file_name1',name='$name',position='$position',status='1',crm_id='$admin_id',upldated_log='$today' WHERE id='$slider_id'";
//echo $sql;
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else {
$sql = "UPDATE tb1_director SET status='1', name='$name', position='$position', crm_id='$admin_id', upldated_log='$today' WHERE id='$slider_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
}
$code = 'done';
}
echo $data = json_encode($code);
Zerion Mini Shell 1.0