Check if administration toolbar is visible
I think using the user_access function to see if they have the "access toolbar" permission should work.

Some example code:

if (user_access('access toolbar')) {
  // Your logic here.
}