CodeIgniter Forums
Accessing Session Id - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Accessing Session Id (/showthread.php?tid=76855)



Accessing Session Id - 68thorby68 - 06-27-2020

Hi,

I am a little confused as how to access the Ci4 session id to ensure the correct session is being used.  In the past I would store the session id in the database and validate against the database when sensitive data is accessed, however Ci4 documentation recommends using the FileHandler Driver, which I have no problem with, but I'm not sure how this is used. 

Assuming I start a session at user login, how do I validate the browser session id with the session id stored in the filesystem?

Thank you in advance?


RE: Accessing Session Id - dave friend - 06-27-2020

(06-27-2020, 03:36 AM)68thorby68 Wrote: Hi,

I am a little confused as how to access the Ci4 session id to ensure the correct session is being used.  In the past I would store the session id in the database and validate against the database when sensitive data is accessed, however Ci4 documentation recommends using the FileHandler Driver, which I have no problem with, but I'm not sure how this is used. 

Assuming I start a session at user login, how do I validate the browser session id with the session id stored in the filesystem?

Thank you in advance?

PHP Code:
$sid session_id();