Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SID not showing

Tags:

php

I cannot get my SID working ...

<?php
session_start();
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';?>

does not show up SID number but session_id is working not sure if I am missing something. THnks

like image 727
coool Avatar asked Dec 08 '22 07:12

coool


2 Answers

The SID constant will show an empty string if a a cookie with the name of session.name has been detected by PHP. See the manual page. That means, that SID will contain a useful string only before the session cookie has been sent to the browser.

That also means that if a browser refuses cookies the SID constant will work. Provided that seesion.use_trans_id is enabled, as Gumbo said.

like image 145
Ionuț G. Stan Avatar answered Dec 22 '22 11:12

Ionuț G. Stan


You need to have session.use_trans_sid enabled to have PHP accept a session ID passed by either GET or POST.

like image 36
Gumbo Avatar answered Dec 22 '22 12:12

Gumbo