Hi all,
The problem is how to avoid unauthorized access to files (independent of type).
I have users loging-in from session-based system, so I can identify from PHP scripts whether the user is authorized or not.
But the problem comes when the file is not php scipt (i.e image file).
I have found recommendations to use .htaccess under apache. But there is a problem as it trigers a popup window for username/password, which I don't need as my users are authorized in a form-php combination.
I saw a post with a similar problem advising to use .htaccess file in the following way:
<Location /secure>
ForceType application/x-httpd-php
DefaultType application/x-httpd-custom
Action application/x-httpd-custom "/auth.php"
</Location>
which should call the auth.php to check authorization everytime a user requests a file. But it was said not to work properly.
Please tell me how to create correct .htaccess file or what could be some other solutions. (I have seen proposals to use javascript to avoid the popup window and php script that calls fopen("username:password@www.....com/secure"); to establish connection internally, but I didn't like those solutions as they are kind of ugly).
Jaak