What's wrong with this code? function welcome_menu() {
  $item=array();
  $item['welcome'] = array(
    'title' =&gt; 'welcome',
    'access callback' =&gt; 'welcome_init', 
    'page callback' =&gt; 'welcome_test',
    'type' =&gt; MENU_CALLBACK,
  ); 

  return $item;
}

/*
 * Implements hook_init().
 */
function welcome_init() {
  if (empty($GLOBALS['user']-&gt;uid)&amp;&amp; arg(0)!='welcome') {
    drupal_goto('welcome');
  }
}

function welcome_test() {
  $output = 'welcome';
  return $output;
}


I want to auto redirect the anonymous users to the login page, and avoid that an authenticated user can see this page. how I use user_login_block() as page callback?
The most obvious thing is that it does not follow Drupal's coding standards at all. It makes it very difficult to read.

hook_init() is it's own hook, it should not be used as an access callbacks. Access callbacks need to return either TRUE or FALSE.