是用的access数据库!因为是一个简单的留言板程序,所以也没有其它什么页面!我再发一个提交表单页面,看是否有助于你们的分析!guestbook.asp
<!--#include file="conn.asp"-->
<!--#include file="ubb.asp"-->
<%
id=Request.QueryString("id")
If Request.QueryString("Page") = "" or Request.QueryString("Page") <= 0 then
Page = 1
Else
Page = CINT(Request.QueryString("Page"))
End If
user=Request.QueryString("user")
if user="" then
response.redirect "default.asp"
end if
set rs=server.createobject("adodb.recordset")
sql="select * from user where username='" & user &"'"
rs.Open SQL,conn,1,2
if rs.BOF or rs.EOF then
response.redirect "default.asp"
else
webname=rs("web")
web=rs("wwwhttp")
master=rs("webmaster")
kind=rs("kind")
if session("user")=rs("username") and session("pwd")=rs("password") then
adminok="ok"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>::<%=webname%>::的留言板</title>
<link rel="stylesheet" type="text/css" href="gb.css">
<script language="JavaScript">
<!--
function Juge(theForm)
{
if (theForm.name.value == "")
{
alert("请输入你的姓名!");
theForm.name.focus();
return (false);
}
if (checktext(theForm.name.value))
{
alert("请您输入有效姓名!");
theForm.name.select();
theForm.name.focus();
return (false);
}
if (theForm.email.value == "")
{
alert("请您输入你的固定电话或手机!");
theForm.email.focus();
return (false);
}
if (theForm.ly.value == "")
{
alert("请输入你的问题或打算学习的课程!");
theForm.ly.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
var checkStr = theForm.email.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (theForm.email.value.length < 11)
{
allValid = false;
}
}
function checktext(text)
{
allValid = true;
for (i = 0; i < text.length; i++)
{
if (text.charAt(i) != " ")
{
allValid = false;
break;
}
}
return allValid;
}
//-->
</script>
</head>
<form method="post" action="savebook.asp" onSubmit="return Juge(this)">
<table width="510" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" height="30">您的姓名:</td>
<td colspan="2"><input type="text" name="name" maxlength="20" size="14" class="input1" value="">
<span class="fontred">*</span> 您的真实姓名,如张三或张先生,请使用中文</td>
</tr>
<tr>
<td height="30">您的电话:</td>
<td colspan="2"><input type="text" name="email" maxlength="100" size="14" class="input1" >
<span class="fontred">*</span> 您的固定电话或手机,如01062883488或13989896688</td>
</tr>
<tr>
<td height="30">居住地址:</td>
<td colspan="2"><input type="text" name="http" maxlength="100" size="25" class="input1" >
请详细填写居住地址以便教练上门为您服务</td>
</tr>
<tr>
<td height="30">电子邮箱:</td>
<td colspan="2"><input type="text" name="oicq" maxlength="100" size="25" class="input1" >
<input name="user" value="<%=user%>" type="hidden">
请留言下你的邮箱,如jx321@163.com</td>
</tr>
<tr>
<td valign="top">请您留言:</td>
<td width="238" valign="top"><textarea name="ly" cols="30" rows="6" id="ly">我想报名,请电话联系我</textarea>
</td>
<td width="224" valign="top"><span class="fontred"> *</span> 请详细描述你的疑问或者陪练需求!</td>
</tr>
<tr align="center">
<td height="30"> </td>
<td height="36"><input type="submit" name="Submit" value="提交" class="input2">
<input type="reset" name="Submit" value="重置" class="input2"></td>
<td height="30"> </td>
</tr>
</table>
</form>
<%
set rs1=server.createobject("adodb.recordset")
sql="select * from book where user='" & user &"' order by addtime desc"
rs1.Open SQL,conn,1,2
if not (rs1.EOF or rs1.BOF) then
rs1.PageSize=10
Dim TotalPages
TotalPages = RS1.PageCount
if page>rs1.pagecount then page=rs1.pagecount
dim scount
scount=INT(Rs1.recordcount)
rs1.absolutepage=page
StartPageNum=1
do while StartPageNum+10<=Page
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>RS1.Pagecount then EndPageNum=RS1.Pagecount
i=0
do while (not rs1.EOF) and (i<RS1.PageSize)
%>
<%i=i+1
rs1.MoveNext
loop
%>
<%else%>
<%end if%>
<%end if%>
急盼高手指点,谢谢!