Webjames custom autoindex
Jim Nagel (444) 25 posts |
The previous thread pointed me to the 2016 update of Webjames (on Chris Gransden’s site but he omitted to mention it in the contents list there). Thanks for that — it cured the autoindex crash that was plaguing me. Another Webjames question now. The now-working autoindex handler dates back to Webjames 0.43 (by Alex Waugh, 2004). It’s rather bare-bones. I’d like to concoct a PHP script to produce an autoindex with filetype icons and a way for the user to reorder the list by name or date etc. And to hide files such as .htaccess that are supposed to be hidden. Question: What do I need to put into the Webjames Attributes file or an .htaccess file or a web.config file or whatever, to invoke this custom PHP autoindex? |
Rick Murray (539) 13840 posts |
I would imagine, off the top of my head, you might want something in the Attributes file like: <location /testdir/> homedir=$.Public DefaultFile index.php </location> This will cause http://127.0.0.1/testdir/ to be the contents of $.Public (a real path is better, but it’s just an example!) and when accessed, WebJames will look for a file called “index.php” which will be run. You’ll need to do all the file stuff yourself in PHP. You might want to add this to your Attributes file: <files /htaccess> hidden </files> This will stop any .htaccess files being served. The AutoIndex may show it (it shouldn’t, but it might? never actually tested this!) but it should refuse to be actually served. |
Rick Murray (539) 13840 posts |
Oh, and I should add – in your Attributes file you’ll probably have something like this: <Location /> DefaultFile index.php index.html blah blah AutoIndex </Location> Remove the AutoIndex. A server accessible to the world should never be offering up directory listings when the page to serve can’t be found or doesn’t exist. Just let it throw a 404 and say the path doesn’t exist. It’s safer that way. Use AutoIndex for directories where you actually intend to make the files visible. I’ll give you an example: http://heyrick.ddns.net/ovation/ You’ll see a 404 message telling you that /ovation/ doesn’t exist. However if you suffix “!RunImageS” to the end, it’ll fetch it for you. That’s because /ovation/ points to the live version of the Ovation sources and build environment, but there’s no index and no directory listing. You have to know what you’re looking for to find it… |
John Sandgrounder (1650) 574 posts |
Depending on your programming skills and preferences, with WebJames you can also use BBC Basic to do what you’re after. |