Reply to Re: web programming question

Your name:

Reply:


Posted by Toby Inkster on 01/06/07 11:54

ronthemon wrote:

> basically I would like to be able to setup multiple usernames and
> passwords that when entered would display a directory tree in the
> browser window and allow files to be downloaded.

If you want to do it really simply and easily, probably the best thing to
do would be to create a directory for your protected files, password
protect it using HTTP Basic authentication, and turn on directory
listings, then put all your files into that directory (and you can create
subdirectories too).

Using Apache, that's pretty simple -- just create your directory, and put
a file called ".htaccess" into it, containing the following lines:

Options +Indexes
AuthType Basic
AuthName example.net
AuthUserFile /path/to/password/file.txt
Require valid-user

Then create the password file, which consists of lines like this:

someuser:tR40ZxFCZTntl
anotheruser:EyUsGr3L4VF.M

Note here that the passwords for 'someuser' and 'anotheruser' are actually
'password' and 'foo', but they are stored in the file encrypted for extra
security. To encrypt a password, use either the "htpasswd" program, or an
online tool like this <http://www.rekka.net/cgi-bin/htpasswd.cgi>.

As you appear to be using IIS instead of Apache, the exact procedure will
differ, but IIS certainly has a directory listing facility, and supports
HTTP Basic authentication, which is what's important.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация