Log in

View Full Version : Verifying Username and Password


Shock_CNOP2
05-13-2005, 02:54 PM
I'm attempting to make a program for my site that needs to check if the vBulletin username and password the user enters are correct, but I'm a novice figuring out how vB works enough to adapt my own code. Does anyone know what code I would need to do this? Again, it just needs to verify that the username and password are correct and return either true or false.

Paul M
05-13-2005, 03:24 PM
Check the authentication system out - login.php & functions_login.php.

Shock_CNOP2
05-13-2005, 04:15 PM
Yes, there's this in the functions_login.php:

if ($bbuserinfo = $DB_site->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($username)) . "'"))
{
if (
$bbuserinfo['password'] != iif($password AND !$md5password, md5(md5($password) . $bbuserinfo['salt']), '') AND
$bbuserinfo['password'] != md5($md5password . $bbuserinfo['salt']) AND
$bbuserinfo['password'] != iif($md5password_utf, md5($md5password_utf . $bbuserinfo['salt']), '')
)
{
return false;
}
}

I'm not sure where the encrypted password variables are coming from, like $md5password and $md5password_utf :ermm:

mamboking
05-13-2005, 07:47 PM
I been looking for the code to restrict groups on a non vb page but can't find it. can anyone help? Specifically Users Awaiting Email Confirmation but would like the option of multiple groups.

Thanks a lot

Chris M
05-13-2005, 09:06 PM
I been looking for the code to restrict groups on a non vb page but can't find it. can anyone help? Specifically Users Awaiting Email Confirmation but would like the option of multiple groups.

Thanks a lot
Make sure you require the forums global.php file into your non-vB page, and add something like this to it:


if (in_array($bbuserinfo['usergroupid'], array(x, y, z)))
{
print_no_permission();
}
else
{
//do whatever you want, i.e. what you want the others to see
}

Just replace x, y, z with some usergroups that you want to restrict ;)

Satan

Shock_CNOP2
05-14-2005, 01:15 AM
My thread has just been totally highjacked...