Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Tha DRD #1
Attn CarlGrint! Need help, dynamic redirector with cookies!
This message is specifically for CarlGrint, as I use his dynamic
redirector and RememberMe cookie code, but anyone, feel free to help!
I am attempting to combine the two above features in one login page.
If I DON'T check the box "Remember Me," then the user goes to the
correct page based on access level. If I DO check the box, then the
user goes to the default page the the Response.Redirect dictates upon
calling up the cookie on future logins. Here's my code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/swgprod.asp" -->
<% ' set session username from cookie
If Request.Cookies("UserID") <> "" Then
Session("MM_Username") = Request.Cookies("UserID")
Session("MM_Username") = Request.Cookies("password")
Response.Redirect("index.asp")
End If ' set session from cookie %>
<%
session.Timeout = 180
%>
<%
Dim rsUsers
Dim rsUsers_numRows
Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_swgprod_STRING
rsUsers.Source = "SELECT * FROM SHIPWARE.USERS_OLD"
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 1
rsUsers.Open()
rsUsers_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" +
Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="USER_LEVEL"
MM_redirectLoginSuccess="Index.asp"
MM_redirectLoginFailed="incorrectpassword_all.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_swgprod_STRING
MM_rsUser.Source = "SELECT USERNAME, PASSWORD"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source =
MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM SHIPWARE.USERS_OLD WHERE
USERNAME='" & Replace(MM_valUsername,"'","''") &"' AND PASSWORD='" &
Replace(Request.Form("password"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") =
CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
Else
Session("MM_UserAuthorization") = ""
End If
'redirect user based on Access Level
If Session("MM_UserAuthorization") = "0" Then
MM_redirectLoginSuccess =
"http://167.207.181.100/crystal/swd_index.asp"
ElseIf Session("MM_UserAuthorization") = "1" Then
MM_redirectLoginSuccess = "http://167.207.181.100/shipware/index.asp"
ElseIf Session("MM_UserAuthorization") = "2" Then
MM_redirectLoginSuccess =
"http://167.207.181.100/shipware/warehouse/mainpage_warehouse.asp"
ElseIf Session("MM_UserAuthorization") = "3" Then
MM_redirectLoginSuccess =
"http://167.207.181.100/shipware/warehouse/mainpage_warehouse.asp"
Else
MM_redirectLoginSuccess =
"http://167.207.181.100/shipware/incorrectprivilages_all.asp"
End If
If Request.Form("RememberMe") <>"" Then
Response.Cookies("UserID")= Request.Form("username")
Response.Cookies("password")= Request.Form("password")
Response.Cookies("UserID").Expires=Now+5
Response.Cookies("password").Expires=Now+5
End If ' set cookies to remember user
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
Much thanks to anyone that can help!
Derek
Tha DRD Guest
-
Attn: Los Angeles CF Users
Rumor has it there is an informal group of CF users that meets in the valley or somewhere closer to Ventura County. I am a member of SCCFUG but the... -
Twain Data Source Redirector Error Message
Sounds like you've got a bad TWAIN driver installed. You'll have to remove or reinstall the bad TWAIN driver. -
Attn. Paul Taylor
Don't you hate it when people go "Attn. A Name" in the subject line. For a brief moment you think "oh oh, what have I done now" :-) Just... -
ATTN ADMIRAL
can you send me an email .. got something to ask you .. cheers -
Attn: christian
anneliese@scansoft.com wrote: Child pornography and software pircay get considered as equally morally bad? *boggle* Anyway, you're spamming....



Reply With Quote

