This is a working script (tested on VB 5.0.1) that will create a random user and then log them in using their ID. If you already know a users ID then you can just log them in using the log_user_in function.
PHP Code:
<?php
chdir("forum/core/"); // change to your core folder location
require_once("global.php");
function create_random_user(){
$dataman =& datamanager_init('User', $vbulletin);
$dataman->set('username', "user".rand());
$dataman->set('email', rand()."@domain.com");
$dataman->set('password', "leighf");
return $dataman->save();
}
function log_user_in($userid){
$user = fetch_userinfo($userid);
$auth = vB_User::verifyAuthentication($user['username'], "leighf", $user['password'], $user['password']);
$res = vB_User::processNewLogin($auth);
vbsetcookie('userid', $res['userid']);
vbsetcookie('password', $res['password']);
vbsetcookie('sessionhash', $res['sessionhash']);
}
// create random user
$userid = create_random_user();
// log them in
log_user_in($userid);
It's a script in its simplest of states. The usernames password is hardcoded but assuming you know what's going on in the above snippet, you'll be fine adding this yourself.