How to create a login session in flex?

Hi there,
I have a flex application with two states. One is a "login" state which is a screen with username and password. The other state is "loggedIn" state which is a screen with a small application. As soon as the user credentials are checked from the back end, based on it's success, I'm changing the state to "loggedIn", else there is a message to the user about login failure in "login" state itself.
My problem is if I'm in "loggedIn" state and if I hit refresh button of the webpage(F5), it goes back to the login screen i.e., it just restarts the application..
How can I control this? Is there something like login session which can do the trick?
Appreciate your help...
-Deepak

Flex code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="getSession.send()">
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            public function getSessionStuff(evt:ResultEvent):void
                saveInfo.text = evt.result.info;
        ]]>
    </mx:Script>
    <mx:HTTPService id="startSession" showBusyCursor="true" method="POST" url="http://localhost/startSession.php">
        <mx:request xmlns="">
            <stuffToSave>
                {saveInfo.text}   
            </stuffToSave>
        </mx:request>
    </mx:HTTPService>
    <mx:HTTPService id="getSession" result="getSessionStuff(event)" showBusyCursor="true" method="POST" url="http://localhost/getSession.php"/>
    <mx:Button x="602" y="323" label="Start Session" enabled="{saveInfo.text != ''}" click="startSession.send()"/>
    <mx:TextInput id="saveInfo" x="563" y="293"/>
</mx:Application>
setSession.php code;
<?php
    session_start();
    $_SESSION['loggedIn'] = $_POST["stuffToSave"];
?>
getSession.php code;
<?php
    session_start();
    if($_SESSION['loggedIn'])
        echo "<info>".$_SESSION['loggedIn']."</info>";
    else
        echo "<info>nothing has been saved</info>";
?>
ta daa

Similar Messages

  • How to create a login to users in PHP

    How to create a login for users to access their data,
    currently I can only see the first user everytime I login even with
    a different username. I know I need session stuff but don't know
    how to use, add or where to put them in.
    Thanks in advanced.

    I also am wrestling with the same problem. Session variables
    have not worked. I have determined that if the GET method is used,
    then the recordset of the users records are there. If the POST
    method is used, the recordset is blank. It appears to be something
    inherent in the Log In User behavior.
    I am trying to have a customer log in and then only see their
    particular inventory records. I do not want them be directed to a
    page with a listing of all the various customers and then select
    from that. Not suitable at all.
    If I find an answer, will let you know.
    Thanks and good luck,
    Dale :-)

  • How to create a new session in JSP file

    Usually a child IE window uses same session with parent window. Dose someone know how to create a new session when creating a new IE window by clicking a URL in parent window? The web page is writen by jsp file.

    I am not sure of your question. Are you wanting to have 2 Session objects (one for the parent window and another for the child)?
    A session is usually created once per client and is stored on the server the session id is carried around in a cookie or a URL rewrite so that everytime the user submits a page you will be able to store/access information.
    // this will create a new session object if one doesn't already exist.
    HttpServletRequest.getSession( true );
    Hope this helps

  • How to create a login interface in labview PDA module?

    How to create a login interface in labview PDA module? So that it checks with a list of usernames and passwords and allow to go to another VI?
    Anu

    Anu,
    I've attached a really short example that does something like what you're talking about.  It just compares the user's username and password a pre-determined username and password and then "logs the user in" based on that comparison.  Like Greycat said, you probably want to store this username and password info in some sort of file on the PDA that's in an encrypted format for both security and flexibility of your application.
    I hope this helps,
    Justin D.
    Applications Engineer
    National Instruments
    Attachments:
    LoginVI.vi ‏17 KB

  • Does anyone here knows how to create a login page thru JDBC?

    Anyone here knows how to create a login page which connect to database thru JDBC but not JDBC-ODBC bridge?

    Hi..pls you'll do people here a great good if you could explain yourself better..!
    Anyway if you are trying to connect to an Oracle Database you dont need the jdbc-odbc bridge as oracle provides a special driver for java applets/applications that is "the thin driver" and the "oci driver"..so if you are connecting to Oracle your connection will look like this:
    Class.forName("oracle.jdbc.driver.OracleDriver"); //not sun.jdbc.odbc.JdbcOdbcDriver
    Connection con = DriverManager.getConnection ("blah blah, blah");
    no need for the jdbc-odbc bridge.
    I hope i've answered your question.
    Thanks.

  • How to create a new session by ABAP?

    Good afternoon everyone:
    This is my first question in the forum, can anybody tell me how to create a new session to display report output in a ALV program? Which function or method can used? I'm freshman.
    Thx.
    Edited by: Joshua Lee on Nov 21, 2008 10:04 AM

    Hi Joshua,
    Welcome To SDN.
    I am not clear about your queestion.
    if u r doing an ALV report if u give selection screen inputs if press execute buttom or F8 u wil get the report.
    if u want the out put in the next screen. you can develop the screen in the module pool
    Regards
    Rasheed
    Edited by: Rasheed salman on Nov 21, 2008 10:25 AM

  • How to create new themes in adobe flex projects

    How to create new themes in adobe flex projects 

    I too would like to understand this and find more information about this.
    I would like to produce my own theme. But how??

  • How to create file system datagrid in flex web application

    how to create file system datagrid in flex web application

    Hi,
    Check this out:
    http://shigeru-nakagaki.com/flex_samples/FileReference/FileUploadExample2/FileUploadExampl e2.html
    Johnny
    Please rate answer.

  • Kdebase4-svn: How to create an X-Session?

    I've successfully built kdebase4-svn from AUR in the meantime, but now I'm wondering how to create an X-Session for it. Normally you create a kde4.desktop file which runs /opt/kde4/bin/startkde... But this file (startkde) does not exist in kdebase4-svn.. Can anyone help?
    Thanks

    Maybe something is broken with that kdebase4-svn. If I'm not mistaken, there are 3 individual KDE4 4.1 Beta 1 distributions available for Arch (kdemod's, tanis' and devs'), try one of them.

  • How to create a login portlet?

    anyone can tell me how to create a login portlet?
    I'm created a JSR286 portlet use "weblogic.security.services.Authentication",that can login only in the portlet application.The portal can't Authentication.

    Hi.
    Portlets are consumed via WSRP 2.0 (Remotelly).
    I recommend you create an ADF Task Flow for your login process of your Portal instead of a Portlet.
    Regards.

  • How to create a login module

    Hi Everyone.
    How to create a login module which like www.sdn.sap.com
    the module is on the top left corner

    http://help.sap.com/saphelp_nwce10/helpdata/en/46/3ce9402f3f8031e10000000a1550b0/frameset.htm

  • How to create a LOGIN Form & LOGIN ID & PASSWORD for END USERS

    hi,
    i have just created a Database and Forms & Reports using developer 6i.
    now i want to deleiver that Database to end users, but i dont know that how to create a LOGIN Form for the end users and also i want to assign each user a Login ID & Password.
    Plz help me to solve out this problem.

    1. Create the user accounts on the database CREATE USER ... IDENTIFIED BY...
    2. Grant CONNECT Role to the Users
    3. in the main form (the one which is being called initially at runtime) in the ON-LOGON-Trigger create a CALL_FORM() to the Login Form
    4. The Login Form will be called; build a Block with username, password and a Button
    5. In the Button call the LOGON Built-In
    6. Control will be passed to the initially called form again
    I also noticed a thread in here explaining this in more detail...
    Message was edited by:
    user434854

  • How to create a login system

    I need to create a login system for an application.  The application will be a Flex front-end connecting to a Postgres database through ColdFusion.  I can connect to my database but cannot find a good way to check user credentials and save data in a session.  Can someone provide some sample code or suggestions (I have already reviewd Bruce Phillips blog on the subject).  I assume this is a standard activity in Flex but cannot find a lot of guidance.  Any help would be appreciated.  Details follow:
    The use case is quite simple:
    Assumptions:
    -the user has an account and supplies correct information
    -Flex can connect to the Postgres databse through ColdFusion datasource.
    Actions:
    User supplies username, password and role and clicks submit button.  System validates that the username/password/role combination matches and displays a viewstack based on the role provided.
    Thanks!

    After some more seraching and playing around, I found a pretty useful example out there on the Flex Cookbook beta site.
    The post by stinasius is located at http://www.adobe.com/cfusion/communityengine/index.cfm?event=showDetails&postId=12346&prod uctId=2&loc=en_US

  • How to create a login............

    Hi
    i am new to using JSP and i don't know how to create a user login page. A DBHandler holds all the connection and SQL queries to my database. Within the DBHandler i have Login.java which carries the login info for the JDBC connection. Login.java code is below. Can i use something like for my user login?
    public class Login
    private String username;
    private String password;
    Constructor to create a new login object
    @param u valid database username.
    @param p valid database password.
    public Login(String u, String p)
         username = u;
         password = p;
    Gets the username.
    @return the username as a string
    protected String getUser()
         return username;
    Gets the password
    @return the password as a string.
    protected String getPassword()
         return password;
    Thanks

    With what you have, you can have a login page that is simply a basic HTML page with form fields for login and password. You can post this form to another JSP page to actually do the validation. Once you've validated that the login/password they provided you can then either forward back to the logn page if it is incorrect, or store an attribute in the session to record that they have successfully logged in, and forward to the main page using session.setAttribute("user", userName) or something like that.
    Then every page can include a simply jsp that checks to see if the attribute "user" exists in the session, and if not, it can forward to the login page. When the user clicks logout, a simple call to session.invalidate() will invalidate the session, and any further attempts to access pages would result in being forwarded back to the login page.

  • How to create a SWC file in flex

    Can any one help me giving step by step information of how to create .swc file in flex..Iam a starter to this...Pls reply

    You need to create Flex Library project & after compilation you will find project_name.SWC in bin-debug folder.
    referr
    http://www.adobe.com/devnet/flex/articles/flex_swc.html
    http://www.daveoncode.com/2009/04/07/deploy-and-work-with-flex-swc-library/
    http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/
    *If this information is useful, then mark this post as such.

Maybe you are looking for

  • BPM - doubt in N:1 mapping of IDOCs

    Is there any DETAILED document on Mapping multiple Idocs into a single Idoc package using BPM.My doubt is in the latter part in this process(During Receiver Determination) : Scenario : CRM->XI->R3 We will download the CREMAS03 and then make changes i

  • Editable field in a Adobe Form

    Hi, guys. I gotta insert an editable field in an adobe print form, but I can't make it editable. I selected 'User Entered- Required' in the 'Value' palette of the field, but, after the launch of the program, it's not editable yet. I also tried to val

  • Final Cut 5.0 wont open after hard drive confusion

    i think someone in my studio unplug a external hard drive because when i checked the timeline many files were offline i closed out of the program and re-opened and it said all my mac hd hard drive was offline i tried to reconnect it and once i did it

  • TABLE VIEW CONTROL IN MODULE POOL PROGRAMMING

    Hai Friends, <b>My problem is i design table view control using se51. I entered the data on table view and when i  press ENTER button on keyboard the total data is disapears from the screec(i.e table view). but i do not want this functionality. when

  • Is it possible to have a 10g (R1) LOGICAL standby db in read-ONLY mode?

    From what I've gathered reading the 10g (R 1) docs, the logical standby turns read-only when applying sql, and then in read-write mode otherwise. I have to meet a requirement that the remote database be strictly in read-only mode the entire time (so