What are the potential risks of allowing only known individuals to access a PHP website?

Potential risks of allowing only known individuals to access a PHP website include limited reach and potential exclusion of new users who may be interested in the content or services offered. To address this issue, consider implementing a user registration and authentication system to allow for controlled access while still allowing new users to sign up and access the website.

<?php
session_start();

// Check if user is logged in
if(!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit();
}

// Your website content here
?>