Mini Shell
<?php
include("../config.php");
$conn = dbconnect();
error_reporting(E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('Asia/Kolkata');
session_start();
$admin_id = $_SESSION['admin_id'];
$today = date('Y-m-d H:i:s');
$name = $_POST['name'];
// $title = $_POST['title'];
$para1 = $_POST['para1'];
$para2 = $_POST['para2'];
$para3 = $_POST['para3'];
$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"];
$filepath = '../dynamic_image/principalsmessage/';
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_principalmessage
SET image = '$new_file_name1',
name = '$name',
para1 = '$para1',
para2 = '$para2',
para3 = '$para3',
status = '1',
crm_id = '$admin_id',
updated_log = CURRENT_TIMESTAMP
WHERE id = $slider_id;
";
//echo $sql;
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else {
$sql = "UPDATE tb1_principalmessage
SET name = '$name',
para1 = '$para1',
para2 = '$para2',
para3 = '$para3',
status = '1',
crm_id = '$admin_id',
updated_log = CURRENT_TIMESTAMP
WHERE id = $slider_id;
";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
}
$code = 'done';
}
echo $data = json_encode($code);
Zerion Mini Shell 1.0