I just had to fix this code on my site because it used to check $current_user->user_level but that member seems to have disappeared. Here’s the code I use now:
// Authenticate a wordpress user
define('WP_USE_THEMES', false);
require('../wp-blog-header.php');
global $current_user;
get_currentuserinfo();
if ($current_user->ID == 0)
{
echo "You must be logged in to access this page. Click <b>Register</b> or <b>Log in</b> in the menu on the right side.";
exit;
}
else
{
// User is logged in
}