What are the potential pitfalls of not manually passing the session_id in every link in PHP?

Not manually passing the session_id in every link in PHP can lead to session fixation attacks, where an attacker can fixate a user's session ID and potentially gain unauthorized access to the user's account. To prevent this, it is important to regenerate the session ID on every page load and ensure that the session ID is properly passed in all links and forms.

// Start or resume a session
session_start();

// Regenerate session ID to prevent session fixation attacks
session_regenerate_id(true);