| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Help with login authentication redirect
Using some basic login code but trying to redirect user based on
their login type. What I would really like to do is have a varible for the name of the redirect page that also pulls from the db based on loginType. Anyway,here is what I have which is not working. Code:
<%
dim db, rs, sql
dim err1, err2, err
if request.form("validate") = 1 then
set db = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
err = false
err1 = false
err2 = false
db.Open Application("webissues_ConnectionString")
sql = "select password, loginType from tblLoginInfo where username = '" & request.form("username") & "'"
rs.open sql, db
if rs.eof then
err = true
err1 = true
else
if rs("password") <> request.form("password") then
err = true
err2 = true
else
If (loginType = "ops") Then
Response.Redirect("opsWelcome.asp")
else
If (loginType = "admin") Then
Response.Redirect("resourceWelcome.asp")
else
If (loginType = "tman") Then
Response.Redirect("tmanWelcome.asp")
End If
End If
End If
End If
end if
rs.close
db.close
end if
%>
|
|
#2
|
||||
|
||||
|
try something like this.
Add a field in your database called redirectPage, then specify the value of the field based on the logintype. Code:
If Request.Form("validate") = 1 Then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("webissues_ConnectionString")
strSql = "SELECT redirectPage FROM tblLoginInfo WHERE Username = '" & Request.Form("username") & "' AND [Password] = '" & Request.Form("password") & "'"
Set rs = Conn.Execute(strSql)
if rs.eof Then
Response.write("No records returned")
else
RedirectPage = rs("redirectPage")
end if
Conn.Close
Set Conn = Nothing
Response.Redirect(RedirectPage)
End If
|
|
#3
|
||||
|
||||
|
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Help with login authentication redirect |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|