我想请问基于sqlsever数据库和dw,思考二的当密码格式错误出现的额外文本框如何实现?数据库期终课c设计
![img](
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/30088306458612.png "#lefthttps://img-mid.csdnimg.cn/release/static/image/mid/ask/218596064586117.png "#left")
")
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/conn2.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn2_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.login_user (username, psw) VALUES (?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 50, Request.Form("t1")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 50, Request.Form("t2")) ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "index_student.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim rs
Dim rs_cmd
Dim rs_numRows
Set rs_cmd = Server.CreateObject ("ADODB.Command")
rs_cmd.ActiveConnection = MM_conn2_STRING
rs_cmd.CommandText = "SELECT * FROM dbo.login_user"
rs_cmd.Prepared = true
Set rs = rs_cmd.Execute
rs_numRows = 0
%>
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.indexfont {
color: #FFF;
font-size: 24px;
text-align: center;
font-weight: bold;
}
.indextablefont {
color: #090;
}
#form1 table tr td {
font-size: x-small;
}
</style>
</head>
<body>
<table width="60%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000FF" class="indexfont">::新用户注册::</td>
</tr>
<tr>
<td height="145"><form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
<table width="60%" border="0" align="center">
<tr>
<td width="36%" class="indextablefont">Username:</td>
<td width="64%"><input type="text" name="t1" id="t1" /></td>
</tr>
<tr>
<td class="indextablefont">Password:</td>
<td><input type="text" name="t2" id="t2" />
(密码要求为6-10位)</td>
</tr>
<tr>
<td class="indextablefont">验证码:</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="button" type="submit" class="indextablefont" id="button" value="注册" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form></td>
</tr>
<tr>
<td bgcolor="#0033FF" class="indexfont">::版权所有::</td>
</tr>
<tr>
<td bgcolor="#0033FF" class="indexfont"> </td>
</tr>
</table>
</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/conn2.asp" -->
<%
Dim rs
Dim rs_cmd
Dim rs_numRows
Set rs_cmd = Server.CreateObject ("ADODB.Command")
rs_cmd.ActiveConnection = MM_conn2_STRING
rs_cmd.CommandText = "SELECT * FROM dbo.login_user"
rs_cmd.Prepared = true
Set rs = rs_cmd.Execute
rs_numRows = 0
%>
<%
' *** 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("name"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "student_list.asp"
MM_redirectLoginFailed = "index_student.asp?err=用户名或密码错误"
MM_loginSQL = "SELECT username, psw"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.login_user WHERE username = ? AND psw = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_conn2_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("psw")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
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
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true 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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.indexfont {
color: #FFF;
font-size: 24px;
text-align: center;
font-weight: bold;
}
.indextablefont {
color: #090;
}
</style>
<script type="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
</head>
<body>
<table width="60%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0099FF" class="indexfont">::理工教学管理系统学生端登录::</td>
</tr>
<tr>
<td height="145"><form ACTION="<%=MM_LoginAction%>" METHOD="POST" id="user_login" name="user_login">
<table width="60%" border="0" align="center">
<tr>
<td width="36%" class="indextablefont">Username:</td>
<td width="64%"><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td class="indextablefont">Password:</td>
<td><input type="password" name="psw" id="psw" /></td>
</tr>
<tr>
<td class="indextablefont">验证码:</td>
<td><input type="text" name="name2" id="name2" /></td>
</tr>
<tr>
<td> </td>
<td><input name="button" type="submit" id="button" value="登录" />
<input name="button2" type="button" id="button2" onclick="MM_openBrWindow('index_student_zhuce.asp','','')" value="注册" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td bgcolor="#00CCFF" class="indexfont">::48号版权所有::</td>
</tr>
<tr>
<td bgcolor="#0099FF" class="indexfont"><%= Request.QueryString("err") %></td>
</tr>
</table>
</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>