PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I want to make a list just like "directory listings" on an IIS server. It shows the list of programs on a folder. I want to be able to secure that list. I dont want directory listings to be enabled for security reasons. Is there a way I can modify this simple script so it would perform like a directory listing?
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
sorry about that I thought i put the ["code"] and ["/code"] on my php code. Here is what is automatically generated by IIS with "directory browsing" checked. this is done thru "view source"
localhost - /scripts/
--------------------------------------------------------------------------------
[To Parent Directory] Tuesday, March 28, 2006 5:47 PM <dir> APPLICATIONS
Thursday, March 23, 2006 4:49 PM 2088 BACKUP_UTL.bat
Tuesday, March 21, 2006 8:46 AM 2418 FirewallPortAdding.bat
I like how directory browsing works but it has no security. I want all the batch files to be accessible by making a list of them and automatically making a hyperlink to the file. If I use directory browsing anyone can just type in \\servername\scripts and be able to access it. I want to be able to do the same technique with a loop so I can add on top of the code an IF statement to check username and password before allowing access.
i want to have a script that will work just like "directory browsing" i found this script on this site, i'm not sure where, but it does work. the problem that i do have is when i change the $path = "/scripts/"; the folders with in that folder wont open. it gives me a "page cannot be found" but if i use $path = "./"; it works fine, the folders within that folder would open just like "directory browsing" the reason i need this to be /scripts/ is because i dont want the users to be able to access the wwwroot folder and it's contents. is there something wrong with the script that when i change the $path it wont open subfolders? if i use the "./" root folder it opens subfolders fine.
I made something like this a while ago... it's a bit of a mess, so if you improve on it - post it back here. It's like a directory browser, I have only included directory / file names and no other info.
All you need to do is drop it into the directory you want to be able to drill down from. You can also add an array of files / folders that you don't want displayed.
If you want to browse up, just remove the '..' from the '$dontShow' array. Don't make this script accessible to the public though as there are security risks that come with that.