PDA

View Full Version : Using Flash Lite with PHP _SESSION


Titola
01-04-2011, 06:48 PM
Hi,
I am trying to stablish a strong relation between Flash Lite and PHP but I don't know what is wrong. I explain it..
I have two PHP scripts, I use the first to stablish the session and set some variables:

<?php

session_start();
$_SESSION['idusuari']=$userid;
$_SESSION['paraul']="skynet";

?>&RespostaConnexio=2&&paraula=<? echo ($_SESSION['paraul']);
?>&<?

?>

The second PHP is:

<?php

session_start();
if(isset($_SESSION['paraul']))
{
$_SESSION['paraulado']=$_SESSION['paraul'];

?>&RespostaConnexio2=2&&paraulados=<? echo ($_SESSION['paraulado']); ?>&<?
}
else
{
echo 'No funciona isSet<br>';
}
?>

and the Flash script is:

var Enviament:LoadVars = new LoadVars();
var Enviament2:LoadVars = new LoadVars();
var FeedBack:LoadVars = new LoadVars();
var FeedBack2:LoadVars = new LoadVars();

missatge_txt.text = "connectant...";
Enviament.sendAndLoad("myserver/TornaParaula.php", FeedBack, "POST");

FeedBack.onLoad = function(exit)
{
if (exit)
{
switch (this.RespostaConnexio)
{
case "2" :
if (this.paraula.length > 0)
{
missatge2_txt.text = this.paraula;
break;
}
else
{
missatge2_txt.text = "Error";
break;
}
break;

default :
missatge_txt.text = "error";
break;
}
}
else
{
missatge_txt.text = "No connection";
}
}
function login2()
{
missatge_txt.text = "connectant...";
Enviament2.sendAndLoad("myserver/TornaParaula2.php", FeedBack2, "POST");
}
FeedBack2.onLoad = function(exit2)
{
if (exit2)
{
missatge2_txt.text = "this.paraulados: "+this.paraulados;
switch (this.RespostaConnexio2)
{
case "2" :
missatge_txt.text = this.paraulados;
break;
}
}
else
{
}
}
stop();


Everything is Ok if I compile it as Flash 10 AS2 and run it from my PC, but when I compile this Flash Script as Flash Lite 3.0 AS2, I don't receive 'paraulados' from the server. Simply I receive an empty string.

So, my question is if Flash Lite can't interact with PHP _SESSION, or if, maybe, PHP don't handle the cookies in the same way for Flash Lite?

Any suggestion would be appreciated
Thanking in advance