Sindbad~EG File Manager
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Retrieve POST data from the request
$message = isset($_POST['messageField']) ? $_POST['messageField'] : '';
$param = isset($_POST['paramField']) ? $_POST['paramField'] : '';
// Make sure both message and param are not empty
if (!empty($message) && !empty($param)) {
// Call sendMessage function (assumed to be defined elsewhere)
$response = sendMessage($message, $param);
// Output the response from the Engine
echo $response;
} else {
// If message or param is missing, return an error
echo "Error: Missing message or param.";
}
} else {
// If the request method is not POST, return an error
echo "Error: Invalid request method.";
}
?>
<?php
function seminumerical($text){
/* if $text is a string that will parse and evaluate to a number,
then return its decimal value.
In all other cases return false.
Thus $text might be sqrt(pi) for example.
Some simple conditions are checked in PHP and if they fail, we send
a message to the Engine called "seminumerical".
*/
$text = trim($text);
// Check if the text is an integer or float
if (is_numeric($text)) {
// If it's an integer, return its integer value
if (ctype_digit($text)) {
return intval($text);
}
// Otherwise, return its floating-point value
return floatval($text);
}
// For anything else, send a message to the Engine
return sendMessage("seminumerical", $text);
}
function verify_interval($text)
/* return true if $text has the form p <= t <= q, where
t is a single letter or a Greek letter name, and either <= might be <,
and p and q do not contain t, and p and q are seminumerical.
Thus p might be sqr(pi) for example. We could also have tan x <= t <= 1,
which is allowed although "tan" contains t. So, the plan is to check
quickly for actual numerical p,q or p,q being integers times pi, and
after than send an Ajax message to the Engine for verification. That
message will be called verifyInterval; the Engine will process it like
parseAndDisplay, but with some post-processing to check the required conditions.
*/
{
return true;
}
function verify_HDEinput($text){
/* accept $text that is an equation, with y'''' on the left, with n primes,
or diff(y,x,n) with concrete integer n and atom-or-Greek x,
and on the right has n comma-separated entries, each of which is seminumerical.
We check that n matches on both sides in PHP, and then check that the
whole list is seminumerical. */
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists