Drupal 7, show drupal blocks only on specific pages with PHP code? I were working on drupal 7. In block configuration, under pages i went for an option 
"Pages on which this PHP code returns TRUE (experts only)"

Added the following code:

&lt;?php
global $user;
$username=$user-&gt;name;
if($username=="admin")
{
   return TRUE;
}
else
{
  return FALSE;
}
?&gt;


It's shows me an error message at the top of the screen:


  Notice: Undefined property: stdClass::$name in eval() (line 3  of C:\xampp\drupal77\modules\php\php.module(75) : eval()'d code).


I don't know, how to fix it out. Please help me out.Thanks
How the $username variable's value will be available there?
If you want to use current logged in user, write it like 
global $user;
and check $user-&gt;name instead of $username.