What you can do is create cross-links between sites to transfer the session.
The easiest way is to pass the session ID through the query string; eg.
http:
Before you start to think that someone can lure this information, think about how your cookies are transferred; assuming you are not using SSL, there is not much difference for those who use the network.
This does not mean that it is safe; firstly, users can accidentally copy / paste the address bar and thereby test the session. To limit this impact, you can immediately redirect to a page without a session identifier after receiving it.
Please note that using mcrypt() in the session identifier will not help, because it is not the visibility of the value, which is the problem; session capture does not care about the base value, only its reproducibility of the URL.
You must ensure that the identifier can only be used once; this can be done by creating a session variable that tracks the usage score:
$_SESSION['extids'] = array(); $ext = md5(uniqid(mt_rand(), true)); // just a semi random diddy $_SESSION['extids'][$ext] = 1; $link = 'http://othersite/?' . http_build_query('sessid' => session_id() . '-' . $ext);
Upon receipt:
list($sid, $ext) = explode('-', $_GET['sessid']); session_id($sid); session_start(); if (isset($_SESSION['extids'][$ext])) { // okay, make sure it can't be used again unset($_SESSION['extids'][$ext]); }
You need these links every time you cross the border because the session may have been restored since the last time.
Ja͢ck source share