| Server IP : 104.21.80.248 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/education/ |
Upload File : |
<?php
require_once 'config.php'; // Make sure config.php includes database connection ($conn) and secure_input()
header('Content-Type: application/json');
$table = secure_input($_GET['table']);
$query = secure_input($_GET['query']);
$allowed_tables = ['uni_name', 'faculty_name', 'field_name']; // Whitelist allowed tables for security
if (!in_array($table, $allowed_tables)) {
echo json_encode([]);
exit();
}
$sql = "SELECT id, name FROM $table WHERE name LIKE '%$query%' ORDER BY name LIMIT 10";
$result = mysqli_query($conn, $sql);
$suggestions = [];
while ($row = mysqli_fetch_assoc($result)) {
$suggestions[] = $row;
}
echo json_encode($suggestions);
mysqli_close($conn);
?>