开发者

Establish independent server session for an ajax request?

I have a set of PHP server side scripts that maintain user session state using PHP sessions extensively throughout for a logged in use开发者_开发知识库r.

Client side in a mobile app, via Jquery ajax, I need to establish an independent session (authenticated as a different user) that does not disrupt the already established session. In other words, to the server it must look like a different browser session.

Is there a way to programmatically accomplish this with Jquery/Javascript client side for only a specific request?


Sessions in PHP are transmitted using an identifier, which is generally passed as a cookie -- see the Passing the Session ID section of the manual.

This means that if that identifier (cookie) is not passed to the Ajax query, then, the PHP script called via that query will not consider that the user is the same ; and will see him as a different one.

So, basically : you must find a way to not pass that session identifier, when doing your Ajax request.
Of course : don't delete the cookie : it must remain here, for the other kind of requests, if you don't want your use to lose his session.


Maybe, but it probably would be better to use a different server/domain that doesn't share session information with the original server/domain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜