好久没有写过asp了,这回写个留言板还真觉得有点难度,竞然写了整整一天,哈哈.
就只有留言其它的都什么也没写,采用三层结构(不知道算不算,本来对三层的概念很糊涂)
演示www.zj55.com的留言板,希望各位大哥大姐如果发现有漏洞的话请在这里告诉我,千万不要黑我的网站,在这里小弟先谢过了.
index.asp
<%@ codepage=65001%>
<%
option explicit
%>
<% response.charset="utf-8"%>
<% session.codepage=65001 %>
<!-- #include file="acchelper.asp" -->
<!-- #include file="common.asp"-->
<!-- #include file="dal_guest.asp" -->
<!-- #include file="mod_guest.asp" -->
<!-- #include file="bll_guest.asp" -->
<%
dim mybll
dim mylist
set mybll = new bll_guest
select case request("tcmd")
case "save"
mybll.insert()
case "del"
mybll.delete()
end select
mylist = mybll.findbypage()
%>
<h2>客户留言</h2>
<p>
<form name="subform" id="subform">
<textarea id="con" name="con" cols="56" rows="6" wrap="virtual"></textarea>
<input type="button" name="submit" value="提交留言" onclick="$('guest/index.asp?tcmd=save&content='+escape(this.form.con.value))" />
</form>
</p>
<%=mylist%>
bll_guest.asp
<%
'/// <summary>
'/// 摘要说明。
'/// </summary>
class bll_guest
private mycom,mymod,mydal
private li,ul
private del
'获取信息
public sub getguest()
mydal.getguest(id)
end sub
'新增信息
public sub insert()
mymod.content = request("content")
mymod.re = request("re")
mymod.addtime = now()
mymod.ip = request.servervariables("http_x_forwarded_for")
if len(mymod.ip)<=0 then mymod.ip = request.servervariables("remote_addr")
call mydal.insert(mymod)
end sub
'更新信息
public sub update()
call mydal.update(mymod)
end sub
'删除信息
public sub delete()
mydal.delete(request("id"))
end sub
'查找信息
public function findbypage()
dim pagesize,currentpage,wherevalue,ordervalue,recordcount
dim objrs
dim tmp1,tmp2,tmp3,parms,i
dim tcmd
tcmd = request("tcmd")
pagesize = "8"
currentpage = request("pageno")
if len(currentpage)<=0 then
currentpage=1
end if
wherevalue = ""
ordervalue = "id"
set objrs = mydal.findbypage(pagesize,currentpage-1,wherevalue,ordervalue)
i = 1
recordcount = mydal.count(wherevalue)
do while not objrs.eof
if tcmd="del" then
del = "<a href=""?tcmd=del&id="&objrs("id")&""">删除</a>"
else
del = ""
end if
parms=array(i,objrs("content"),objrs("ip"),objrs("addtime"),del)
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器