For this we can use the session object ($_SESSION). When the user login with his/ her user name and password, usually we check those to ensure for correctness. If that user name and password are valid one then we can store that user name in a session and then we can very that session variable has been set or not in a single files and we can include that file in all pages.
You can also use a header based approach, i.e. have a PHP include file which does necessary checking on user logged in or not. Include this file in other files.