I converted my proprietary BBS to the Slash user database so that I wouldn't have two separate logins so it can be done... if you are willing to play with some Perl. Here is some relevent code from my conversion. Unfortunately, lameness filter is biting... so forgive any unseenly indentation
Some caveats 1) YMMV 2) I've omitted the code I used to avoid clobbering the admin users at uid's 1 and 2. DIY 3) I'm using some of my own libraries here but I think it's readable. It is similar to DBIx::Abstract 4) This was throwaway code for me (since I only ever ran it once)
#!/usr/bin/perl -w use lib ("../lib"); use strict; use Forum::Local; use Forum::Global; use Forum::Database; use Carp;
$SIG{__WARN__} = \&Carp::cluck;
&main;
sub main { connect_db($DB_CONNECT); $dbh->{RaiseError} = 1; # Get all logins my $userposts = sql_select ('login.*,userinfo.email','login,userinfo',"login. login=userinfo.login"); foreach my $rec (@$userposts) { my $id = $rec->{'login'}; if ($userposts->{posts} > 0) { $rec->{lastlogin} ||= '2001-01-01';
Also, if you are really clever (and UBB is well designed like my own board ) you can have Slash and UBB running concurrently. Look in the Slash/DB/MySQL/MySQL.pm file, grep for the
sub createUser
and add code of your own choice there. For example, I happen to have inserted the line
Something I've done before (Score:1)
Some caveats
1) YMMV
2) I've omitted the code I used to avoid clobbering the admin users at uid's 1 and 2. DIY
3) I'm using some of my own libraries here but I think it's readable. It is similar to DBIx::Abstract
4) This was throwaway code for me (since I only ever ran it once)
#!/usr/bin/perl -w
use lib ("../lib");
use strict;
use Forum::Local;
use Forum::Global;
use Forum::Database;
use Carp;
$SIG{__WARN__} = \&Carp::cluck;
&main;
sub main
{
connect_db($DB_CONNECT);
$dbh->{RaiseError} = 1;
# Get all logins
my $userposts = sql_select ('login.*,userinfo.email','login,userinfo',"login
foreach my $rec (@$userposts)
{
my $id = $rec->{'login'};
if ($userposts->{posts} > 0)
{
$rec->{lastlogin} ||= '2001-01-01';
# Insert into slash users
(my $matchname = lc $rec->{username}) =~ s/[^a-zA-Z0-9]//g;
$rec->{'email'} ||= 'unknown@tam.westhost.com';
sql_insert ("slash.users",{
uid=>$rec->{login},
realemail=>$rec->{'email'},
nickname=>$rec->{'username'},
matchname=>$matchname,
seclev => 1,
passwd => md5_hex($rec->{'password'})
});
# Insert placeholders for slash
my $uid = $id;
sql_insert("slash.users_info" , { uid => $uid, lastaccess => 'no
w()',noquote=>1 });
sql_insert("slash.users_prefs",{ uid => $uid } );
sql_insert("slash.users_comments", { uid => $uid } );
sql_insert("slash.users_index",{ uid => $uid } );
}
else
{
sql_delete ('login',"login=$id");
sql_delete ('userinfo',"login=>$id");
}
}
}
Re:Something I've done before (Score:1)
and add code of your own choice there. For example, I happen to have inserted the line
Good luck