What are the potential security implications of manually setting session IDs in PHP?

Setting session IDs manually in PHP can lead to security vulnerabilities such as session fixation attacks. To mitigate this risk, it is recommended to regenerate the session ID after a user logs in or performs any sensitive action.

<?php
session_start();

// Regenerate session ID after login
if(isset($_POST['login'])) {
    session_regenerate_id();
    // Perform login logic
}
?>