You are advised to check corresponding YouTube video at the end of this article.
form.html
<form action="grabthings.php" method="post">
<label>External Program:</label>
<input type="text" name="external">
<br><br>
<input type="submit" value="Submit">
</form>
Our usual html form to grab things.
grabthings.php
<?php
$get_external = $_POST["external"];
switch ($get_external) {
case "calc":
system("calc");
break;
case "notepad":
system("notepad");
break;
default:
echo "Just calc and notepad are allowed";
}
?>
This PHP script checks for a POST request parameter named "external" and executes a command based on its value.
If the value of the "external" parameter is "calc", the script will execute the "calc" command using the system()
function, which will open the Windows calculator application. If the value of the "external" parameter is "notepad", the script will execute the "notepad" command, which will open the Windows Notepad application.
If the value of the "external" parameter is not "calc" or "notepad", the script will output the message "Just calc and notepad are allowed".
No comments:
Post a Comment