Are there any security implications with sessions that include sessid in the URL?

Including the session ID (sessid) in the URL can pose security risks as it exposes the session ID to potential attacks, such as session hijacking. To mitigate this risk, it is recommended to use cookies to store the session ID instead of passing it in the URL.

<?php
// Start session
session_start();

// Set session ID in a cookie
$session_name = session_name();
$session_id = session_id();
setcookie($session_name, $session_id, time() + 3600, '/');

// Use session as usual
$_SESSION['user_id'] = 123;
?>