How do I do sessions with a Flash client?

前端 未结 2 1072
一生所求
一生所求 2021-01-28 11:34

Since the Flash Player (or, more exactly, the URLLoader class) will not let you read HTTP response headers or cookies set by the server, and if you get hold of a session cookie

相关标签:
2条回答
  • 2021-01-28 11:44

    Some of your post may have eluded me, but do you know about Shared Objects:

    "The SharedObject class is used to read and store limited amounts of data on a user's computer or on a server. Shared objects offer real-time data sharing between multiple client SWF files and objects that are persistent on the local computer or remote server. Local shared objects are similar to browser cookies and remote shared objects are similar to real-time data transfer devices.

    0 讨论(0)
  • 2021-01-28 11:53

    How about using the FlashVars parameter? It's designed explicitly to pass simple data into a Flash app, and it's trivial to embed the session token into the tag when the page is generated server-side. PHP-wise, it'd be something like

    <embed href="movie.swf" flashvars="sessionID=<?= session_id(); ?>">blah blah blah</embed>
    

    This way there's no session data in the movie's url that could leak via referers, and the data's already "there" so the app doesn't have to reach out and talk to the browser. And if someone's sniffing the source HTML page to get the data, they could have gotten the same information from the HTTP headers anyways.

    There's more details here in the Adobe docs.

    0 讨论(0)
提交回复
热议问题