Gossamer Forum
Home : Gossamer Threads Inc. : Custom Modification Jobs :

Users Importing Script

Quote Reply
Users Importing Script
Hi



I am looking for a way to import a flat database of users (almost 5000) from several services I am using to Links SQL users database..

I only Have the E-mail address for those users and The current import utility in Links will not auto create the user name..

If anyone has a way to do this through a script or a plug in I will be welling to pay for it.. I am trying to save hours of manual work here..
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Users Importing Script In reply to
Please see PM I'm about to send you Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Users Importing Script In reply to
Thanks

See the reply
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Users Importing Script In reply to
Code:
#!/usr/bin/perl
#=====================================================
# User importer by me.
#=====================================================

use lib '/path/to/admin';
use Links qw/$DB $IN/;

Links::init('/path/to/admin');

$| = 1;

main();

#=====================================================

sub main {
#-----------------------------------------------------
# Import the users.

my $user = $DB->table('Users');
my $class = __PACKAGE__;

open DB, "/path/to/users.db" || die $!;
while (chomp ($_ = <DB>)) {
$user->insert( { Username => $class->rand, Password => $class->rand, Email => $_ } );
print "Imported: $_\n";
}
close DB;
}

sub rand {
#-----------------------------------------------------
# Generate a random username.

my $chr = ['a'..'z', 'A'..'Z', 0..9];
my $rnd;

$rnd .= $chr->[rand @$chr] for (1..8);
$rnd;
}

That should work depending on the format of your file. You'd run it from telnet/ssh like:

perl importer.cgi
Quote Reply
Re: [Paul] Users Importing Script In reply to
Thanks Paul

That did not work

It is telling me :

Can't locate Links.pm in @INC (@INC contains: /home/virtua
cgi-bin/links/admin /usr/lib/perl5/5.6.0/i386-linux /usr/l
b/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_per
/site_perl .) at importer.cgi line 7.
BEGIN failed--compilation aborted at importer.cgi line 7.

The users.db file I have is a list of emails like

someone@somedomain.com

someone@domain2.com

....

Any suggestions?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Users Importing Script In reply to
It should work fine as long as you have the path to the Links SQL admin directory correct and Links.pm exists within it (which it should otherwise Links SQL would spew errors).
Quote Reply
Re: [Paul] Users Importing Script In reply to
Thanks Paul



It will work only when I put the script in the admin directory and do not ask me why...Unsure



Thanks a lot you just saved me $20 buddy Cool
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory