Skip to content

Instantly share code, notes, and snippets.

@loganlinn
Created January 23, 2011 19:41
Show Gist options
  • Save loganlinn/792359 to your computer and use it in GitHub Desktop.
Save loganlinn/792359 to your computer and use it in GitHub Desktop.
Forces a login into vBulletin (4.x) using just a username
<?php
class vBulletinUser{
public static function login($username, $remember_me = false){
chdir(VB_ROOT_PATH);
require_once('./global.php');
require_once(DIR . '/includes/functions_login.php');
global $vbulletin,$vbphrase;
$remember_me = $remember_me ? true : false; //force to true or false value
$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids,
username, password, salt FROM ".TABLE_PREFIX."user WHERE username = '".
$vbulletin->db->escape_string(htmlspecialchars_uni($username))."'");
if ($vbulletin->userinfo){
process_new_login($vbulletin->GPC['logintype'], $remember_me, $vbulletin->GPC['cssprefs']);
exec_shut_down();
return true;
}
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment