If you include vB's global.php on your php page, it basically does what you're looking for I'm pretty sure.
PHP Code:
// Near or at the begining of the php file
require_once('./global_stock.php');
Then something like this....
PHP Code:
if ($bbuserinfo['userid']){
// If they are logged in, then do this
//stuff here
}
else{
// If they aren't logged in, do something else here.
}
.... furthermore... (correct me if I'm wrong), but you can do a check to see if someone ISN'T logged in by adding an exclamation mark...
PHP Code:
if (!$bbuserinfo['userid']){
}