Hi, I have the following code for a user to login, I would like to change this to allow them, (once they have entered their email and password on the previous page) to be redirected, based on whether their email and password details are in db1 or db2.
Is this possible? (the current redirect can be deleted, and replaced as it is no longer required)
Life is a journey that always ends up in the place
Is this possible? (the current redirect can be deleted, and replaced as it is no longer required)
Code:
<%
' variables
dim cnStr
dim rcSet
dim E_Mail
dim Password
dim sqlStr
'store form input into variables
E_Mail = Request.Form("E_Mail")
Password = Request.Form("password")
'create connection and recordset objects
Set cnStr = Server.CreateObject("ADODB.Connection")
Set rcSet = Server.CreateObject("ADODB.Recordset")
' defining database connection (connectionstring.asp)
cnStr.ConnectionString = "D:\Websites\HVT\site\db\database.mdb"
cnStr.Provider = "Microsoft.Jet.OLEDB.4.0"
cnStr.open
' execute sql and open as recordset
sqlStr = "Select * From tblUsers where E_Mail = '" _
& Request.Form("E_Mail") & "' and password = '" & Request.Form("password") & "'"
' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
set rcSet = cnStr.Execute(sqlStr)
' validate variables against database
If (not rcSet.BOF) and (not rcSet.EOF) then
response.cookies("validated_user") = E_mail
response.write "<h1>Login successful!</h1>"
response.write "<p>Welcome " & rcSet.fields(1) & "</p>"
'Added redirection based on email
if Instr(1,E_mail,"@bluealumni.com")>0 then
Response.Redirect("../menu2.asp?E_Mail=" & E_Mail & "")
else
Response.Redirect("../registerdetails.asp?E_Mail=" & E_Mail & "")
end if
'end of redirection
else
response.write "You appear to have entered incorrect details. Please go back again try again."
end if
%>
Life is a journey that always ends up in the place