Help needed asp

this is like a password thing i will be realting to my flash form but for now its html forms

userform = Request.QueryString(“user”)
EnteredPassword = Request.QueryString(“password”)

password = conn.Execute(“SELECT password FROM passwords WHERE username = '”&userform&"’")
//just finidng the password in my table where the username they entered is

If EnteredPassword=password Then
//trying to validate the password matched form table with one from form
ive got my connection and everything but how do i make my sql statement a variable which i can use in my if statement what i ahve setup there doesn’t seem to work please help thaanks in advance

Try this instead

userform = Request.QueryString(“user”)
EnteredPassword = Request.QueryString(“password”)
String = “SELECT * FROM passwords WHERE username =’”& userform &"’"
RecordSet = conn.Execute(String)

if not(RecordSet.EOF) then
[INDENT]RecordSet.MoveFirst()[/INDENT]
[INDENT]password = RecordSet.Fields.Item(“password”)[/INDENT]
[INDENT]If EnteredPassword=password Then[/INDENT]
[INDENT]’ *** logged in[/INDENT]
[INDENT]else[/INDENT]
[INDENT]’ *** wrong password[/INDENT]
[INDENT]end if [/INDENT]
end if

let me know how it goes :thumb:

[SIZE=1]EDIT: D**N!! I got confused the code above is in ASP cause your threads title says “Need help asp”. Think you meant asap. Anyway with just a few little changes this should still work[/SIZE]

i suggest not passing the information as a querystring from the form to the to .asp page as it could lead to security issues.

instead use <form method=“post”> with userform = Request.form(“user”)

where “user” is the key just like it is in querystring.

lol so what does the eof part mean in the recordset this still seems jnot to work ill post a full shown thing of my script if this not work

.EOF basically is null

so this part: if not(RecordSet.EOF) then

basically says, if it is TRUE (not null) then “do this” you need this becuase it stops the code from running if there is no user with that username /password combination.

now, the “’ *** logged in” part of the code is where you would put your code to happen if the user is logged in, which would most likely involve creating a user session with variables such as “username” “password” “access level”

www.w3schools.com is a good place to learn asp. i taught myself and i have coded an entire forum before :slight_smile: