In my last project I had the same task and I think I can help you.
At first you need to include global php such way (it is important):
PHP Code:
$dir = getcwd();
chdir(PATH_TO_VB);
require './global.php';
chdir($dir);
After that you can work with vb's superobject using $GLOBALS['vbulletin'] variable. You mentioned 2 problems - last posts and authentification. OK... To get last posts you can use something like that:
PHP Code:
function get_posts($threadid)
{
$posts = array();
$query = $vbulletin->db->query_read("SELECT * FROM post ORDER BY dateline DESC LIMIT 10");
while($post = $vbulletin->db->fetch_array($query)) $posts[] = $post;
return $posts;
}
Where $vbulletin is vb's superobject.
And now about users. Look at $vbulletin->userinfo property, it contains information about logged user.