Hi,

I want to build a web interface to protect a folder with user name and password.
I want to give different user names and passwords, I would like to store informations about users into a table so that I can re-use them as the user is logged, and also I need to be able to add users from a web page using the unix/apache command "htpasswd" .

So, in other words, I need to protect a folder using .htpasswd method, I need to add or remove users from this file and also I need to find a way to "catch" username and password so that I can find related user info into the database...

Have you got dome suggestions to give me about ?

Where can I find some sample code about adding users to a folder in a Unix machine running Apache web server ?

One way could be to have only one user name and password to access to the protected folder and verify the user into the Mysql Database...but in this way I don't know how to directly pass default username and password via HTTP without the prompt for authentication...

thank you very much for your help !
Fabio

    I must say that you want lots of things :-).

    First, it isn't a ".htpasswd" method, because .htapsswd is only the file where usernames and passwords are stored.
    It's more convinient to call your method .htaccess method, because you'll use exactly that file to lock your directories.

    If you want to use usernames from .htpasswd and possibly store some them in MySQL while inserting or updateing data for example, you can reach for enviromental variables:

    $user = "$REMOTE_USER";
    That will give you your username for example.

    Question is what you exactly want to do, your wishes are quite vaguely for me at this point.

      Thank you for your help, I alredy get some useful info !

      What I want to know ?

      a) How to add users to .htaccess files using a .php3 script.

      b) Or how to pass user name and password from a PHP3 script to a www link that points to the protected folder with unic user name and password. (I check user before and than if user is ok I allow them to enter into the protected are...but to do this I need to enter in this folder and so give the username and password but without browser prompt..is it possible? )

      Thank you

        Is there also a http call to know the password ?

        Now, thank s to your suggestion, I can get the user name but I would like to have also password, is there a something like REMOTE_PASSWD available ?

        Or where can I find reference about this kind of statemets?

        Thank you

          Yes, you can get password through enviromental variables also.

          The best way for you is to create a script:

          <?

          phpinfo()

          ?>

          The script will tell you which enviromental variables you can use at your machine.

          Slaven

            Write a Reply...