🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #444

password protecting a directory

#444
From: Kurt
Date: Sun, 20 Jul 1997 22:26
44 lines
2717 bytes
The questions I have here are not earth shattering by any means. What I
describe here is in use throughout the internet. Nevertheless, it is
still beyond my understanding on how they work. I am working hard to
understand them but come to a roadblock and seek help. In the spirit of
Perl and the many flavors of Unix (freely distributed) I am posting this
message.

Is there anyway to password protect a directory of webpages with Perl? I
know that you can do it with .htacess and so forth. The only drawback
that I can see with this is that, although one can protect a directory,
it is limited to the use of 'one' password for the directory.

Here is what I am after:

1. A user 'registers' themselves on  a webpage, providing, amongst other
things, a 'username' and 'password'
2. This info is written to a file with Perl, in one of many possible
formats.
3. The user enters the 'password protected' area and is prompted to
enter a 'valid user name' and a 'valid password'. Only those individuals
that present a valid username and password gain entrance into the site.
The usernames and passwords are unique to the individual.

I have seen how .htaccess works. I understand that it protects the
directory and all the files in that directory. BUT, the problem, as I
have mentioned, is that there is ONLY one password. I am unaware, but
very interested, in any way around this. For instance, is there any way
to have a registration page that utilizes a scripting language, such as
Perl, write the usernames and passwords to the .htpasswd file so that
every time the directory is accessed and .htacess is invoked that
.htpasswd can be scanned through to see if the user entered a valid
username and password.

Some other questions on issues that are baffling me:

1. In Javascript one can use the 'onLoad( ) function to invoke an
action. Is there anyway to do this with Perl? From what I understand the
only way to invoke a Perl program is through the use of a form. The only
exception I see this to this is the <#exec .....>  piece of code I
sometimes see (but I have only seen this with logging stat scripts.

Thank You,

Kurt
Technical Details
Message-ID: <33D290AD.A3B47A5A@rfpi.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!agh.edu.pl!ict.pwr.wroc.pl!news.apk.net!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!agh.edu.pl!ict.pwr.wroc.pl!news.apk.net!not-for-mail
From: Kurt <kurt@rfpi.com>
Newsgroups: pl.comp.lang.perl
Subject: password protecting a directory
Date: Sun, 20 Jul 1997 18:26:53 -0400
Organization: APK Net, Ltd.
Lines: 48
Message-ID: <33D290AD.A3B47A5A@rfpi.com>
Reply-To: kurt@rfpi.com
NNTP-Posting-Host: ts102.erienet.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.01 [en] (Win95; I)
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit