Forum Moderators: open
My SQL statement is as follows:
sqlcomm = "SELECT * from table1, table2 WHERE table1.username = '" & username & "' AND table1.password = '" & password & "' OR table2.username = '" & username & "' AND table2.password = '" & password & "'"
My vbscript is as follows:
if NOT MyRecordset.EOF then
session("username") = MyRecordset("table1.username") OR session("username") = MyRecordset("table2.username")
session("password") = MyRecordset("table1.password") OR session("password") = MyRecordset("table2.password")
response.redirect("success.asp")
End if
?
Thanks for any help offered.
Your VB Script is more complex than necessary. As you already have the successful Login/Password combination the following is sufficient:
if NOT MyRecordset.EOF then
session("username") = username
session("password") = password
response.redirect("success.asp")
End if
I have a script to combat the SQL injection but just out of interest do you know of any other way of combating it? For instance, what code would you use above to combat SQL injection. Would you add a code snippet or is there a way of writing the code to stop the injection.
Thanks for the warning by the way and thanks for your help.
Here is an intro to protecting against SQL Injection with ASP [4guysfromrolla.com]
Parameterized queries are not available in classic asp? Where did you get that idea?
Use the command object just like you do for stored procs and use parameters just the same.
Could you show some example code of a parametrized query in Classic ASP to help KRMWebdesign out?
edit: nevermind, I found a tutorial on it: [planet-source-code.com...]