| Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 Path : /home/u901718425/public_html/php/ |
| Current File : /home/u901718425/public_html/php/filter.php |
<?php
include("../panel/globale.php");
date_default_timezone_set("Asia/Calcutta");
if (isset($_POST)) {
$da = [];
$res= [];
$required = ['page','table'];
foreach ($required as $key) {
if(! isset($_POST[$key])){
$da[$key] = (isset($_POST[$key])? $_POST[$key]: 'Filde Required');
}
}
if(!empty($da)){
$res[0] = 'error';
$res[1] = $da;
}else{
$where = " WHERE status = 1 ";
$table = $_POST['table'];
$column = (isset($_POST['column']) && $_POST['column'] !="" ? $_POST['column'] : '*');
$where .= (isset($_POST['where']) && !empty($_POST['where'])? implode(' AND ', $_POST['where']) : '');
$limit = (isset($_POST['limit']) && !empty($_POST['limit'])? $_POST['limit'] : '');
$sql = "SELECT $column FROM $table $where $limit";
$res = $db->query($sql);
if($res[0] == 'error'){
$error['id'] = ($db->max("error_log") == NULL? 1 : (int)$db->max("error_log") + 1);
$error['page'] = $_POST['page'];
$error['error'] = $db->sanitize($res[1]);
$error['query'] = $db->sanitize($res[2]);
$error['status'] = "not solved";
$db->insert("error_log",$error);
}
}
echo json_encode($res);
}
?>