I recently created an asp application (my first) in which
users login to a secure section of a website to edit their personal
information. It works well for 95% of the users, but a small percentage cannot
login successfully. I have tried changing their user names/passwords to something
very simple (to eliminate user error), but they still cannot login.
I have tried their user names/passwords and can login, so I’m
assuming it is a compatibility issue of some sort. The code from my login page
is below. The user names/pws are stored in the database in the table ‘logins’.
Any help would be greatly appreciated.
Thanks,
Jason
____________________
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
If Session("isAdmin") = "T" Then
If Request.QueryString("logout") <> "" then
Session("login") = ""
Session("targetClub") = ""
Else
Response.redirect "http://www.rdga.org/directory/admin/00_code/admin_page.asp"
End If
End If
Function SqlEscape(s)
SqlEscape = Replace(s,"'","''")
End Function
Dim targetClub 'Target Club
Dim allaccount
allaccount = "52-000"
dim conn,rs,msg,rs2,rs3,getTarget,m
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/") & "\..\datafiles\directory\club_data.mdb"
Set getTarget = Conn.Execute("select * from logins where login='" + SqlEscape(Request.Form("login")) + "'")
If getTarget.EOF then
msg = "Error: Invalid User Name. Be sure you are using LOWER
CASE letters and NO SPACES for both the user name and password."
m = "T"
else
targetClub = getTarget("club")
Set rs3 = Conn.Execute("select * from Directory_Data where Club_Number='" & targetClub & "'")
Session("Club_Name") = rs3("Club_Name")
Set rs = Conn.Execute("select * from logins where club='" &
targetClub & "' and login='" + SqlEscape(Request.Form("login")) +
"'")
Set rs2 = Conn.Execute("select * from logins where club='"
& allaccount & "' and login='" +
SqlEscape(Request.Form("login")) + "'")
If rs("club") = allaccount then
If rs2.EOF then
msg = "No such user"
m = "T"
ElseIf rs2("pw") <> Request.Form("password") then
msg = "Invalid Passowrd"
m = "T"
Else
Session("login") = rs2("login")
Session("targetClub") = "52-000"
Session("isAdmin") = "T"
Response.Redirect "http://www.rdga.org/directory/admin/00_code/admin_page.asp"
End If
Else
If rs.EOF then
msg = "No such user"
m = "T"
ElseIf rs("pw") <> Request.Form("password") then
msg = "Invalid Passowrd"
m = "T"
Else
Session("login") = rs("login")
Session("targetClub") = targetClub
Session("isAdmin") = ""
End If
End If
End If
ElseIf Request.QueryString("logout") <> "" then
Session("login") = ""
Session("targetClub") = ""
targetClub = ""
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>RDGA Online Course Directory</title>
<link rel="stylesheet" type="text/css" href="http://www.rdga.org/def2.css">
</head>
<body>
<% If m = "T" Then
Response.write(msg)
m = ""
End If
%>
<% If Session("login") = "" Then %>
<form method="POST" action="">
<table border="0" width="300" id="table14">
<tr>
<td>
<p>Login Name</td>
<td><input type="text" name="login" size="20"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" size="20"></td>
</tr>
</table>
<input type="submit" value="Login" name="B1"><input type="reset" value="Clear" name="B2"></form>
<% else %>
<b><font size="4"><% Response.Write(Session("Club_Name")) %></font></b><p align="left">
<b><a href="http://www.rdga.org/directory/admin/00_code/edit_form.asp">
<font color="#0000FF" size="3">Edit Club Information</font></a></b>
<br>
<b><a href="http://www.rdga.org/directory/admin/00_code/ghin_form.asp"><font color="#0000FF" size="3">
GHIN/Handicap Contact Information Update</font></a></b><br>
<b><a href="http://www.rdga.org/directory/admin/00_code/change_pw.asp"><font
color="#0000FF" size="3">Change
Password</font></a></b><br>
<b><a href="http://www.rdga.org/directory/admin/00_code/login.asp?logout=1"><font
color="#0000FF" size="3">Log
Out</font></a></b></p>
<p align="center">
<% end if %>
<% If Session("updated") = "T" Then %><b><font size="4">Update Complete!</font></b></p>
<p>
<% Session("updated")="" %><% End If %>
</b>
</body>
</html>