The functions used are:
Isset () Determines whether a variable is defined
ChDir () changes the current directory to the specified directory.
Opendir () to open the directory.
Readdir () reads the directory.
GETCWD (). Gets the current directory.
It also uses the for if get pass value about these things:
Here's the code:
<?phpif (Isset ($_get[' id "))//Determine whether the value is {$s =str_replace (', ' + ', $_get[' id ']); $s =base64_decode ($s);//The value value that is passed is generally the absolute chdir ($s) of the directory to be opened;//switch to the directory to open} $a =opendir ('. '); /Open the current directory while (false!== ($c =readdir ($a)))//Iterate through the directory contents of the file name {if (Is_dir ($c))//Determine whether the directory or the file {if ($c = =). ') {} else {if ($c = = ' ... ') {$w =base64_encode (substr (GETCWD (), 0,strrpos (GETCWD (), ' \ \ ')), or//the current path plus the directory name is the absolute path to the directory echo "upper level". " <a href= ' 6.php?id= $w ' > Open </a><br/> ";//When you click Open, the absolute path to open will be passed out chdir switch to the directory you want to open}else { $w =base64_encode (GETCWD (). ' \ \ '. $c);//The current path plus the directory name is the absolute path to the directory echo "$c". " <a href= ' 6.php?id= $w ' > Open </a><br/> ";//When you click Open, the absolute path to open will be passed out with ChDir to the directory you want to open} }} else {echo "$c is not directory <br/>"; }}?>
PHP Unlimited Traversal directory