Hi how can i generate a password using php, to use for the htpasswrd file. which encoding we are using?
+1
A:
It's better to delegate to the htpasswd
app with system()
and the like rather than to roll your own.
Also consider using a database and mod_auth_mysql or similar for auth.
Ignacio Vazquez-Abrams
2009-12-31 06:53:07
+1
A:
here the link
http://www.htaccesstools.com/articles/create-password-for-htpasswd-file-using-php/
<?php
// Password to be encrypted for a .htpasswd file
$clearTextPassword = 'some password';
// Encrypt password
$password = crypt($clearTextPassword, base64_encode($clearTextPassword));
// Print encrypted password
echo $password;
?>
Please note: For Apache servers running on Windows you have to use the htpasswd program to generate passwords, or use the htpasswd generator.
Haim Evgi
2009-12-31 06:53:56