What are the potential issues with using both session variables and cookies for user authentication in PHP?

Potential issue: Using both session variables and cookies for user authentication can lead to security vulnerabilities, as cookies can be easily tampered with by malicious users. It is recommended to use only session variables for user authentication to ensure a more secure approach.

// Set session variables for user authentication
$_SESSION['user_id'] = $user_id;
$_SESSION['username'] = $username;