Mini Shell
<?php
include("../config.php");
$conn = dbconnect();
header('Content-Type: application/json');
error_reporting(E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('Asia/Kolkata');
session_start();
$response = []; // Initialize an empty response array
if (!isset($_SESSION['admin_id'])) {
$response['status'] = 'error';
$response['message'] = 'Admin not logged in.';
echo json_encode($response);
exit; // Stop further execution
}
$admin_id = $_SESSION['admin_id'];
if (!isset($_POST['id'])) {
$response['status'] = 'error';
$response['message'] = 'ID not provided.';
echo json_encode($response);
exit; // Stop further execution
}
$id = intval($_POST['id']);
$sql = "SELECT * FROM tb1_alumini WHERE id = $id";
$content_res = mysqli_query($conn, $sql);
if (!$content_res) {
$response['status'] = 'error';
$response['message'] = 'Query failed: ' . mysqli_error($conn);
echo json_encode($response);
exit; // Stop further execution
}
$data = mysqli_fetch_assoc($content_res);
if (!$data) {
$response['status'] = 'error';
$response['message'] = 'No data found.';
echo json_encode($response);
exit; // Stop further execution
}
$response['status'] = 'success';
$response['message'] = 'Data retrieved successfully.';
$response['data'] = $data;
echo json_encode($response);
Zerion Mini Shell 1.0