Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing results from two sql database tables

Status
Not open for further replies.

phentalmyst

Programmer
Jan 30, 2001
18
US
hi all, im working on an asp app that works like so:

a user logs in through a simple form..and the screen the are directed to depends on if they are a user or an administrator. the usernames and passwords for the users and admins are in 2 different sql tables and i have the query string correct. the problem is, i dont know how to say "ok, if the user is from the admin table, go here, if he's from the users, go here, and if he's from neither, go here."

this is what i have so far. i greatly appreciate ANY help!

----------

KC_valUsername=CStr(Request.Form("userid"))
KC_valPassword=CStr(Request.Form("password"))
KC_adminSuccess="admin.asp?adminid=" & KC_valUsername
KC_userSuccess="clients.asp?userid=" & KC_valUsername
KC_loginFailed="failed.asp"

Set KC_loginInfo = Server.CreateObject("ADODB.Recordset")
KC_loginInfo.ActiveConnection = KC_USIS_STRING
SQL = "SELECT aUserid, aPassword, uUserid, uPassword from Admins, Users WHERE aUserid='" & KC_valUsername &"' AND aPassword='" & KC_valPassword & "' OR uUserid='" & KC_valUsername &"' AND uPassword='" & KC_valPassword & "'"
KC_loginInfo_Open SQL

If Not KC_loginInfo.EOF Or Not KC_loginInfo.BOF Then
Session("KC_Username") = KC_valUsername

If (KC_fldUserAuthorization <> &quot;&quot;) Then
Session(&quot;KC_UserAuthorization&quot;) = CStr(KC_loginInfo.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session(&quot;KC_UserAuthorization&quot;) = &quot;&quot;
End If

If CStr(Request.QueryString(&quot;accessdenied&quot;)) <> &quot;&quot; And false Then
KC_userSuccess = Request.QueryString(&quot;accessdenied&quot;)
End If

KC_loginInfo.Close
Response.Redirect(KC_adminSuccess)
End If

----------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top