<?php
/*
Bryan
Exile Server Manager
*/
require "config/config.php";
// Make sure this is legit request
if (!array_key_exists($_POST["key"], $SERVERS))
{
die(INVALID_PERMS);
}
// Extract it!
$serverKey = $_POST["key"];
// Query the DB
$result = mysqli_query($esm_db, "SELECT id, function, parameter FROM requests WHERE recipient_key = '$serverKey'");
if (!$result)
{
die(FAILED_QUERY);
}
// No requests, just exit
if (mysqli_num_rows($result) == 0)
{
die("");
}
$return = "";
while($row = mysqli_fetch_assoc($result))
{
$return .= $row["function"] . "," . $row["parameter"] . ",";
$id = $row['id'];
$query = mysqli_query($esm_db, "DELETE FROM requests WHERE id = $id");
}
// Trim out the ending comma
echo substr($return, 0, -1);
?>