logged_in user outside of wordpress loop

this worked with root cookie:

<?php
define('WP_USE_THEMES', false); 
if (file_exists('../books/wp-blog-header.php')) {
    require_once('../books/wp-blog-header.php');
} else {
    echo 'ERROR: blog header does not exist';
}

global $current_user;
get_currentuserinfo();

# Either load WordPress : http://codex.wordpress.org/Integrating_WordPress_with_Your_Website
# or Manually define your url like...

$cookieurl = "mybooksite.com";

define( 'COOKIEHASH', md5( $cookieurl ) );

$cookiename = "wordpress_logged_in_" . COOKIEHASH;

$sitetitle="Book Viewer";
include 'head.php';


if (isset($_COOKIE[$cookiename])) {
    include ('viewer.php');
} else {
    include ('guest.php');
}

include 'foot.php';

?>

Not sure if there is a better/safer way to do this.