ASP留言板(在一页里实现所有功能)

很久没发贴了,因为这些时间又在做ASP的页面,没用dotnet,有时真有点过意不去了。唉!中国现状呀!
发一个ASP留言板,当资料存着,自己写的,很简单。把留言功能,删除功能,回复留言功能都写到一个页面里的,用的ACCESS数据库,数据库结构直接看源代码出能分板出来了。
<dim newConn,pwd,pagenum
pwd
="aowind"
pagenum=5
set newconn=Server.CreateObject("ADODB.Connection")
dbpath
= server.mappath("data/langzhong.mdb")
newconn.open 
= "provider=microsoft.jet.oledb.4.0; data source =" & dbpath %>
<%
dim t_pwd,t_id,t_answer
t_pwd
=request("pwd")
t_id
=request("id")
t_answer
=request("answer")
if t_id<>"" and t_pwd=pwd and t_answer="" then
sqlcmd
="delete from guest where id="&t_id&""
newconn.execute sqlcmd
end if 
if t_id<>"" and t_pwd=pwd and t_answer<>"" then
set rs = Server.CreateObject("ADODB.recordset")
sqlcmd
="select * from guest where id=" & t_id
rs.open sqlcmd, newconn,
3,2
rs(
"answer")=t_answer
rs.update
rs.close
end if    
%
>
<%
dim t_name,t_form,t_email,t_cont,t_ip,t_attime,t_qq,t_teleno
t_qq
=request("qq")
t_teleno
=request("teleno")
if t_teleno="" then t_teleno=" "
t_name=request("name")
t_form
=request("form")
if t_form="" then t_form=" "
t_email=request("email")
if t_email="" then t_email=" "
t_cont=Server.HTMLEncode(request("cont"))
t_ip
=request.servervariables("Remote_addr")
t_attime
=cstr(year(now))&"/"&cstr(month(now))&"/"&cstr(day(now))&"-"&cstr(hour(now))&":"&cstr(minute(now))&":"&cstr(second(now))

if t_name<>"" and t_cont<>"" and t_qq<>"" then
sqlcmd
="insert Into guest(name,qq,teleno,form,email,cont,ip,attime) values ('"&t_name&"','"&t_qq&"','"&t_teleno&"','"&t_form&"','" & t_email & "','" & t_cont & "','" & t_ip & "','" & t_attime & "')"
newconn.Execute sqlcmd
end if
%
>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">

<TITLE>langzhong.com.cn 阆中=朗忠 服务器 虚拟主机 网站推广 网站制作 合租计划 服务器直销</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<style>
<!--
td           { font
-size: 9pt }
        table {WORD
-BREAK: break-all;}
-->
</style>
</HEAD>
<BODY BGCOLOR=#C0C0C0 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<div align="center">
  
<center>
  
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
    
<tr>
      
<td width="100%" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
<TABLE WIDTH=459 BORDER=0 CELLPADDING=0 CELLSPACING=0 height="1316">
    
<TR>
        
<TD ROWSPAN=2 width="171" height="204">
            
<IMG SRC="images/guest_1.gif" ALT="" width="171" height="204"></TD>
        
<TD width="429" height="57">
            
<a href="index.html">
            
<IMG SRC="images/money_2.gif" border="0" width="429" height="57"></a></TD>
        
<TD width="1" height="57">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=57 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="429" background="images/guest_3.gif" height="147">
             
</TD>
        
<TD width="1" height="147">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=147 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="84">
            
<IMG SRC="images/guest_4.gif" ALT="" width="171" height="84"></TD>
        
<TD ROWSPAN=2 width="429" height="118">
            
<IMG SRC="images/guest_5.gif" ALT="" width="429" height="118"></TD>
        
<TD width="1" height="84">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=84 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD ROWSPAN=2 width="171" height="68">
            
<IMG SRC="images/guest_6.gif" ALT="" width="171" height="68"></TD>
        
<TD width="1" height="34">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=34 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="429" height="34">
            
<IMG SRC="images/guest_7.gif" ALT="" width="429" height="34"></TD>
        
<TD width="1" height="34">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=34 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="45">
            
<a href="tuoguan.html">
            
<IMG SRC="images/index_10.gif" border="0" width="171" height="45"></a></TD>
        
<TD ROWSPAN=10 width="429" background="images/guest_9.gif" align="center" valign="top" height="960">
            
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber2">
            
<tr> 
              
<td width="100%"> 
              
<%
              
if request.querystring("del"<> ""  then
    t_id
=request.querystring("del")
    %
>
                
<div align="center">
                  
<center>
                
<table width="90%" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
                  
<tr> 
                    
<td>
<form name="form2" method="post" action="guest.asp">
                        请输入管理员密码: 
                        
<input name="pwd" type="text" id="pwd" size="20">
                        
<input type="hidden" name="id" value="<% =t_id %>">
                        
<input type="submit" name="Submit" value="提交">
                      
</form></td>
                  
</tr>
                
</table>

                  
</center>
              
</div>

    
<else 
    
if request.querystring("id"<> "" then
    t_id
=request.querystring("id")
    %
>
              
<div align="center">
                
<center>
    
<table width="90%" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
                  
<tr> 
                    
<td>
<form name="form2" method="post" action="guest.asp">
                        输入答复:
                        
<textarea name="answer" cols="40" id="answer" rows="1">必须输入,否则会删除此留言</textarea>
                        
<br>
                        请输入管理员密码: 
                        
<input name="pwd" type="text" id="pwd" size="20">
                        
<input type="hidden" name="id" value="<% =t_id %>">
                        
<input type="submit" name="Submit" value="提交">
                      
</form></td>
                  
</tr>
                
</table>
                
</center>
              
</div>
    
<%else%>
                
<%set rs = Server.CreateObject("ADODB.recordset")
sqlcmd
="select * from guest order by id desc"
rs.open sqlcmd, newconn,1,1
rs.pagesize
=pagenum
if request.querystring("page"<> "" then
page
=Clng(request.querystring("page"))
end if
if page < 0 then
    page 
= 0
else 
    
if page => rs.pagecount then
        page
=rs.pagecount-1
    
end if
end if
u
=page+1
t
=page*pagenum
f
=T+pagenum
if t <> 0 then
for i=1 to t
    rs.movenext
next
end if
%
>
                
<%
for i= 1 to pagenum
    %
>
              
<div align="center">
                
<center>
                
<table width="90%" height="169" border="0" cellpadding="0" cellspacing="0" bordercolor="#999999" style="border-collapse: collapse">
                
<tr align="right"> 
                    
<td height="25" colspan="2" bgcolor="#000000"><a href="guest.asp?id=<%=rs("id")%>"><font color="#FFFFFF">答复</font></a> 
                      
&nbsp;&nbsp;&nbsp;&nbsp; <a href="guest.asp?del=<%=rs("id")%>"><font color="#FFFFFF">删除</font></a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                
</tr>
                
<tr> 
                  
<td width="27%" height="89" align="center" valign="top" bgcolor="#CCCCCC">
                  
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
                    
<tr>
                      
<td width="100%" height="25">&nbsp;姓名:<%=rs("name")%></td>
                    
</tr>
                    
<tr>
                      
<td width="100%" height="25">&nbsp;QQ:<%=rs("qq")%></td>
                    
</tr>
                    
<tr>
                      
<td width="100%" height="25">&nbsp;电话:<%=rs("teleno")%></td>
                    
</tr>
                    
<tr>
                      
<td width="100%" height="25">&nbsp;来自:<%=rs("form")%></td>
                    
</tr>
                    
<tr>
                      
<td width="100%" height="25">&nbsp;Email:<%=rs("email")%></td>
                    
</tr>
                  
</table>
                    
</td>
                  
<td width="73%"><%=Server.HTMLEncode(rs("cont"))%></td>
                
</tr>
                
<tr> 
                  
<td height="24" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;IP: <%=rs("ip")%>&nbsp;&nbsp;留言时间:<%=rs("attime")%></td>
                
</tr>
                
<if rs("answer")<>"" then %>
                
<tr> 
                    
<td height="24" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;站长回答:<br>
                      
&nbsp;&nbsp;&nbsp;&nbsp;<%=rs("answer")%></td>
                
</tr>
                
<end if %>
              
</table>
                
</center>
              
</div>
              
<br>
              
<br>
              
<
rs.movenext
if rs.eof then exit for
next %>
              
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="20">
    
<tr>
                  
<td align="center"><%=rs.recordcount %>条留言 每页<%=pagenum%>条 第 
                    
<=u %>
                    
/ 
                    
<=rs.pagecount %>
                    页 
<a href="guest.asp?page=0">首页</a> <a href="guest.asp?page=<%=(page-1)%>">上一页</a> 
                    
<a href="guest.asp?page=<%=(page+1)%>">下一页</a> <a href="guest.asp?page=<% =rs.pagecount-1 %>">尾页</a></td>
    
</tr>
    
</table>
<%
rs.close
%
><form name="form1" method="post" action="guest.asp">
            
                
<p align="center"><font color="#FF0000">*</font>号为必填项,否则不能提交成功</p>
                  
<div align="center">
                    
<center>
                  
<table width="90%" height="321" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse">
                    
<tr> 
                      
<td width="19%" height="25" align="center" bgcolor="#CCCCCC">姓名:</td>
                      
<td width="81%">
                      
<input name="name" type="text" id="name" size="20"> 
                        
<font color="#FF0000">*</font></td>
                    
</tr>
                    
<tr>
                      
<td height="25" align="center" bgcolor="#CCCCCC">QQ:</td>
                      
<td><input name="qq" type="text" id="qq" size="20">
                        
<font color="#FF0000">*</font></td>
                    
</tr>
                    
<tr> 
                      
<td height="25" align="center" bgcolor="#CCCCCC">联系电话:</td>
                      
<td>
                      
<input name="teleno" type="text" id="teleno" size="20"></td>
                    
</tr>
                    
<tr> 
                      
<td height="25" align="center" bgcolor="#CCCCCC">来自:</td>
                      
<td><input name="form" type="text" id="form" size="20"> </td>
                    
</tr>
                    
<tr> 
                      
<td height="26" align="center" bgcolor="#CCCCCC">Email:</td>
                      
<td><input name="email" type="text" id="email" size="20"> </td>
                    
</tr>
                    
<tr> 
                      
<td height="154" align="center" bgcolor="#CCCCCC">内容:</td>
                      
<td><textarea name="cont" cols="40" rows="8" id="name4"></textarea> 
                        
<font color="#FF0000">*</font></td>
                    
</tr>
                    
<tr align="center"> 
                      
<td height="30" colspan="2"><input type="submit" name="Submit3" value="提  交"></td>
                    
</tr>
                  
</table>
                    
</center>
                
</div>
  
</form>
<%end if
end if%>
<%
newconn.close
%
>            
            
                
</td>
            
</tr>
            
<tr> 
              
<td width="100%" height="25" align="center"> <font color="#000000">相关证书及授权印件:</font><a href="tup/021icp.jpg" style="text-decoration: none"><font color="#FF0000">ICP证书</font></a><font color="#FF0000">&nbsp; 
                
</font> <a href="tup/sq.jpg" style="text-decoration: none"><font color="#FF0000">申网授权</font></a><font color="#FF0000">&nbsp; 
                
</font> <a href="tup/sy1.jpg" style="text-decoration: none"><font color="#FF0000">企业会员证</font></a><font color="#FF0000">&nbsp; 
                
</font> <a href="tup/yyzz.jpg" style="text-decoration: none"><font color="#FF0000">营业执照</font></a><font color="#FF0000"> 
                
<a href="icp.html" style="text-decoration: none"> <font color="#FF0000">ICP备案</font></a></font></td>
            
</tr>
            
<tr> 
              
<td width="100%" height="25" align="center"> <a href="aboutus.html" style="text-decoration: none"> 
                
<font color="#000000">About us</font></a> | <a href="money.html" style="TEXT-DECORATION: none"> 
                
<font color="#000000">如何交费</font></a> | <a href="http://bbs.langzhong.com.cn/User/UserJoin.asp" style="TEXT-DECORATION: none"> 
                
<font color="#000000">网站论坛</font></a> | <font color="#111111"> 
                
<a href="http://shop33102053.taobao.com/" style="text-decoration: none"> 
                
<font color="#000000">朗忠淘宝店</font></a></font> | <a href="dl.htm" style="text-decoration: none"> 
                
<font color="#000000">代理加盟</font></a> | <a href="other.html" style="text-decoration: none"> 
                
<font color="#000000">其它业务</font></a></td>
            
</tr>
            
<tr> 
              
<td width="100%" height="25" align="center"> <font face="宋体" color="#000000">服务器租用QQ即时交谈 租用客服1号</font><font face="宋体" color="#4A4A4A"><a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin=415846053&Site=www.langzhong.com.cn&Menu=yes"><font color="#000000"><img border="0" SRC=http://wpa.qq.com/pa?p=1:415846053:5 alt="点击这里给我发消息"></font></a></font><font face="宋体" color="#000000"> 
                租用客服2号
</font><font face="宋体" color="#4A4A4A"><a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin=6235700&Site=www.langzhong.com.cn&Menu=yes><font color="#000000"><img border="0" SRC=http://wpa.qq.com/pa?p=1:6235700:5 alt="点击这里给我发消息"></font></a></font></td>
            
</tr>
          
</table>
        
</TD>
        
<TD width="1" height="45">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=45 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="41">
            
<a href="idc.html">
            
<IMG SRC="images/index_11.gif" border="0" width="171" height="41"></a></TD>
        
<TD width="1" height="41">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=41 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="42">
            
<a href="domain.html">
            
<IMG SRC="images/index_12.gif" border="0" width="171" height="42"></a></TD>
        
<TD width="1" height="42">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=42 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="42">
            
<a href="hezu.html"><img border="0" src="images/idc_12.gif" width="171" height="42"></a></TD>
        
<TD width="1" height="42">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=41 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="41">
            
<a href="webhosting.html">
            
<IMG SRC="images/index_15.gif" border="0" width="171" height="41"></a></TD>
        
<TD width="1" height="41">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=41 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="40">
            
<a href="search.html">
            
<IMG SRC="images/index_18.gif" border="0" width="171" height="40"></a></TD>
        
<TD width="1" height="40">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=40 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="41">
            
<a href="webdesign.html">
            
<IMG SRC="images/money_14.gif" border="0" width="171" height="41"></a></TD>
        
<TD width="1" height="41">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=41 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="47">
            
<a href="money.html">
            
<IMG SRC="images/index_20.gif" border="0" width="171" height="47"></a></TD>
        
<TD width="1" height="47">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=47 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" height="23">
            
<IMG SRC="images/guest_17.gif" ALT="" width="171" height="23"></TD>
        
<TD width="1" height="23">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=23 ALT=""></TD>
    
</TR>
    
<TR>
        
<TD width="171" background="images/guest_18.gif" align="center" valign="top" height="598">
            
<div align="center">
              
<center><form action=http://bbs.langzhong.com.cn/User/login.asp method="post">
              
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="94%" id="AutoNumber2" height="139">
                
<tr>
                  
<td width="35%" height="25">用户名:</td>
                  
<td width="65%" height="25" align="center">
                  
<input name=user type=text maxlength=20 size=12 value="" class=fminpt></td>
                
</tr>
                
<tr>
                  
<td width="35%" height="25">&nbsp; 码: </td>
                  
<td width="65%" height="25" align="center">
                  
<input name=pass type=password maxlength=20 size=12 value="" class=fminpt></td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="25">有效期:<Select name=CkiExp>
                            
<option value="-1">无效
                            
<option value="365">一年
                            
<option value=1>一天
                            
<option value=2>两天
                            
<option value=7>一周
                            
<option value=31>一月
                        
</select>&nbsp;&nbsp;
                
<input name=submitflag type=hidden value="ddddls-+++">
                  
<input type=submit value="登录" class=fmbtn style="background-color: #FFFFFF"></td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="25">[<a href=../User/UserGetPass.asp><font color="#4A4A4A">忘记密码了</font></a>] [<a href=../User/UserJoin.asp><font color="#4A4A4A">新用户注册</font></a>]</td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="3" background="s_8.gif"></td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="22">
                    
<p align="center"><a href="http://www.021online.com">
                    
<img border="0" src="http://www.021online.net/photo/mark.gif" width="120" height="35"></a>
                  
</td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="22" align="center">
                    
<a href="http://app.shca.gov.cn/enterprise/jsp/special/shca.gov.cn/IcpInfos.jsp?recordsn=1113" target="_blank" style="font-size: 12px; color: #4a4a4a; text-decoration: none">
                    沪ICP:B2
-20040587 </a>
                  
</td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="22" align="center">
                    
<a href="http://www.3sdc.com">
                    
<img border="0" src="3sdc.gif" width="90" height="35"></a></td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="22" align="center">
                    赣ICP备05000434号
</td>
                
</tr>
                
<tr>
                  
<td width="100%" colspan="2" height="39" align="center">
                    
<a href="http://buy.langzhong.com.cn">
                    
<img border="0" src="tblogo.gif" width="100" height="39"></a></td>
                
</tr>
              
</table>
              
</center>
            
</div>
</TD>
        
<TD width="1" height="598">
            
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=83 ALT=""></TD>
    
</TR>
</TABLE>
</div>
</div>
</div>
</div>
</div>
</BODY>
</HTML>
posted @ 2005-07-14 09:22  Aowind  阅读(2324)  评论(4编辑  收藏  举报