Mini Shell
<?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') {
$event_id = $_POST['news_id'];
$sql = "UPDATE tb1_timeline SET status=1,crm_id='$admin_id',updated_log='$today' WHERE id='$event_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else if ($type == 'inactive') {
$event_id = $_POST['news_id'];
$sql = "UPDATE tb1_timeline SET status=0,crm_id='$admin_id',updated_log='$today' WHERE id='$event_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else if ($type == 'delete') {
$event_id = $_POST['news_id'];
$sql = "DELETE FROM tb1_timeline WHERE id='$event_id'";
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else if ($type == 'update') {
$title = mysqli_real_escape_string($conn, $_POST['title']);
$description = mysqli_real_escape_string($conn, $_POST['description']);
$event_date = mysqli_real_escape_string($conn, $_POST['event_date']);
$sql = "INSERT INTO `tb1_timeline` (`id`, `title`, `description`, `year`, `status`, `crm_id`, `created_log`, `updated_log`) VALUES (NULL, '$title', '$description', '$event_date', '1', '$admin_id', current_timestamp(), current_timestamp());";
//echo $sql;
$content_res = mysqli_query($conn, $sql);
$code = 'done';
} else {
echo json_encode(['status' => '500', 'message' => 'No file uploaded or file upload error.']);
}
echo $data = json_encode($code);
Zerion Mini Shell 1.0