Access to a website only when I grant them access I have made a registration form and a login form using PHP.

The registration form saves user's information to a database.

But as I am pretty new to PHP I want to achieve this think. I have also made a whole e-commerce website with Drupal commerce(commerce kickstart) but I want as an entrance page to be this registration form and when I grant them access to be able to see the whole content of my e-commerce website.While i say grant them access when they give me the fields of the registration form,they wont be able to enter the website until I send them a password. So my question is : How can I achieve not be able to see the entire website?What I need to do to protect it? I mean I need to add code on the registration form? on the login form or the template/theme?

I know that I have to use $_SESSION[] and $_COOKIE[]

For example

if($_SESSION['loggedIN'] ===false){ header('location:login_page.php')}


but I do not know where to put the code so as to work. In which part of the commerce kickstart do I have also to say that the e-commerce website would be on a sub-domain as the domain will be used for the registration form if this helps.

Thanks!
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.