I have made a website and put inside it a flash game.
For people to play the game they have to log into the website.
Logging to the website will create a session. I want for the flash game to get the session id ,
so I have created a function that gets the session id. It works only in Internet Explorer and
when I tried it in Chrome, it didn't retrieve the session id.
So any help?
I have written a php file that will be used by the as3 to get the session id, the php code is this:
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
require('libraries/joomla/factory.php');
class session
{
public function getId()
{
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
$user_id = $user->get('id');
//echo($user_id);
return $user_id;
}
}
?>
When i tried the flash in IE, the flash got the correct session id, but in Chrome it didn't.
您可以尝试将cookie中存储的会话标识符传递给嵌入式Flash,然后将Flash作为参数传递给服务器,以识别和初始化会话。
I wrote this about 5 years ago:
http://www.rooftopsolutions.nl/blog/117
My final solution was to use an alternative token (not the same as the session cookie, for security). The token would get embedded in the tag as a flashvar. The flash player would then manually send along this token with every HTTP request.
Lastly, on the server, I would match the token with the real session id, and call session_id()/session_start().
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.