题目:【说明】
访问某聊天系统必须先注册,然后登录才可进行聊天。图4-1为注册页面,注册时需要输入用户名和密码及性别信息,数据库将记录这些信息。
表4-1为利用Microsoft access创建的数据库msg,数据库记录用户名、密码、性别、登录时间,IP地址及状态信息.
表4-1 数据库创建的字段
以下是图4-1 所示页面的部分代码,请仔细阅读该段代码,将(1)-(6)的空缺代码补齐。
<%
Set MM_editCmd=Server.CreateObject("ADODB.Command")
MM-editCmd.ActiveConnection=MM_connbbs_STRING
MM_editCmd.CommandText="INSERT INTO msg([user],upass,sex)VALUES(?,?,?)"
MM_editCmd.PrePared=true
MM_editCmd.Parameters.AppendMM_editCmd.CreateParameter("param1",202,1,225,
Request.Form("user"))'adVarWChar
MM_editCmd.Parameters.AppendMM_editCmd.CreateParameter("param2",202,1,225,
Request.Form("( 1 )"))'adVarWChar
MM_editCmd.Parameters.AppendMM_editCmd.CreateParameter("param3",202,1,225,
Request.Form("sex"))'adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
%>
< body>
< from ACTION="<%=MM_editAction%>"METHOD="( 2 )"id="form1" name="form1">
< p align="center">欢迎注册
</p>
< table width="500" border="0" align="center"cellpadding="1"cellspacing="2">
< tr><td><div align="right">请输入用户名</div></td>
< td> <input type="text"name=" ( 3 )"id="user"/></td>
< /tr><tr>
< td><div align="right">请输入密码</div></td>
< td> <input type=" ( 4 )"name="upass"id="upass"/></td>
< /tr><tr>
< td><div align="right">重复输入密码</div></td>
<td> <input type="text"name="pass2"id="pass2"/></td>
< /tr><tr>
< td><div align="right">请输入性别</div></td>
< td>
< input name="sex" type="radio "id="radio" value=" ( 5)"/>
< lable for="sex">男
<input type="radio" name="sex" id="radio2" value="female"/>
女</label></td></tr><tr>
< input type="submit" name="button" id="button" value="提交"/>
< input type=" ( 6)"name="button2"id="button2"value="重置"/></td></tr>
< /table>
(1)~(6)备选答案:
A.reset B.male C.post
D.text E.user F.upass
【问题2】(9分)
用户注册成功后的登录页面如图4-2所示。系统检查登录信息与数据库存储信息是否一致,如果一致则转到登录成功页面succ.asp。如果不一致则显示"警告:您输入的信息有误!"下面是信息显示页面的部分代码,请将下面代码补充完整。
<%
Set conn=server.createobject("adodb.connection")
Conn.Open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\wwwroot\bbs.mdb"
If request.form("user")<>""then
U=request.form("user")
P=request.form("upass")
S=request.form("sex")
Set rs=server.createobject("adodb.recordset")
rs.open "select" * from msg where(7)="&u&" and(8)="&p&" and
Sex="&s&""",conn,1,3
If.rs.(9)and rs.bof then
Response.(10)("警告:您输入的信息有误!")
Else
rs("t")=(11)()
rs("(12)")=request.ServerVariables("remote_host")
rs("zt")=1
rs.update
session("user")=u
session("(13)")=s
response.(14)"suss.asp"
end if
rs.close()
set rs=nothing
end if
%>
< body>
< form id="form1"name="form1"method="post" action="user.asp">
< p align="center">欢迎登陆</p>
< div align="center"
<td><div align="right">输入用户名</div></td>
< td><label for="user"></label>
< input type="text"name="user" id="user"/>
& nbsp;</td>
< td><div align="right">输入密码</div></td>
< td><label for="upass"></label>
& nbsp;
< input type="text"name="upass"id="upass"/></td>
< td><div align="right">您的性别</div></td>
< td>
< input name="sex" type="radio" id="radio" value="male" checked="(15)"/>
< label for="sex">男
<input type="radio" name="sex" id="radio2" value="female"/>
女</label></td>
< td> </td>
< td>
< input type="submit" name="button" id="button" value="登陆"/>
< input name="button2" type="submit" id="button2" onclick="MM_goToURL
('parent',index.asp');return document.MM_returnValue" value="返回"/></td></tr>
(7)~(15)备选答案:
A.now B.ip C.checked D.eof E.upass
F.user G.write H.sex I.redirect