Re: related to my .htgroup question...
| From: | Richard Lynch | Date: | Sat, 10 Mar 2001 01:33:15 +0000 |
| Subject: | Re: related to my .htgroup question... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43265@lists.php.net to get a copy of this message | ||
> Ok, so I want to be able to do some things with php.
> 1) add a user to the .htpasswd file
> I know I can use exec() to run commands on the server. The problem here
is
> that when I do "htpasswd .htpasswd username" I get prompted for passwords
> twice. How the heck can I do that with php? Will this work (I just
thought
Normally, you could exec("echo $password\n$password\n | htpasswd .htpasswd
username);
But, not only does htpasswd require input, it requires that you be on a TTY
(ie, a real login) not just PHP.
This is just plain not going to work unless you munge the file by hand.
> of this right now...):
> exec("htpasswd& .htpasswd username");
> exec("password");
> exec("password");
> If this works, that would be great. I would assume that after this, the
> program stops and I don't have something running in the background.
>
> 2&3)edit the .htgroup and .htaccess files
> I have no idea how to do this at all whatsoever. I don't want the person
> running this script to have to see or touch the file at all, but I'm
> thinking that I'm going to have to, like, read the file into a textarea
and
> make the user edit it and then save it again. That's going to be a pain
in
> the butt when the user is office personnel that doesn't know this stuff
from
> french.
>
> Throughtout this all, I don't want any output. I just want the scripts to
> run and then redirect back to the page it was submitted from. Whew...any
> ideas? I'm not going to have to learn perl just for this am I? ;^)
Not sure Perl is going to be any better at this.
Sounds to me like you should *not* be using .htaccess if you need this much
flexibility.
Look into mod_auth_mysql or using PHP to send the authentication headers.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm