Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Mike1500 #1
Passing Parameters from the login screen to another page
Hello All,
Does anyone know how to pass a login UserID parameter to filter another page?
Below is my login in screen code. Please advise. Thanks.
CODE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Conn.asp" -->
<%
' *** 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="userGroup"
MM_redirectLoginSuccess="Assigned.asp"
MM_redirectLoginFailed="login_Failed.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Conn_STRING
MM_rsUser.Source = "SELECT first_Name, pwd, AccountID"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source &
"," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Users WHERE first_Name='" &
Replace(MM_valUsername,"'","''") &"' AND pwd='" &
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
Session("MM_UserID") = (MM_rsUser.Fields.Item("AccountID").Value)
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 Usergroup level
if Session("MM_UserAuthorization") = "Sales" then
MM_redirectLoginSuccess = "sales.asp"
elseif Session ("MM_UserAuthorization") = "Direct" then
MM_redirectloginSuccess = "Direct.asp"
elseif Session ("MM_UserAuthorization") = "HR" then
MM_redirectloginSuccess = "HR.asp"
else
MM_redirectLoginSuccess ="?Action=Failed" End if
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
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style73 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18pt;
color: #505748;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" onload="preloadImages();">
<td><table id="Table_01" width="100%" height="115" border="0"
cellpadding="0" cellspacing="0">
<tr bgcolor="#006531">
<td></td>
<td><img src="images/header_2_02.gif" alt="" width="190" height="66"
border="0" usemap="#Map" /></td>
<td></td>
<td><div align="right"><img src="images/header_2_04.gif" width="160"
height="66" alt="" /></div></td>
</tr>
<tr bgcolor="#CEDFB5">
<td height="23" colspan="4"><p></p></td>
</tr>
<tr bgcolor="#B5CF84"> </tr>
</table>
<map name="Map" id="Map">
<area shape="rect" coords="227,77,338,102" href="#" />
</map></td>
</tr>
<tr>
<td><h1 class="style73">Log In </h1>
<p>Please log in to access Tracking content.</p></td>
</tr>
<p> </p>
<tr>
<td><form name="form1" id="form1" method="POST"
action="<%=MM_LoginAction%>">
<table width="39%" border="0" align="center">
<tr>
<td width="28%">Username</td>
<td width="72%"><input name="Username" type="text" id="Username"
/></td>
</tr>
<tr>
<td>Password</td>
<td><input name="Password" type="text" id="Password" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
<p> </p>
<p> </p>
</form></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
Mike1500 Guest
-
Passing Parameters To CFC
I am testing how to return data from a CFC within Flash Forms. I have a simple <cfselect> tag that will hold data returned from a CFC. This CFC... -
Login to admin system through login screen only
Hi there, I have an issue relating to login to my asp.net application. Basically i have built the standard login page which compares against the... -
session problem - login screen continually reloads after pressing the login button
I am trying to get sessions to work on a log in screen to give certain users access to certain pages/directories. The problem is that when the... -
Screen Parameters
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 29 Aug 2003 12:15:31 -0500, Tad McClellan wrote: Out of curiosity, what other... -
Help Passing Parameters
Before going to the third script I'd suggest storing the variables in session variables. Here's how I generally do login scripts. Perhaps have... -
nisav19 #2
Re: Passing Parameters from the login screen to anotherpage
if Session("MM_UserAuthorization") = "Sales" then
session("username") = request.Form("Username")
MM_redirectLoginSuccess = "sales.asp"
elseif Session ("MM_UserAuthorization") = "Direct" then
session("username") = request.Form("Username")
MM_redirectloginSuccess = "Direct.asp"
elseif Session ("MM_UserAuthorization") = "HR" then
session("username")= request.Form("Username")
MM_redirectloginSuccess = "HR.asp"
else
nisav19 Guest



Reply With Quote

