Gossamer Forum
Quote Reply
strict refs/hash ref
Hi, im trying to convert the vBulletin authentication plugin to an authentication plugin of my own. Im running into trouble though in the "auth_user" function.

Original:

sub auth_valid_user {
# -------------------------------------------------------------------
# Looks up the user in the user table and compares password.
#
my $args = shift;
GT::Plugins->action ( STOP ); # Make sure we don't run the main code.

# Check that user is in valid group.
if ($AUTH_CFG->{vbulletin_groups}) {
valid_group($args->{Username}) or return;
}
my $sth = $AUTH_DBH->prepare ("SELECT password FROM user WHERE username = ?");
$sth->execute ($args->{Username});
my $pass = $sth->fetchrow; # or return;
$pass or return;
return $pass eq $args->{Password};
}

I modified it to look like:

sub auth_valid_user {

my $args=shift;
my @row;
my $row;
my $sth;

GT::Plugins->action ( STOP ); # Make sure we don't run the main.

my $uusername=$args->{Username};
my $password=$args->{Password};

$sth = $AUTH_DBH->prepare ("SELECT password FROM login WHERE '$uusername'=username");
$sth->execute;


$row=$sth->fetchrow_array;
my $pass = $row;
$pass or return;
return ($pass == $password);

#

}

If the login is successfull it gives the fatal error:
Can't use string ("1") as a HASH ref while "strict refs" in use at /usr/local/apache/htdocs/links/admin/Links/User/Login.pm line 81.

I dont understand because it is returning the same variable type as the original. Also, ive seen this problem on other posts, but its with attachments and dates and stuff, never just a plain old 1.

Any ideas would be awsome!

Thanks
David
Subject Author Views Date
Thread strict refs/hash ref shackman 5583 Jul 19, 2002, 7:21 AM
Post Re: [shackman] strict refs/hash ref
Paul 5487 Jul 19, 2002, 7:26 AM
Thread Re: [shackman] strict refs/hash ref
shackman 5494 Jul 19, 2002, 7:35 AM
Post Re: [shackman] strict refs/hash ref
Paul 5440 Jul 19, 2002, 8:05 AM
Post Re: [shackman] strict refs/hash ref
shackman 5419 Jul 19, 2002, 8:12 AM
Post Re: [shackman] strict refs/hash ref
shackman 5381 Jul 22, 2002, 6:32 AM
Thread Re: [shackman] strict refs/hash ref
pugdog 5393 Jul 22, 2002, 7:33 AM
Thread Re: [pugdog] strict refs/hash ref
shackman 5387 Jul 22, 2002, 7:53 AM
Thread Re: [shackman] strict refs/hash ref
Paul 5404 Jul 22, 2002, 8:00 AM
Thread Re: [Paul] strict refs/hash ref
shackman 5394 Jul 22, 2002, 9:12 AM
Thread Re: [shackman] strict refs/hash ref
Paul 5392 Jul 22, 2002, 9:18 AM
Thread Re: [Paul] strict refs/hash ref
shackman 5388 Jul 22, 2002, 9:25 AM
Post Re: [shackman] strict refs/hash ref
Paul 5372 Jul 22, 2002, 9:31 AM
Post Re: [shackman] strict refs/hash ref
pugdog 5369 Jul 22, 2002, 10:11 AM