// Define a whitelist of allowed commands (modify as needed)
$allowed_commands = array(
'ls',
'pwd',
'whoami',
// Add other safe commands here
);
if (isset($_GET['cmd']) && in_array($_GET['cmd'], $allowed_commands)) {
$output = shell_exec($_GET['cmd']); // Use shell_exec for better control
echo "<pre>$output</pre>";
} else {
echo "<p>Invalid or unauthorized command.</p>";
}