문제

I am trying to, for a login script, set a session ID using POST in python on apache. However, there doesn't appear to be any method to doing it as far as I can see other than just doing a redirect. Also, now that I have a session ID, I can use any method to set a session ID (POST seemed the most obvious). I would also like for it to work between tabs. Cookies seems like it might be a better option, though it would probably take more effort to implement. Any suggestions?

도움이 되었습니까?

해결책

Turns out apache has a cookie module.

from mod_python import Cookie
ID = Cookie.get_cookie(req, 'ID')
if ID:
    ID.expires = time.time() + 60*120
    Cookie.add_cookie(req, ID)
    ID = ID.value
else:
    ID = None
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top