Function: (a) delete a file (B) edit a file, and delete a folder on a webpage (c), provided that the folder is empty (d) create a file or folder, modify folder name
The code is as follows:
/*
Function: (a) delete a file (B) edit a file, and delete a folder on a webpage (c), provided that the folder is empty (d) create a file or folder, modify the folder name;
Lost63.com original, reprinted please indicate the source. exchange QQ: 35501547
*/
$ Path = $ DOCUMENT_ROOT;
$ Path = str_replace ("/", "\", $ path );
// Specify a folder
$ Path = $ path ."\\";
If ($ _ GET ['Folder'])
{
$ Path. = $ _ GET ['Folder']. "\";
}
// The path of this page, which will be used when the following is returned;
$ Url = $ _ SERVER ['php _ SELF '];
// If it is a folder, a link is added;
Function folder ($ path, $ str)
{
If (filetype ($ path. $ str) = "dir ")
{
Return "$ str ";
} Else {
Return $ str;
}
}
Switch ($ _ GET ['action'])
{
Case "del ";
If ($ _ GET ['type'] = "file ")
{
Unlink ($ _ GET ['path']);
} Else {
Rmdir ($ _ GET ['path']);
}
Echo"