Code for page access I would like to use PHP code in nodes of a specific content type. I can check the user's permission with the global $user if the user can access the node.

Is there any module to set view for created page content?
Is it secure to check page access with this code?

global $user;

// Check to see if $user has the administrator role.
if (in_array('administrator', array_values($user-&gt;roles))) {
  // Do something.
}
I think you are looking for a node access module. There are many of them, for example http://drupal.org/project/content_access (configure access with roles directly) or http://drupal.org/project/tac_lite (control access by adding special taxonomy terms) and many more.

For your second question, you should always define some permissions (with hook_perm in D6, hook_permission() in D7) and then check that. That allows to configure through the UI, which roles have that permission and the code is not tied to your specific configuration.