PHP检查是否设置了用户名

All im trying to do is see if the username is set in the cookies, ive tried isset() and empty() with no luck. Also i tried $HTTP_COOKIE_VARS['username'] and $username with those functions and the php does nothing no matter if the cookie username is set or not. Web pages are fake, but i use real ones that i know work in my code.

 $HTTP_COOKIE_VARS['username'] = $username;

 if(isset($HTTP_COOKIE_VARS['username']))
 {
 header("page2.html"); 
 }

 else {
 header("page1.html"); 
 }

Try header('Location: page2.html') and header('Location: page1.html') instead.

Uh...

isset($_COOKIE['username']);

Also, you're using set_cookie to define cookies, correct? (Prolly a stupid question, sorry.)

Edit: Yeah, nevermind, the "Location: " header suggestion Daniel mentioned should do the trick (and the HTTP_*_VARS are deprecated since PHP 5, but I decided not to mention that :P).

if(isset($_COOKIE['username'])){
   header('Location: page2.html');
}else{
   header('Location: page1.html');
}