|  | Posted by Jack Hambabo on 01/31/06 01:27 
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
  Navigation: [Reply to this message] |