Get PHP session id

Hi,

So for audit purposes i need to have the PHP session ID that is created during the Security Login stored in a DB, i could get this via the $_COOKIE[‘PHPSESSID’], but this one is not set on the initial login, only the subsequent logins.

So is there any easy way to get the session id via a session variable or can i hack the ‘Security login’ to return the session id instead of the identity that currently is being returned?

thanks in advance.

The Security Provider creates a PHP session variable called $_SESSION['security1Id'] (if your Security Provider name is security1) which stores the logged in user’s ID. Hope that helps.

Thanks, but as mentioned, …return the session id instead of the identity that currently is being returned. That will not work for me.

Do you know any other options?

I’m afraid I’m not understanding your question, sorry.

Aah, I think I know what you’re after. Something like:

PHPSESSID set to 68268c733f5f733ece9549ae1143308a? I got that from a cookie so I see what you mean. Can you read the cookie straight after a login process and then store that in the DB?

yes, that’s the one i’m referring to :).

well, currently i use that, but it returns NULL allot off times. and from my testing and looking online, this is a common issue. Most are being solved with the use of session_id(), but i can’t add that after the login activity in the server connect files(or i’m missing a something :stuck_out_tongue: ).

OK, not sure I can help here I’m afraid. Hopefully someone else can chip in, though.

Just a random thought, you are remembering to define the cookie in the globals of the server action before retrieving it’s value?

image

yes, that’s exactly how i currently have set it up.