<?php
//DATABSE DETAILS//
$DB_ADDRESS="localhost";
$DB_USER="hatranlt_quantriedl";
$DB_PASS="XXi#0eMsvU)C";
$DB_NAME="hatranlt_EgisDeviceList";

//This code is something you set in the APP so random people cant use it.
$SQLKEY="ltB020412";

echo "test",urldecode($_POST['query']),urldecode($_POST['key']);

/*

if( isset($_POST['query']) && isset($_POST['key']) )
{
    //checks if the tag post is there and if its been a proper form post
  //set content type to CSV (to be set here to be able to access this page also with a browser)
  header('Content-type: text/csv');
   if($_POST['key']==$SQLKEY)
   {                                                           //validates the SQL key
        $query=urldecode($_POST['query']);
        $conn = new mysqli($DB_ADDRESS,$DB_USER,$DB_PASS,$DB_NAME);    //connect

        if($conn->connect_error)
            {                                                           //checks connection
                header("HTTP/1.0 400 Bad Request");
                echo "ERROR Database Connection Failed: " . $conn->connect_error, E_USER_ERROR;   //reports a DB connection failure
            }
   }
    echo "good",$_POST['query'],$_POST['key'];
}
else
{
    echo "bad!",$_POST['query'],$_POST['key'];
}
*/

/*
$sql = "SELECT id, name, info, remark FROM test";
$result = $conn->query($sql);
 
if ($result->num_rows > 0) {
    // output dữ liệu trên trang
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - Name: " . $row["name"]. " ". " - info: " . $row["info"]. " ". "remark: " . $row["remark"]. "<br>";
    }
} else {
    echo "0 results";
}

mysqli_close($conn);*/
?>