Where is the Php source code for generating the unique session sequence?

StackOverflow https://stackoverflow.com/questions/23312319

  •  10-07-2023
  •  | 
  •  

سؤال

I've not found any session handling with mod_lua. So I guess I'll have to write my own session handler. Note: that's great because Php lacks of handling timeouts by values, it only handles timeout for the whole session.

I'm just looking for the source code of Php where it generates the unique number of the session, to make it with mod_lua.

I've downloaded the whole Php code source but... I don't know where to look.

هل كانت مفيدة؟

المحلول

Why not just use r.log_id to get a unique number? or something like:

local session_id = r:getcookie("lua_sessionid")
if not session_id then 
    session_id = r:sha1(r.log_id .. r.clock())
    r:setcookie{
        key = "lua_sessionid",
        value = session_id
    }
end

Alternately, see http://modlua.org/recipes/cookies for how to work with cookies and unique IDs.

نصائح أخرى

The code for generating PHP session ids is in php_session_create_id, which is available for anyone to view at https://github.com/php/php-src/blob/0021095c40a2c2d3d95398c48ae83a06f1381f71/ext/session/session.c#L284

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top