I'm trying to create a one file basic PHP file manager where the first thing I'm trying to build is the browsing directories.
My problem is I'm not able to connect DIR paths separately via anchor tag.
Basically I have created an array of path using getcwd() to use them through chdir() function.
Here's the code snippet:
<?php
function browseFiles()
{
$current_path = getcwd();
$path_disect = explode('/', $current_path);
foreach ($path_disect as $e => $value) {
echo "<a href='$value'>" . $value . "/";
}
}
browseFiles();
So what I'm trying is:
Mypath: /var/www/html/
When someone clicks on the /html/ or /www/ or /var/ or ("/" at the first which shows the directory and files listing for the root directory) the user should be able to get directory listing of the directory: "/html/" or /www/ or /var/ or "/"
but what my code is doing it is adding the keyword "/html/" to http://localhost/shell/html/ where the folder "html" doesn't exists.
