httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <>
Subject Re: .htaccess webinterface
Date Mon, 24 Jun 2002 06:44:42 GMT
Nick De Decker wrote:

> Hi,
> I'm looking for some .htaccess web controlpanel, of some
> php or c/c++ libary for managing htaccess files.
> Any help is welcome,
> Nick

I think there are several, but know of none. Why bother to find 3rd-party
stuff when it's so easy to do your self in perl?

Like, get existing users:
    $pwfile = "$APACHE_PATH\\passwd\\user_$ENV{REMOTE_USER}.pwd";
    while(<FILE>) {
        @info = split(/:/);
        print "Username: $info[0], password: $info[1] <BR>";
You get in $info[0] the username, and in $info[1] the password (although,
only if you didn't encode the users password).

Add a new user:
The "-p" switch makes the password stored in plain text. It's necessary if
you want to extract it.

Delete a user:
    while(<INFILE>) {
        @info = split(/:/);
        print OUTFILE $_ if(!($info[0] eq $user_to_delete));
    close(INFILE); close(OUTFILE);
    rename($pwfile.".tmp", $pwfile);
Not nice, but should work (most of the time). I use myself a bit different
approach to do this, where I rather build a buffer from the file, excluding
the row of the user to delete, and then write it directly to the file, so
I'm not 100% that this will work (is the rename syntax right?)

You could of course translate it into any language. Due to the extremly
simple format of user and group files, you can easily implement custom
applications to modify them. If you're interested in this, I could explain
more if needed.

Robert Andersson.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message