I come here in shame and degradation. lol
I made a login box that was successful at logging users in. For whatever reason, it seems that only the username is being held as criteria for people to login, not the username and password.
I should mention that I changed the connection information today (wanted to make sure that I was opening and closing things correctly). I am thinking this may have had something to do with it suddenly only using the username to log users in, but could be wrong. Without further ado...
I checked my cust_login table to be sure I was calling the right columns. The column names that hold the information are: USERLOG and PASSLOG. I changed them this morning wondering if constantly using the words "username" and "password" was somehow effecting the login to function correctly? *sigh*
~E
I made a login box that was successful at logging users in. For whatever reason, it seems that only the username is being held as criteria for people to login, not the username and password.
I should mention that I changed the connection information today (wanted to make sure that I was opening and closing things correctly). I am thinking this may have had something to do with it suddenly only using the username to log users in, but could be wrong. Without further ado...
Code:
<%
dim username, password, loginButton
username=TRIM(Request("USERLOG"))
password=TRIM(Request("PASSLOG"))
logButton=Request("loginButton")="Login"
if logButton then
Dim oConn, Rec, sConn, sFilePath
Set oConn = Server.CreateObject("ADODB.Connection")
sFilePath = Server.MapPath("db/logins.mdb")
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFilePath & ";"
oConn.Open sConn
Set Rec = oConn.Execute("SELECT * FROM cust_logins WHERE [USERLOG] = '" & username & "' AND [PASSLOG] = '" & password & "'")
'If no match found, EOF is not true.
if NOT Rec.EOF then
Response.Redirect("custhome.asp")
else
blankError="Invalid username and/or password."
end if
end if
%>
<html>
<head>
<title>Customer Login</title>
</head>
<body>
<form name="Form" method="post" action="custhome.asp">
<center>
<table border =1>
<tr><td colspan="2">
<%
if blankError<>"" then
Response.Write("<center><font color='red' size='3'>"&blankError&"</font></center>")
end if
%>
</td></tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username" size="35"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" size="35"></td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" name="loginButton" value="Login">
<input type="reset" name="reset" value="Clear"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
~E