Re: htaccess password encryption

From: Date: Tue, 19 Feb 2002 22:34:53 +0000
Subject: Re: htaccess password encryption
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-12152@lists.php.net to get a copy of this message
On Mon, 11 Feb 2002 14:06:27 +0100 "Martin.Andrew" <Martin.Andrew@kpmg-ct.com> wrote: > Does anyone know how to encrypt a password for use in htaccess? > > I creating a secure environment using PHP, I create the directory structure > and htaccess files dynamically based on php forms / sessions but I'm having > problems encrypting the password for the htpasswd file for apache. > > I have see many examples but most seem to be perl scripts which I don't want > to use! > Can it be done with PHP? Maybe you can use the "exec" function to execute the htpasswd.exe utility that comes with Apache for Windows. $path_to_htpwd = "\"C:\\Program Files\\Apache Group\\Apache\\Bin\\htpasswd.exe\""; exec(getenv("COMSPEC")." /c $path_to_htpwd -c -b $filename $username $password"); Note that the "-c" flag will create a new file or overwrite an existing one. If you want to append new usernames and passwords to an already existing file, remove the "-c" flag. I tested it on my machine and it worked. Cheers, Rubén Gutiérrez

« previous php.windows (#12152) next »