parse .htaccess incl. .htgroups and <Files special*.htm> ...



Hi,

I'm searching for a php script that can find out whether the current
user (I know _SERVER["PHP_AUTH_USER"] will give me the name for
non-cgi php) has the right to view a specific file.

My dream is that I just need a short php script that just asks the
webserver what the rights are. That seems a reasonable wish to me.

If this is however not possible than I'd like a script that can
interpret a .htaccess and .htgroups file. For this I would like to give
to the script a filename or a directory (filename should be possible),
the script would then search the folder and (if nessecary) the higher
folders to find out which .htaccess file applies. It then checks which
rule in the .htaccess file applies (i.e. it should understand both
plain
"
Require user Werner Dieter Heidi
Require group Servicetechniker
"
and
"
<Files *.htm>
Require user Werner Dieter Heidi
Require group Servicetechniker
</Files>
"
It shall than find the groups file and resolve the groups.
Then it should either give me the list of all users that are allowed to
see the picture, or it should tell me whether the current user has the
right to read the file.

It would be great if a script would already exist. I've never
programmed any php so I'm unsure how long it would take me to write the
..htaccess-parser.

There is
http://pear.php.net/manual/en/package.filesystem.file-htaccess.php
but as far as I see it'll just read the users and groups out of a give
..htaccess file. But it won't understand the <Files xyz.html> tag and it
won't resolve groups.
But then again it can write new .htaccess. (However I don't need this
right now.)

Very many thanks,
Jack

.



Relevant Pages

  • parse .htaccess incl. .htgroups and ...
    ... I'm searching for a php script that can find out whether the current ... folders to find out which .htaccess file applies. ... Require user Werner Dieter Heidi ...
    (alt.php)
  • Re: Displaying Errors Question
    ... Now, if anything is even the slightest incorrect with the script, instead of displaying error messages on the screen a blank screen is returned and I have to go to the error.log to see what's happening. ... nothing in the script (including the code to set the flag variable) will be executed. ... Any suggestions on how to tackle this on a production server, where setting the server to display errors in php.ini is not an option? ... Also remember in the .htaccess file you can't use constants like E_STRICT, you need to use the binary value. ...
    (comp.lang.php)
  • PHP scripting errror -Why?
    ... Does anyone see what I am doing wrong with this simple script? ... >> So the PHP script IS running, and I am receiving an email... ... > be the HTML back to the browser. ... that the headercommand redirects the user back to the page they were ...
    (alt.php)
  • Re: [PHP] Re: how to detect type of image
    ... you detect if a script is HTML or PHP? ... to execute a file that starts with 'GIF89a' as if it were a binary ... manage to trick your PHP script into putting it somewhere that it will ... Every extra barrier you layer in there will slim down the number of ...
    (php.general)
  • Re: [PHP] pdo-oracle + nls_lang environment variable...
    ... I'm using pdo-oci on php-5.2.2 against an oracle-10g server, ... I make a simple php script that makes a select from a table. ... user running the apache daemon, I modified the apache init script to export ...
    (php.general)