Accessing PHP variables (especially _SESSION)

Hi,
since CaioToOn! suggested here that I should use $_SESSION and I need to do this anyway, I spent the last 1+ hours trying to figure out how to do that. Sadly, I could not really figure it out except that there seems to be an issue with the session ID and that it has to be passed along to the swf file.
Can somebody please tell me how to read/write from/to PHP variables (not $_GET)?
P.S.: Here a simple example code (test.php and then the testintro.fla AS code):
<? session_start();
$_SESSION["intro"] = 0;     // has the intro been played?
...     // code for including the swf
?>
if(intro == 0)
     myclip.gotoAndPlay(2);   // play intro
     intro = 1;
else
{ myclip.gotoAndPlay(24); }     // skip the intro and go straight to the end

none of those reasons would require php to embed a swf.
normally, with flash, you could use a session variable to pass data from html to the swf.  you set your session variable's data with a html form or something similar and then use flashvars to pass that info to your embedded swf(s).
you can also pass html data to an embedded swf using javascript and the externalinterface class.

Similar Messages

  • Accessing session variables with php

    I am trying to access the  session variable  $_SESSION['MM_Username']  in one of my php pages, but it is somehow showing empty (i.e it does not contain the username that was entered during login).
    I checked and confirmed that my login.php function is properly setting the MM_Username session variable by echoing it  from the login function.
    So why can't I read it from another php file in the same session?  Do I need to do something else before the session variables can
    be properly read from any php file in the same session?  Any help would be appreciated.

    Here is a test code I am using to access the session variable $_SESSION['MM_username']  from  the php page  test.php. But it is not working.
    I get an empty string all the time for $username. Can any one see something wrong with this code?
    <?php require_once('Connections/MyTestingConn.php'); ?>
    <?php session_start(); ?>
    <?php
    $username = "-1";
    if (isset($_SESSION['MM_username'])) {
      $username = $_SESSION['MM_username'];
      echo $username;
    else
       echo "Eror: can not access session variable";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    </head>
    <body>
    </body>
    </html>

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • Access a variable in the Adobe form for Java Scripting

    Hi,
    I am unable to know how to access the variable in a Adobe form.
    The variable is field of an internal table. My adobe form structure is as follows
    MAIN_PAGE->FORMSET->FirstFORM->EXT.
    in the EXT subform the variable(cust)  exists.
    The cust is in turn an internal table.

    Hello Sreelatha,
    I think we cannot hide a page.  as in, page is the main container.  In a container, we can hide any field using some scripting.  Even though if we hide the field, it is present on page but not visible. 
    but if some logic is there, please let me know.
    Thanks,
    Rakesh.
    Edited by: rakhi966 on Sep 8, 2011 8:54 PM

  • Access custom variable value in web.xml context-param?

    My requirement or need is to access a variable value either in a class in my Model project or a backing bean in my View project. For example, one variable I need to access is an application server I am integrating with - 'testserver' or 'productionserver' - I want to be able to configure this within an external file so that I do not have to re-compile my application to change the variable.
    I was thinking about placing this variable in the web.xml <context-param> section as:
    <context-param>
    <param-name>servername</param-name>
    <param-value>testserver</param-value>
    </context-param>
    I need to access this value within a class (not a servlet) on an Application Module service method, though if needed, I could access it from a backing bean and pass it to the service method (less desirable.) Is this a good approach and how do access this variable from within a Java class including any imports I need to do (code example)?
    Thanks and Happy New Year!
    Hopefully most everyone is out spending time with friends and family versus stuck trying to complete a project like me...

    I found an example from SRDemo that provides what I was looking for:
    String serverhostaddress =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("param-name-var-in-webxml");

  • Why can't I access the variables in my threads?

    hello.
    another question about threads..
    ==========================
    I have an inner class that implements Runnable (i.e. a thread) and has a variable in it. I want to be able to access that variable from outside the thread class so that I can set or retrieve the variable.
    here is the code for the program
    class myClass
         public static void main(String[] args)
              myClass c = new myClass();
         myClass()
              Thread t = new Thread(new myThread());
              t.number = 1;
              t.start();
         class myThread implements Runnable
              int number = 0;
              public void run()
         }//end myThread
    }//end myClassthe line
    t.number = 1;
    where I try to set the number variable to 1 gives me an error (in the MyClass constructor)
    This is my error
    AccessThreadVars.java:11: cannot find symbol
    symbol  : variable number
    location: class java.lang.Thread
              t.number = 1;
                        ^
    1 errorif I put a method in myThread, and then try to call that method from myClass (via t.MethodName()) it gives me that same error telling me it can't find it..
    what am I doing wrong? how can I get access my thread's variables and methods??

    1. Type names should start with an uppercase letter
    2. t is defined as a Thread, not as a myThread
    (which, may I insist, should be "MyThread"), so the
    compiler has no means of detecting that "number" is
    an accessible field of the object... which wouldn't be accessible anyway, cause you're trying to get attributes from your Runnable after wrapping it inside a Thread.
    Why don't you do something like :
    MyThread t = new MyThread();
    t.number = 1;
    new Thread(myThread).start();?
    I bet you don't use Thread's own methods anyway...

  • Accessing the variable in field symbol of nested internal table

    Hi,
    I am unable to access the variable in field symbol.
    The data in field symbol has nested structure. We need to access a variable in nested structure.
    Please find the code below:
          LOOP AT <i_fincorp> into <fs_fincorp>.
            l_madefor = <FS_FINCORP>-data_UI-ZZ0010.
          ENDLOOP.
    datatype of <i_fincorp> is type any table and <fs_fincorp> is type any.
    there is a structure 'data_ui' in <i_fincorp> and we need value of field 'ZZ0010' in data_ui structure.
    But, we are getting syntax error for statement in loop stating "There is no component like 'data_ui' in <fs_fincorp>".
    Can anyone please help me solving this issue.
    Regards,
    Santosh

    So simply access it dynamically
    data: nested_field type c length 50.
    field-symbols <nested_field> type any.
    "build the nested field name dynamically
    concatenate
           'DATA_UI'    "first give structure name
           'ZZ0010'  "then give field name (all in uppercase!)
    into nested_field
    separated by '-'.  "now you have DATA_UI-ZZ0010
    "so assing this nested field
    LOOP AT <i_fincorp> into <fs_fincorp>.
       assign component (nested_field) of structure <fs_fincorp> into <nested_field>. 
    ENDLOOP.
    Regards
    Marcin

  • Accessing container variable of BPM in Message Mapping function

    Hi,
    I have a scenario in BPM where i have a container variable that is used as a loop counter.I want to access that counter defined , every time when i go around the loop and perform certain actions based on that counter. so how can i access that variable in my message Mapping function.

    Hi Sudharshan,
    check these links, hope they give you the required information (i think there is some problem with SDN site, check these links after a while)
    Re: How to use Container Variable across Maps
    Container object in Message Mapping
    Copy value of container (abstract interface) to an other container
    Regards
    Vishnu

  • Access global variable in fpga from rt-target

    Hi All,
    I have a realtime PC with NI-FPGA 7852R.
    Generally I used programmatic front panel communication to access variables from FPGA to rt-system since I need the data for control and not for data logging.
    The thing is, I bumped into a tutorial and suggested me to use global variables to save resources of your FPGA. My question is, is it possible to access global variable that belongs to FPGA from rt-system? As far as I tried, this does not seem possible.
    Thanks,
    Auralius

    Could you point us towards this tutorial?
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

  • How to access a variable from within a symbol.

    How do I access a variable set outside a symbol from within that symbol?
    Thanks

    If you set a variable on stage ,say
    sym.setVariable("stageVariable", "I am stage variable");
    You can access it from within  a symbol using :
    var myVariable = sym.getComposition().getStage().getVariable("stageVariable");
    Basically you need to get handle to the symbol in which the variable is defined.

  • How to access a variable in if clause?

    Hi Friends,
    I have declared a varialbe like this
    <?xdoxslt:set_variable($_XDOCTX, ’cnt’, 10)?>
    Now if i want to access the variable in "if" clause ,something like
    <if:cnt=10?>
    How can i access it?

    Hi,
    try the following
    <?if:xdoxslt:get_variable($_XDOCTX, 'cnt')= 10?>
    Your logic goes here
    <?end if?>
    regards
    Rupesh

  • Access session variable in Java Function in JSP

    Hi Experts !!
    I am developing an application using STRUTS MVC...
    Very sorry if u have problem understanding my question, i ll try to improve... and sorry if i can't post codes here
    Basic question is ....
    I want to open a word document on pageLoad of JSP, the word document is not a single document, there is a form in which there is a "name" and "template" whenever user clicks on a button there is one action attached to it which creates a copy of that template in a different folder.. on the next page OnLoad i want to open that particular document. for that i have created a variable and also have set in the session, just want to access it in the below code.
    I have a formbean in which i have a variable, the scope is session, that variable i have put it in session also. but i want to access that variable in a "java function" in JSP so that "onLoad" page that function should work.
    JSP---
    <script type="text/javascript">
    function openDocument() {
    var w = new ActiveXObject("Word.Application");
    var docText;
    var obj;
    var a;
    if (w != null) {
    w.Visible = true;
    obj = w.Documents.Open(I HAVE TO ACCESS THAT VARIABLE HERE);
    </script>
    FORMBEAN----
    public class CreateSOWFormBean extends ActionForm {
    private String workflowName;
    private String comment;
    private String sowTemplate;
    private String sowFileCreated;
    public String getSowFileCreated() {
    return sowFileCreated;
    public void setSowFileCreated(String sowFileCreated) {
    this.sowFileCreated = sowFileCreated;
    sowFileCreated is the variable that i have accessed in session and that value i have to pass in that function in JSP....
    I am aware of something like
    obj = w.Documents.Open(<%'sowFileCreated'%>);
    but i m not sure how to write....
    Plz help.....

    If you're working under a framework like struts you should definitely be using JSTL tags rather than scriptlet code to access variables within the page. With JSTL code <% codes can be almost entirely avoided.
    To transfer a value from a Servlet to a JSP don't use a session variable, use a request attribute. Session variables should only be used when values have to survive from one transaction to another.
    You can write something like:
    obj = w.Documents.open('<c:out value="${openURL}"/>');in the Javascript portion of your JSP.
    Just beware of potential problems with quotes. The coresponding code in the Servlet would be like:
    request.setAttribute("openURL", openUrl);

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Autocomplete Declared PHP Variables in Dreamweaver

    Is there a way to autocomplete php variables that have been
    declared? For instance, whenever you type $ in a PHP code block, a
    pop up list would automatically come up with all the variables you
    have already declared. This would GREATLY speed up coding and help
    to insure coding accuracy.
    If there is a way to do this now, could someone please clue
    me in? I've searched and searched forums, help files, and google.
    If this is not available, where should I go to request this
    feature?
    Shanna

    jsteinmann wrote:
    > With asp.net missing, along with several other things
    discontinued, dreamweaver will have to cater to php developers in
    these kinds of ways.
    If you want Dreamweaver to add features posting this sort of
    comment in
    a user-to-user forum won't have the slightest impact on the
    direction
    that Dreamweaver actually takes. You need to make your views
    known by
    submitting feature requests through the official channel:
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Submitting requests doesn't guarantee that your ideas will be
    adopted in
    the next version or even the one after that, but it does get
    them on the
    development team's radar.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Accessing environment variables in PL/SQL??

    I have two oracle schemas; myenv1 and myenv2. They are both exact copies from each other except for the fact that one is my "developement" environment and the other my "production" environment.
    So in each of them I have some packages with PL/SQL code.
    I'd like to have an environment variable called PLATFORM (maybe not the best name) that should have the value "devel" in one schema and the value "prod" in the other schema. And I'd like to be able to access this variable in my PL/SQL code so I can slightly change some code or conditionate some code to the production environment only... or stuff like that.
    Does anyone know how to do that? (where and how to configure the env. variable)
    Any help will be most appreciated.
    Thanks!

    but I'm using the same 'current_user' in both schemas... is there other values I can get with sys_context ?? maybe there's one that would do it... but i think it's not 'current_user' It should be. Consider:
    SQL> show user
    USER is "SCOTT"
    SQL> create or replace function show_user return varchar2
      2  as
      3  begin
      4    return sys_context('userenv','current_user');
      5  end show_user;
      6  /
    Function created.
    SQL> select show_user from dual;
    SHOW_USER
    SCOTT
    SQL> grant execute on show_user to test;
    Grant succeeded.
    SQL> connect test/test
    Connected.
    SQL> select scott.show_user from dual;
    SHOW_USER
    SCOTT

Maybe you are looking for

  • Some users not seeing all of a web form in Smart View Excel 11.1.2?

    I am on Planning 11.1.2 and I have an end user who, when he opens a web form in Excel using Smart View, he only sees about 1/3 of the entire form. If in the Oracle/Planning web, the form is fine. When he uses my machine, he sees the entire web form i

  • Deploying web dynpro application into portal

    hi I have created a simple example in webdynpro in Netweaver developer studio, and I have deployed it into the portal whose version is EP6 SP9. where can I see that deployed webdynpro application(in my case it is WebDynpro_Basics.ear) in the portal.

  • Message window

    how to pop a message window without using awt

  • How can I take off this malware?

    My mac is running really slow, I have a malware and I don't know how to take it off, and my skype has not been working, will upgrading to Lion Help??

  • Standard Excel-Functionalities not usable when using BexAnaylzer

    Hi Experts, I am using BexAnalyzer as a reporting tool. Query Designer is on 3.5. I have safed a few queries within a workbook. Next step is to combine results of different queries by using standard excel functionalities (SUM, etc.) to create a new r