From: =?UTF-8?B?RHXFoWFuIE5vdmFrb3ZpxIc=?= on
Hello all,

I have problem with protecting files inside of folder. So, I have one
folder with files inside and the idea is to be able to see those files
(format is not important) only when you are logged in system.
I can't use solutions like to set some wierd name so that actually
user is hardly able to guess the real path to that file, something
like http://site.com/files/we23h4hk234hjksdjrjkl23jfasdf
Is there some trick with .htaccess to check some php value and set
different rules if some another value in php is set or not. I know
that you are able to set some php values in .htaccess, but as I said,
is it possible to manipulate with them inside of .htaccess. Or if
someone has some better solution, you are welcome to write it down :-)

Regards,
Dusan

--
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.
From: "Tommy Pham" on
> -----Original Message-----
> From: Dušan Novaković [mailto:ndusan(a)gmail.com]
> Sent: Thursday, July 15, 2010 7:46 AM
> To: php-general(a)lists.php.net
> Subject: [PHP] set different .htaccess rules
>
> Hello all,
>
> I have problem with protecting files inside of folder. So, I have one folder
> with files inside and the idea is to be able to see those files (format is not
> important) only when you are logged in system.
> I can't use solutions like to set some wierd name so that actually user is
> hardly able to guess the real path to that file, something like
> http://site.com/files/we23h4hk234hjksdjrjkl23jfasdf
> Is there some trick with .htaccess to check some php value and set different
> rules if some another value in php is set or not. I know that you are able to
> set some php values in .htaccess, but as I said, is it possible to manipulate
> with them inside of .htaccess. Or if someone has some better solution, you
> are welcome to write it down :-)
>
> Regards,
> Dusan
>
> --
> mob: + 46 70 044 9432
> web: http://novakovicdusan.com
>
> Please consider the environment before printing this email.
>

Dusan,

You can create several components with PHP:
1) authentication, authorization and personalization
2) displaying the files in the various format and whether to permit navigating parent/sub- directories: file explorer like, filmstrip, slideshow, preview etc...

Then combine the components in one index.php and drop that file in all the desired directories. This will give you enhanced customized service for each authorized user, especially if you combine it all with AJAX too.

Regards,
Tommy

From: kranthi on
i would use a single point of entry to solve this problem
1. keep the files outside your doc root
2. in the php file files.php check for an authorized user, if so allow
the user to download the file

the path http://site.com/files/we23h4hk234hjksdjrjkl23jfasdf will
actually be http://site.com/files.php?file=we23h4hk234hjksdjrjkl23jfasdf

if you hav access to httpd.conf (i am not sure if .htaccss works) u
can set the non php extensions to be executed by the php interpreter
and check for authorization (the way rapidshare works)