演示地址
源文件下载
安装说明: 在使用之前,确定空间或者本地测试服务器是否支持asp,及正常运行asp 后台登陆地址 flashgbook/admin/index.asp 用户名 admin 密 码 admin
背景图片: flashgbook/images/bg.jpg 788x430像素,可以后台上传,也可以手动覆盖!
安全设置:
1.下载后请更改数据库(flashgbook/data/data.mdb)名称 例如(flashgbook/data/stone.asp)
2.用记事本打开(flashgbook/data.asp)修改数据库名称 例如(dbname="stone.asp")
3.登陆后台 修改用户名和密码
关于外部flash加载留言本问题! 桢设置为40,要不会出现停顿现象! 使用loadMovie("flashgbook.swf",0);或者gbook_mc.loadMovie("flashgbook.swf");
ASP主要部分:
page.asp (传给flash第n页的n条纪录)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#i nclude file="conn.asp"--> <% if request("action")="showpage" then dim idcount'记录总数 dim pages'每页条数 dim pagec'总页数 dim page'页码 dim datafrom'数据表名 dim taxis'排序的语句 '-------------------设置参数开始---------------------------------
'taxis="order by id asc" '正排序 taxis="order by pxid desc,id desc" '倒排序 pages=show_page'每页条数 datafrom="gbook"'数据表名
page=clng(request("page"))
'-------------------设置参数结束--------------------------------- dim pagenmax '每页显示的分页的最大页码 dim pagenmin '每页显示的分页的最小页码 dim sqlid'本页需要用到的id dim i'用于循环的整数
'获取记录总数 sql="select count(id) as idcount from ["& datafrom &"]"
set rs=server.createobject("adodb.recordset") rs.open sql,conn,0,1
idcount=rs("idcount")'获取记录总数
if(idcount>0) then'如果记录总数=0,则不处理 if(idcount mod pages=0)then'如果记录总数除以每页条数有余数,则=记录总数/每页条数+1 pagec=int(idcount/pages)'获取总页数 else pagec=int(idcount/pages)+1'获取总页数 end if
'获取本页需要用到的id============================================ '读取所有记录的id数值,因为只有id所以速度很快 sql="select id from ["& datafrom &"] " & taxis
set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1
rs.pagesize = pages '每页显示记录数 if page < 1 then page = 1 if page > pagec then page = pagec if pagec > 0 then rs.absolutepage = page
for i=1 to rs.pagesize if rs.eof then exit for if(i=1)then sqlid=rs("id") else sqlid=sqlid &","&rs("id") end if rs.movenext next '获取本页需要用到的id结束============================================ end if %> <% if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理 '用in刷选本页所语言的数据,仅读取本页所需的数据,所以速度快 sql="select [id],[title],[name],[date] from ["& datafrom &"] where id in("& sqlid &")"&taxis set rs=server.createobject("adodb.recordset") rs.open sql,conn,0,1 while(not rs.eof)'填充数据到表格 page_id=rs("id")
page_name=uni(rs("name"))
if len(rs("title")) > 19 then '截取字符 page_title=left(rs("title"),19)&".." else page_title=rs("title") end if
page_title=uni(page_title)
'page_email=rs("email") 'page_qq=rs("qq")
page_date=rs("date")
out=out&"<info page_id='"&page_id&"' page_name='"&page_name&"' page_title='"&page_title&"' page_date='"&page_date&"' />"
rs.movenext wend rs.close set rs=nothing Response.Write "<?xml version='1.0' encoding='utf-8'?>" Response.Write "<gbook total='"&idcount&"' maxpage='"&pagec&"' page='"&page&"'>"&out&"</gbook>" Session.CodePage="936"
else total=0 maxpage=0 page=0 out="" wujilu="1" Response.Write "<?xml version='1.0' encoding='utf-8'?>" Response.Write "<gbook total='"&total&"' maxpage='"&maxpage&"' page='"&page&"' wujilu='"&wujilu&"'></gbook>" Session.CodePage="936" end if end if'end action showpage %>
show.asp(传给flash单条纪录的信息)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#i nclude file="conn.asp"--> <% if request("action")="show" then sql="select * from gbook where id in("&request("show_id")&")" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 show_name=uni(rs("name")) show_id=uni(rs("id")) show_title=uni(rs("title"))
if rs("blog")<>"" then show_blog=uni(rs("blog")) end if if rs("homepage")<>"" then show_homepage=uni(rs("homepage")) end if if rs("gmcontent")<>"" then show_gmcontent=uni(rs("gmcontent")) end if if rs("gmdate")<>"" then show_gmdate=uni(rs("gmdate")) end if
if rs("email")<>"" then show_email=uni(rs("email")) end if if rs("qq")<>"" then show_qq=uni(rs("qq")) end if show_content=uni(rs("content")) show_date=uni(rs("date")) out=out&"<info show_name='"&show_name&"' show_blog='"&show_blog&"' show_homepage='"&show_homepage&"' show_gmcontent='"&show_gmcontent&"' show_gmdate='"&show_gmdate&"' show_id='"&show_id&"' show_title='"&show_title&"' show_email='"&show_email&"' show_qq='"&show_qq&"' show_content='"&show_content&"' show_date='"&show_date&"' />" rs.close set rs=nothing Response.Write "<?xml version='1.0' encoding='utf-8'?>" Response.Write "<gbook>"&out&"</gbook>" end if %>
add.asp(flash传给asp增加纪录)
<!--#i nclude file="conn.asp"--> <% Session.CodePage="65001" if request("action")="add" then sql="select * from gbook " set rs=server.createobject("adodb.recordset") rs.open sql,conn,3,3 rs.addnew rs("name")=encodestr(request("w_name")) rs("title")=encodestr(request("w_title"))
if encodestr(request("w_homepage"))="" then rs("homepage")=null else rs("homepage")=encodestr(request("w_homepage")) end if
if encodestr(request("w_blog"))="" then rs("blog")=null else rs("blog")=encodestr(request("w_blog")) end if
if encodestr(request("w_email"))="" then rs("email")=null else rs("email")=encodestr(request("w_email")) end if
if encodestr(request("w_qq"))="" then rs("qq")=null else rs("qq")=encodestr(request("w_qq")) end if
rs("content")=encodestr(request("w_content")) rs("date")=date() rs.update rs.close set rs=nothing response.write"&addok=ok" end if Session.CodePage="936" %>
出处:蓝色理想
责任编辑:moby
上一页 下一页 flash+asp+xml留言本教程 [2]
◎进入论坛Flash专栏版块参加讨论
|