Access to a website only when I grant them access
Ah, you don't need to be doing stuff like that with PHP. Drupal has plenty of tools to handle permissions for users.

Drupal already has the ability to allow you to make sure users need to be approved by an admin - check the user settings.

As for restricting access to "enter" site... well you need to review your user permissions table. "enter" is a pretty vague word to be using in Drupal terms.