Gossamer Forum
Home : Products : DBMan : Discussions :

Users log in info

Quote Reply
Users log in info
I found the default.pass file created by dbman. I see it stores the user name, encyrpted password and the users permissions. Is it possible to run a script to write this file from a table in a mysql database? Maybe have this script run on a cron so the table and the password file are in sync daily. Is the password done in a standard encyrption? Can this encyrption be invoked on the fly? My source table is from wwwthreads forum package. I am trying to allow one set of passwords and usernames for my users.

Thanks Dale

Quote Reply
Re: Users log in info In reply to
One suggestion is to use DBMAN SQL.

Regards,

Eliot Lee

Quote Reply
Re: Users log in info In reply to
I would love to, but my site is negative cash flow. It is just for fun. If I ever start to accept money for ads or make it commercial I still owe Alex for Links 2. Thanks for the suggestion though.

Dale

Quote Reply
Re: Users log in info In reply to
oops!
Quote Reply
Re: Users log in info In reply to
Well, here are some more suggestions:

1) Download MySQLMan and IMPORT your default.pass file periodically into your Users table that you use for WWWTHREADS.

2) Write a script that IMPORTS data from the default.pass into the Users table and then execute that script via Crontab...or embed the IMPORT codes into your auth.pl file (although you would have to re-write basically the whole script to use strict and CGI.pm).

Weighing support time, time it takes to custom the scripts, and also sanity level...in time, purchasing DBMAN SQL would save you a lot of headache and time. "Time is Money!"

Regards,

Eliot Lee

Quote Reply
Re: Users log in info In reply to
I found a script at wwwthreads that will take my users table and output it to a .htaccess file. Here is the script.

#!/usr/bin/perl
my $dbengine = "mysql"; #presumably...
my $db = "wwwthreadsdatabase"; #or whatever you set in install
my $dbuser = "someuser"; # or whatever is configured in w3t...
my $dbpass = "passwordfordatabasereads"; #a password with select privs on the table
my $dsn = "DBI:" . $dbengine .":" . $db;
use DBI;

my $dbh = DBI->connect($dsn, $dbuser, $dbpass) || die "could not connect $!\n";
open(OUTFILE, ">/path/to/.htacess") || die "could not open file for writing $!\n";

my $statement = <<EOS;
SELECT U_Username, U_Password
FROM w3t_Users
EOS

my $sth = $dbh->prepare($statement);
my $rv = $sth->execute();

my $record;
while ($record = $sth->fetchrow_arrayref() ) {
print OUTFILE "$record->[0]:$record->[1]\n";
}
my $rc = $sth->finish;
$rc = $dbh->disconnect;
close OUTFILE;

Can the script be set to output to a different file than .htaccess? Would I just change
(OUTFILE, ">/path/to/.htacess") to
(OUTFILE, ">/path/to/nameIwant") .

Can I get the output to format like default.pass?

U_Username:U_Password:1:1:1:1:

Thanks for the suggestions
Dale


Quote Reply
Re: Users log in info In reply to
In Reply To:
Can the script be set to output to a different file than .htaccess? Would I just change
(OUTFILE, ">/path/to/.htacess") to
(OUTFILE, ">/path/to/nameIwant") .
Possibly...

In Reply To:
Can I get the output to format like default.pass?

U_Username:U_Password:1:1:1:1:
Probably with a lot of tweaking.

Regards,

Eliot Lee


Quote Reply
I tried it In reply to
I tried to get it to output. It did output to the desired file just by changing the address. My output was in the format username:encryptedpassword already. I will try to add new fields to my table and see if I can export them at the same time. Wish me luck.

Thanks for the Help and encouragement.
Dale


Quote Reply
Re: I tried it& it failed In reply to
I added a field to my user table and named it U_DBView I set it as a 1 default so ever user would be a 1. I added this line
my $statement = <<EOS;
SELECT U_Username, U_Password, U_DBView
FROM w3t_Users
EOS

to the script. When I executed I did not get any extra output to the desired file. Any Ideas on how to get the extra field included?

Thanks
Dale


Quote Reply
Now it works In reply to
my $record;
while ($record = $sth->fetchrow_arrayref() ) {
print OUTFILE "$record->[0]:$record->[1]:$record->[2]\n";

I added the bold line to get the output to be included. I will just add the fields to corespond with add:delete:modify:admin and hopefully all should work.

Thanks for the inspiration.
Dale

P.S. Just like JPDenni said at her site I am very excited that I got this working with mostly my own editing. Now if I only understood what those lines I added were....