문제

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