Home / Software / vBulletin / How can I tie into my vbulletin user database from a perl script?
How can I tie into my vbulletin user database from a perl script?
Last updated: 02/08/2012
Sometimes you may want to verify a username / password matches up to a valid vbulletin user, from a perl script. Here's a snippet of code to query the vbulletin database and test the user:
use Digest::MD5 qw(md5_hex); use DBI; my $db_user = "dbuser"; my $db_pass = "pass"; my $dsn = "DBI:mysql:DBNAME:HOSTNAME";
$dbh = DBI->connect($dsn, $db_user, $db_pass);
my $sql = "SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM vb_user WHERE username = '" . $form{'uname'}. "'"; my $sth = $dbh->prepare ($sql); $sth->execute(); my $h_ref = $sth->fetchrow_hashref(); $sth->finish(); if($h_ref->{'password'} != '' && $h_ref->{'password'} eq md5_hex(md5_hex($form{'upw'}).$h_ref->{'salt'})) { # This matches