A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: login form with ASP and mdb I'm almost there

  1. #1
    Member
    Join Date
    Mar 2001
    Posts
    53

    login form with ASP and mdb I'm almost there

    I think I'm close. I have the flash file and the associated asp page.

    Here's the goal: I want users to input their username and password in the flash page which will then check it against the access db. If the username and password are in the db then I want the user to be taken to an ftp address. All users will go to the same ftp server but should be directed to their own client folder which corresponds to the username and password they submitted.

    I can get the flash movie to go to a specific ftp address using the getUrl action as you see below. capftp is one of the usernames and hobbs818 is one of the passwords that is valid. Instead of using this specific username and password I need flash to take whatever username and password (as long as they are valid in the db) from the login form and then use these variables in the getUrl action. Not sure if the getUrl action is correct to use here.

    Thanks in advance for your help

    You can take a look at the login demo at: http://www.curtisalan.com/login.swf

    Here is the code in the flash movie:

    // first we create the object
    login_lv = new LoadVars();
    // now we create the function that will happen
    // when this object recieves data
    login_lv.onLoad = function() {
    // check to see if the users info is correct
    if (this.userInfo == "true") {

    getURL("ftp://capftp:hobbs818@ftp.curtisalan.com");
    } else {
    // if the users info was not correct, trace an error, and clean the text fields
    trace("Invalid data");
    login_txt.text = "";
    password_txt.text = "";
    }
    };
    // the function for the login button
    onLogin = function () { if (login_txt.text.length<1) {trace("please provide a login name");} else if (password_txt.text.length<5) {trace("invalid password");password_txt.text = "";} else {login_lv.username = login_txt.text;login_lv.password = password_txt.text;login_lv.sendAndLoad("http://www.curtisalan.com/login.asp", login_lv, "POST");}};

    Here is the code on the login.asp page:

    <%@Language=Vbscript%>
    <%Option Explicit%>
    <%
    '''''''First, get the stuff from flash
    Dim inUserName, inPassword
    inUserName = Trim(Request("username"))
    inPassword = Trim(Request("password"))

    '''''''Now, create the connection object
    Dim myConnection
    Set myConnection=Server.CreateObject("ADODB.Connection ")
    myConnection.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("login.mdb")
    myConnection.Open

    '''''''Here is our SQL statement when we open the Recordset
    Dim loginSQL
    LoginSQL = "SELECT * FROM loginTable WHERE userName = '" & inUserName & "'"
    '''''''Create, and open the Recordset
    Dim myRS
    Set myRS=Server.CreateObject("ADODB.Recordset")
    myRS.Open loginSQL, myConnection

    '''''''Make sure we have some data, if we do, make sure the password matches
    Dim mainMessage
    If myRS.EOF Then
    mainMessage="userInfo=false"
    Else
    If(StrComp(myRS("password"), inPassword, vbTextCompare) =0) Then
    mainMessage="userInfo=true"
    Else
    mainMessage = "userInfo=false"
    End If
    End If
    '''''''Clean up everything
    myRS.Close
    Set myRS=Nothing
    myConnection.Close
    Set myConnection=Nothing

    '''''''Now send the data back to flash
    Response.Write(mainMessage)
    %>

  2. #2
    Hey did you ever make any headway with this? I'm trying to do the same thing but haven;t been able to find any material/tutorials on doing this. Let me know, thanks.
    "Lets get right down to brass tacks....How much for the ape?"

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    nothing in flash is secure. you can't put passwords in the code - everything in your swf is readable.

    ridick, what do you need to do (in general)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center