RE: .htaccess and db authentication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Store the files outside of your web root or in an .htaccess protected
directory. You don't have to control an .htaccess password list, just
let PHP handle the sending of the file. 

Validate your user and whether they should be looking at the file they
requested, then use header() to send the appropriate header for the file
and use readfile() to send the data.

---John Holmes...

> -----Original Message-----
> From: Adam Royle [mailto:ifunk@myrealbox.com]
> Sent: Monday, October 14, 2002 8:59 AM
> To: php-db@lists.php.net
> Subject:  .htaccess and db authentication
> 
> I was wondering about people's thoughts on file security through php
> using database authentication.
> 
> Take the following example:
> 
> I have a folder (in webroot) called /videos/ which contains a heap of
> files like so:
> 
> video_1_14-06-2002.mpg
> video_2_15-06-2002.mpg
> video_3_16-06-2002.mpg
> video_4_17-06-2002.mpg
> 
> Now, in a database I have table with a heap of users, with some sort
of
> security identifier which allows them to access only the files they
are
> given access to. Now, doing this in PHP is no problem, but I want to
be
> able to stop them from 'predicting' what the next filename would be
and
> just typing that in.
> 
> I thought about using .htaccess, where if they try to access one of
the
> files, it sends it off to a php page which authenticates and displays
a
> list of files they are allowed to view, although I would like it if
> they had the opportunity to type in the url of the file if they are
> actually authorized to do so.
> 
> I would prefer not to keep a file listing of allowed usernames and
> passwords using .htaccess, as this information could potentially be
> updated frequently with a large amount of users (or would this not be
a
> problem).
> 
> Has anyone implemented this type of system before? are there any good
> resources people know of for this type of thing?
> 
> Thanks,
> Adam.
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux