PDA

View Full Version : Why isn't this working? Looks OK to me...


mrand01
07-14-2003, 12:12 PM
OK, I'm trying to send "username" and "password" info from flash to an ASP script which will verify the info against a SQL Database and return "True" if it works, and "False" if it doesn't.

Heres what works so far:

1. Variables get sent from Flash to ASP
2. ASP validates them against SQL
3. ASP returns True or False (strVDS in ASP)

Heres what doesn't work (i think):

1. Either variables don't get sent to Flash or I'm addressing them improperly in Flash...help with this

Here is my AS and ASP



stop();

_global.flashData = new LoadVars();

login_btn.onRelease = function() {
username = user_txt.text;
password = password_txt.text;
flashData.username = _root.username;
flashData.password = _root.password;
flashData.sendAndLoad("http://localhost/onDemandTest/login.asp",flashData,"POST");
if(flashData.success == "True") {
LoadStatus.text = "Yeah";
}
else if(flashData.success == "False") {
LoadStatus.text = "Nope";
}
else {
LoadStatus.text = "Loading";
}
}


ASP

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim strUserName
Dim strPassword
Dim conn
Dim aConnectionString
Dim SQL
Dim RS
Dim F
Dim RecsAffected

strUserName = Request("username")
strPassword = Request("password")

aConnectionString ="Provider=SQLOLEDB;Data Source=(local);Database=OnDemand;UID=nope;PWD=nope ;"
Set RS = Server.CreateObject("ADODB.Recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Mode = adModeReadWrite
conn.Connectionstring = aConnectionString
conn.open
SQL = "SELECT * FROM tbl_Users WHERE UserName = '" & strUserName & "'"

RS.open SQL, conn

If Not RS.EOF Then
If RS.Fields("Password") <> strPassword Then
strVDS = "&success=False"
End If
If RS.Fields("Password") = strPassword Then
strVDS = "&success=True"
End If
Else
strVDS = "&success=False"
End If
RS.close
Set RS = Nothing
conn.close
Set conn = Nothing
Response.Write strVDS
%>

mrand01
07-14-2003, 12:31 PM
nevermind, got it

CyanBlue
07-14-2003, 04:58 PM
If you know what was wrong, it is a good idea to post the solution so that other people can be benefitted from it... ;)