Nice solution, anyway: There's a slightly better way ;)
Shawn Wilson <sh***@glassgiant.com> wrote:
2. Make a .htaccess file to force Apache to interpret "scripts" as PHP
<Files scripts>
ForceType application/x-httpd-php (going from memory. Google "ForceType")
</Files>
<Files scripts>
ForceType application/x-httpd-php
AcceptPathInfo On
</Files>
Shawn Wilson <sh***@glassgiant.com> wrote: 3. Manually get the trailing bits and use them to search a database or whatever.
$possiblevalues = array('php', 'cgi', 'perl', 'asp');
$trailingbits = preg_replace('/^scripts\//', '', $_SERVER['REQUEST_URI']);
if (!in_array($trailingbits, $possiblevalues))
show_my_error('Invalid script type');
else
list_scripts($trailingbits);
Use
$trailingbits = $_SERVER['PATH_INFO'];
instead.
I've used a similar script, the sources are:
<http://test.dangerouscat.net/download/.htaccess>
<http://test.dangerouscat.net/download/download>
(The script itself is located in /download, therefore you will see that it
works ;))
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle