You can define the parameters like the cookie name and domain, so you should be able to do what you want here. There is already functions though that can do things if a user is logged in. For example:
<?php if (bb_current_user_can('write_posts')) : ?>
<?php endif; ?>
This has it so if the user is logged in and can write posts (default member) then do something or put in a piece of code.
Hope that helps.