What are the limitations of PHP in accessing information about the user logged into the computer?

PHP has limitations in directly accessing information about the user logged into the computer due to security reasons. However, you can use server-side sessions to store user information once they have logged in and retrieve it as needed within the PHP application.

session_start();

// Store user information in session once they have logged in
$_SESSION['username'] = 'example_user';

// Retrieve user information from session
if(isset($_SESSION['username'])){
    $username = $_SESSION['username'];
    echo "Logged in as: " . $username;
} else {
    echo "User not logged in.";
}