add command:touch
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
function touc($commands)
|
||||
{
|
||||
$pwd = file_get_contents("pwd.txt");
|
||||
if (sizeof($commands) == 2) {
|
||||
if (!touch("fileroot" . $pwd . "/" . $commands[1])) {
|
||||
file_put_contents("recent.txt", "Error touchting.No permissions?<br/>", FILE_APPEND);
|
||||
}
|
||||
} else {
|
||||
file_put_contents("recent.txt", "Invalid number of arguments.<br/>", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
touch - creates a new file<br/>
|
||||
if the file already exists, it updates the timestamp<br/>
|
||||
@@ -4,4 +4,5 @@ help - displays this help message<br/>
|
||||
mkdir - creates a new directory<br/>
|
||||
pwd - shows the working directory<br/>
|
||||
rm - deletes a file or directory<br/>
|
||||
touch - creates a new file<br/>
|
||||
type help [command] to show more details<br/>
|
||||
@@ -58,6 +58,9 @@ if (!opendir("fileroot")) {
|
||||
} else if ($commands[0] == "help") {
|
||||
include "commands/help.php";
|
||||
help($commands);
|
||||
} else if ($commands[0] == "touch") {
|
||||
include "commands/touch.php";
|
||||
touc($commands);
|
||||
} else {
|
||||
file_put_contents("recent.txt", "Unknown command.<br/>try 'help' or 'help [command]'<br/>", FILE_APPEND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user