I put a little login (username and password textfields) in a web page, and
once the user able to login, I want the username and password textfields
will disappear, and replace with text "[UserName] has Login!]" in the same
position.
My question is how to make the username and password textfields disappear
and replace with "[UserName] has Login!]" in the same position?
This is the code I have done so far, but it has another problem: Even I
first check if the length of username field is non-zero first, it still
displays "Login Failed" before the user login. I guess it's the session
problem but don't know how to fix it.
<html>
<head>
<title>Login Form</title>
</head>
<body>
<form action="login.asp" method="post">
<table border="0">
<tr>
<td>User ID</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
</tr>
</table>
<input type="submit" value="submit">
<input type="reset" value="reset">
</form>
<!-- #include file="dbConn.asp"-->
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common
Files\System\ado\msado15.dll" -->
<%
If Len(Request.Form("username")) <> 0 Then
Dim strusername, strpassword, sqlStmt, objRS
strusername = Request.Form("username")
strpassword = Request.Form("password")
sqlStmt = "select * from [Password] where UserName = '" & strusername &
"'" & _
" And Password = " & "'" & strpassword & "'" & ";"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open sqlStmt, strConnect ', adOpenStatic, adLockReadOnly,
adCmdTable
If objRS.EOF Then
Response.Write "Login Failed"
Else
Response.Write "Login Success: " & _
"UserName = " & strusername & "," & _
"Password = " & strpassword
End If
End If
%>
</body>
</html>
please advise! thanks!
john