Mini Shell

Direktori : /home2/aravindar/public_html/admin/ajax/
Upload File :
Current File : /home2/aravindar/public_html/admin/ajax/slider_action.php

<?php
include("../config.php");
$conn = dbconnect();
error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
session_start();
$admin_id = $_SESSION['admin_id'];
$today = date('Y-m-d H:i:s');
$type = $_POST['type'];

if ($type == 'active') {
    $slider_id = $_POST['slider_id'];
    $sql = "UPDATE  tb1_slider SET status=1,crm_id='$admin_id',updated_log='$today' WHERE slider_id='$slider_id'";
    $content_res = mysqli_query($conn, $sql);
    $code = 'done';
} else if ($type == 'inactive') {
    $slider_id = $_POST['slider_id'];
    $sql = "UPDATE  tb1_slider SET status=0,crm_id='$admin_id',updated_log='$today' WHERE slider_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 = '../' . $url_path;

    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_slider SET slider_img='$new_file_name1',status='1',crm_id='$admin_id',updated_log='$today' WHERE slider_id='$slider_id'";
        //echo $sql;
        $content_res = mysqli_query($conn, $sql);
        $code = 'done';
    } else {
        $sql = "UPDATE tb1_slider SET status='1',crm_id='$admin_id',updated_log='$today' WHERE slider_id='$slider_id'";
        $content_res = mysqli_query($conn, $sql);
        $code = 'done';
    }

    $code = 'done';
}
echo $data = json_encode($code);

Zerion Mini Shell 1.0