第四章 各页面设计与代码
4.1用户注册页
该页面有三个表单元素
页面所涉及的数据库表信息
此面公向系统提交用户注册名称和密码,并没有涉及到数据库表的操作.
页面代码:
<%
if session(“user_id”)<>1 then
response.redirect”havereg.htm”
end if
%>
4.2用户注册不成功页regsubmit.asp
页面中需要填写HTML表单元素.
此页无需填写表单元素.
页面所涉及的数据库表信息
此页为系统验证用户注册名称和密码,涉及到用户数据库表USER_REG的操作.
页面代码分析
<!--#include file="conn.asp"-->
<%
user_name =left(request("user_name"),10)
password =left(request("password"),10)
if password="" then
response.write "数据有错!"
response.end
end if
Set rs_user = Server.CreateObject("ADODB.Recordset")
sql="select * from user_reg where user_name like '" & user_name & "'"
rs_user.open sql,conn,3,2
if rs_user.eof and rs_user.bof then
rs_user.addnew
rs_user("user_name")=user_name
rs_user("password")=password
rs_user("date")=date
rs_user.update
rs_user.movelast
session("user_id")=rs_user("user_id")
rs_user.close
response.redirect "regok.asp"
response.end
else
%>
3用户注册成功页
页面中需要用户填写的HTML表单元素
此页面为用户注册成功后显示的页面,页面中无需填写HTML表单.
页面所涉及的数据库表信息
此页没有涉及到数据库表的操作
4.4 用户填写个人信息页
页面所涉及的数据库表信息
此页为用户填写个人档案页面,并没有涉及到数据库表的操作.
页面代码分析
<!--#include file="conn.asp"-->
<%
dim rs_lar
dim sql
dim i
if isnull(session("user_id")) then
response.redirect "timeout.htm"
end if
if session("user_id")="1" then
response.redirect "notreg.htm"
response.end
end if
Set rs_lar = Server.CreateObject("ADODB.Recordset")
sql="select * from larchives where user_id =" & session("user_id")
rs_lar.open sql,conn,3,2
if not(rs_lar.eof and rs_lar.bof) then
response.redirect "haveregist.htm"
response.end
end if
rs_lar.close
set rs_lar=nothing
set conn=nothing
%>
4.5用户信息显示页read.asp
页面中需要用户填写的HTML表单元素
此页面为用户档案显示页面,页面中无需填写HTML表单元素.
页面所涉及的数据库表信息
此页涉及到用户详细注册信息数据库表larchives的操作.
页面代码分析
<%
Option Explicit
dim connpic
dim rs_lar,rspic,rs_ap