What are the potential security risks of manipulating session cookies in PHP?

Manipulating session cookies in PHP can lead to security risks such as session hijacking, where an attacker gains unauthorized access to a user's session by stealing their session cookie. To mitigate this risk, it is important to ensure that session cookies are properly secured and validated to prevent unauthorized access.

// Set session cookie parameters to secure and HTTP only
session_set_cookie_params([
    'secure' => true,
    'httponly' => true
]);

// Start the session
session_start();