Skip to main content
May 29, 2009
Question

use php session whithin flash button?

  • May 29, 2009
  • 1 reply
  • 1261 views

Hello,

I'm using Flash to do the visual work of an php website, but I got a really big problem here.

I've a find textfield and a find button, calling a php function, working almost perfectly, but... if user is not logged.

if he is I can't find a nice way of tell flash that user is logged and that he must pass to php the string to find and the session variable I need to make this work like a charm.

I use this litle code as my flash button action

var path_php:URLRequest = new URLRequest("produtos.php?javascript:*checkTermo*();&pT="+pesquisa.text+"&search=1");

navigateToURL( path_php , "_self" );

How to include & session['d']&session['o']  ?  (those are php sessions)

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 29, 2009

your urlrequest has a data property that can be assign a urlvariable instance and the urlvariable instance can be assigned properties and variables:

var urlVar:URLVariables=new URLVariables();

urlVar.d=whateever;

urlVar.o=whatever else;

path_php.data=urlVar;

path_php.method="POST" or "GET";

May 29, 2009

Hello Kglad, thanks for reply,

no, I need the oposite,

the website has a login sistem, witch will start a session.

now, I've a find field, and I need to know in flash if that user has previleges to view some database records, based on the session value login retrieved.

so lets say, I do login, and my php does $_session['d'] ==sim;

when trying to find something I load a script, but I need to know that 'd' == sim or 'd' == nao

thanks

Pluda

kglad
Community Expert
Community Expert
May 29, 2009

if you need to get data returned from your php file, you should use the urlloader class to call your php file so you can use its complete event to parse the returned data:

var urlLDR:URLLoader=new URLLoader();

urlLDR.addEventListener(Event.COMPLETE,f);

urlLDR(your urlrequest);

function f(e:Event){

urlLDR.data contains the data returned by your php call.  for you, that looks like a string that you'll need to parse

}