What are the potential pitfalls of working with sessions in PHP when the user disables cookies?

When a user disables cookies, PHP sessions may not work properly because sessions rely on cookies to store the session ID. To work around this issue, you can configure PHP to use URL-based session IDs instead of cookies. This way, even if cookies are disabled, the session ID will be passed through the URL parameters.

// Set session.use_only_cookies to false in php.ini
ini_set('session.use_only_cookies', 0);

// Start session with URL-based session ID
ini_set('session.use_trans_sid', 1);
session_start();