Hi,
I have been using a perl script that was posted here a long time ago (w3t days) to synchronize a .htaccess password file with the passwords in the forum database.
After upgrading from 5.4.3 to 6.1.1 the script still works and creates the userfile.
However the password encryption has changed to md5 on ubbt. As new users are registered and old users change their passwords the database contains passwords encryped with the old and new methods.
Now the password file the script creates contains some passwords encrypted the old way, and some passwords encrypted with md5 the new way.
Since i used AuthType Basic in my .htaccess the newly md5 encrypted passwords are not recognized.
If I make the proper changes to use AuthType Digest is it backwards compatible to also accept the old style encrypted passwords? If that is not possible. Is there a way i can tell the database to re-encrypt everyones current passwords with md5? so i can exclusively use AuthType Digest.
Thanks
Here is the script i use:
#!/usr/bin/perl
################################################
# A script for converting users in the w3t_Users table into an
# .htaccess file
# Edit the $path variable and run this from the command line.
# Make sure you have permission to create and write to files in the
# directory you specify with $path.
# Rick Baker []
[email protected][/]
################################################
use w3tvars qw(%config);
use w3t qw($dbh);
use strict;
# --------------------------
# Path to the .htaccess file
my $path = "/home/httpd/databaseusers/dbusers";
# -----------------------
# Connect to the database
w3t::db_connect();
# -----------------------------------------------------------
# Grab all of the usernames and passwords out of the database
my $query = qq!
SELECT U_Username,U_Password
FROM w3t_Users
!; my $sth = $dbh -> prepare ($query) or die "Query syntax error: $DBI::errstr. Query: $query";
$sth -> execute() or die "Can't execute query: $query. Reason: $DBI::errstr";
# ------------------------------------------------
# Now we cycle through the rows and print them out
open (FILE,">$path") or die "Can't open $path for writing.";
while (my ($User,$Password) = $sth -> fetchrow_array) {
print FILE "$User".":"."$Password\n";
}
close (FILE);