hi
i dont get any error message. its just redirects to the User_login Asp page.
This is my User_Security page
'Declare all local variables
Dim conn ' ADO connection
Dim RST ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file
Dim strSQL ' SQL statement for recordset
Dim userName
Dim testcodevalue ' Determines if to check security code in employee table.
' If set to 0 then check code. If set to -1 check security code
' on Logon display.
' MapPath of virtual database file path to a physical path.
strDBPath = Server.MapPath("User_Assets.mdb")
On Error Resume Next
' Create an ADO Connection to connect to the sample database.</FONT>
set conn = Server.CreateObject("ADODB.Connection")
'Use ODBC DSN to link to MS Access database
conn.open "DSN=usrdsn;uid=" & Request("Userid") & ";pwd=" & Request("Password")
if err.number < 0 then 'Could not make connection. Return to main display
Response.Redirect "User_Logon.asp?msg=1"
end if
'Set session Userid and Password variables
session("Userid") = Request("Userid")
session("Password") = Request("Password")
session("ClassDate") = Date()
testcodevalue = GetTestCodeValue()
if testcodevalue = "-1" then
session("SecurityLvl") = Request("EmployeeID")
if session("SecurityLvl") = "" or isnull(session("SecurityLvl")) then
'Forgot to enter security level. Return to main display.
Response.Redirect "User_Logon.asp?msg=-1"
end if
end if
'Open recordset for based on userid
userName = session("Userid")
set RST=Server.CreateObject("adodb.recordset")
strSQL = "SELECT [First Name], [Last Name], [Employee Status ID], [Employee ID], [Security_Level] FROM employee WHERE UserName = '" & userName & "';"
RST.open strSQL, conn
'Set session Employee ID and Name variables
session("EmployeeName") = RST("First Name") & " " & RST("Last Name")
session("EmployeeID") = RST("Employee ID")
if testcodevalue <> "-1" then
session("SecurityLvl") = RST("Security_Level")
if session("SecurityLvl") = "" or isnull(session("SecurityLvl")) then
Session("SecurityLvl") = 4
end if
end if
'Add Audit Record
Add_Audit session("Userid"), "User_Logon", "Logon", "", "", Now()
'Open correct menu page based on user security level
Select Case session("SecurityLvl")
Case 4: If session("SecurityLvl") = 4 Then Response.Redirect "Employee_Menu.asp"
Case 3: If session ("SecurityLvl") = 3 Then Response.Redirect "Mgmt_Menu.asp"
Case 2: If session ("SecurityLvl") = 2 Then Response.Redirect "DataEntry_Menu.asp"
Case 1: If session ("SecurityLvl") = 1 Then Response.Redirect "Admin_Menu.asp"
Case Else: Response.Redirect "User_Logon.asp"
End Select
%>
<!-- #include file="Include_Files/General/Disconnect.inc" -->
This is my User_Logon.asp page
<!-- #include file="Include_Files/General/GetTestCodeValue.inc" -->
<%
Dim msg1, msg2, msgtest
Dim TestMode
TestMode = GetTestCodeValue
msg1 = " Either your userid or password is invalid!"
msg2 = " Your password is not valid!"
msg3 = " You did not enter a valid security code!"
msg = ""
if cint(request.querystring("msg")) = 1 then
msg = msg1
else
if cint(request.querystring("msg")) = 2 then
msg = msg2
else
if cint(request.querystring("msg")) = -1 then
msg=msg3
end if
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Employee Logon</title>
<script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.Password.value == "")
{
alert("Please enter a value for the \"Password\" field.");
theForm.Password.focus();
return (false);
}
if (theForm.Password.value.length < 1)
{
alert("Please enter at least 1 characters in the \"Password\" field.");
theForm.Password.focus();
return (false);
}
if (theForm.Password.value.length > 25)
{
alert("Please enter at most 25 characters in the \"Password\" field.");
theForm.Password.focus();
return (false);
}
return (true);
}
function disable(formnum, elementnum) {
if (navigator.appName == "Microsoft Internet Explorer")
document.forms[formnum].elements[elementnum].style.visibility="hidden";
}
function enable(formnum, elementnum) {
if (navigator.appName == "Microsoft Internet Explorer")
document.forms[formnum].elements[elementnum].style.visibility="inherit";
}
//--></script>
</head>
<body bgcolor="#FFFFFF" >
<form method="POST" action="User_Security.asp" name="FrontPage_Form1" onload="disable(0,2)" onsubmit="return FrontPage_Form1_Validator(this)">
<table border="0" cellspacing="0" cellpadding="0" width="633" height="377">
<tr><td width="154" height="47"><img border="0" src="images/Logo.gif"></td><td width="646" height="47"><img border="0" src="images/TitleMain.gif"></td></tr>
<tr><td colspan="2" width="800" height="80"><img border="0" src="images/TopLine.gif"></td></tr>
<tr><td width="167" height="377"><img border="0" src="images/leftbar.gif"></td><td width="633" height="377" valign="top"><br>
<form method="POST" action="User_Security.asp" name="FrontPage_Form1" onsubmit="return FrontPage_Form1_Validator(this)">
<table border="0" cellspacing="0" width="50%">
<tr>
<td width="50%"><font face="Arial" size="3"><b>Name:</b></font></td>
<td width="50%"><font face="Arial" size="3"><INPUT TYPE="text" name="Userid" size="25" tabindex="1" maxlength="25"></font></td>
</tr>
<tr>
<td width="50%"><font face="Arial" size="3"><b>Password:</b></font></td>
<td width="50%"><font face="Arial" size="3"><input type="password" name="Password" size="25" maxlength="25" tabindex="2"></font></td>
</tr>
<tr>
<td width="50%"><font face="Arial" size="3" <% if TestMode = "-1" then %> style="visibility:visible" <% else %> style="visibility:hidden" <% end if %>>Security:</font></td>
<td width="50%"><font face="Arial" size="3"><input type="text" name="EmployeeID" size="25" maxlength="25" tabindex="2" <% if TestMode = "-1" then %> style="visibility:visible" <% else %> style="visibility:hidden" <% end if %> ></font></td>
</tr>
</table>
<br><br><br>
<p><input type=image src="images/B_Logon_Off.gif" value="Login" name="Submit" onmouseover="src='images/B_Logon_On.gif'" onmouseout="src='images/B_Logon_Off.gif'"></p>
<br>
<%
response.write "<b><font color='FF0000' size='4'>" & msg
%>
</form>
</TD>
</TR>
</form>
<tr><td width="800" height="96" colspan="2">
<img border="0" src="images/footer.gif">
</td></tr>
</table>
</body>