| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 514 人关注过本帖
标题:谁能帮忙调试这段程序吗?实在是没办法了.
只看楼主 加入收藏
jun81340
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-11-17
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
谁能帮忙调试这段程序吗?实在是没办法了.
<!--#include file=conn.asp-->
<!--#include file=../config.asp-->
<!--#include file=session.asp-->
<!--#include file=error.asp-->

//-->
</SCRIPT>
<%Set rs = Server.CreateObject("ADODB.Recordset")
sql="select BoardType,BoardID,layer from Ms_Board where layer>1 order by BoardID asc"
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
layers=rs("layer")
boardlist=boardlist&"<option value="&rs("boardid")&">"
if layers>1 then
for i=1 to layers
boardlist=boardlist&"&nbsp;"
next
boardlist=boardlist&"|-"
else
boardlist=boardlist&"+"
end if
boardlist=boardlist&""&rs("Boardtype")&"</option>"
rs.movenext
loop
else
boardlist=boardlist&"<option value=0>无论坛</option>"
end if
rs.close
%>
<html>
<head>
<title><%=Systemname%>->广告管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="reply-to" content="jun81340@
<meta name="Copyright" content="Copyright (C) 2002-2008 jun81340.All signature Rights Reserved.">
<link href="admin.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="98%" border="0" cellspacing="1" cellpadding="3" class="tableBorder">
  <tr align="center">
    <td height=25 class="bodytitle">广告管理</td>
  </tr>
  <tr>
    <td height="35" class="forumRow"><B>注意</B>:不选择版块名,默认为论坛主页广告;</td>
  </tr>
  <tr>
    <td height="25" class="forumRow">管理快捷方式:<a href="Admin_ads.asp">广告管理首页</a>
      | <a href="Admin_ads.asp?search=1">点击最高</a> | <a href="Admin_ads.asp?search=2">到期广告</a>
      | <a href="Admin_ads.asp?action=addnew">添加广告</a></td>
  </tr>
</table>
<%
if action="addnew" then
call addnews()
elseif action="saveadd" then
call saveadd()
elseif action="etable" then
call etable()
elseif action="saveedit" then
call saveedit()
elseif action="view" then
call view()
end if
if action="" then%>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="3" class="tableBorder">
  <form name="listform" method="post" action="admin_ads.asp?action=delall">
    <tr align="center">
      <td height=25 colspan="8" class="bodytitle">广告列表</td>
    </tr>
    <tr>
      <td width="5%" height="24" align="center" class="forumRow">编号</td>
      <td width="12%" align="center" class="forumRow">版块名称</td>
      <td width="39%" align="center" class="forumRow">广告说明</td>
      <td width="9%" align="center" class="forumRow">点击数</td>
      <td width="12%" align="center" class="forumRow">添加时间</td>
      <td width="11%" align="center" class="forumRow">到期时间</td>
      <td width="7%" align="center" class="forumRow">修改</td>
      <td width="5%" align="center" class="forumRow">操作</td>
    </tr>
    <%Set rs = Server.CreateObject("ADODB.Recordset")
    if search="" then
sql="select GID,BoardID,Title,Url,Hits,addtime,endtime from Ms_ads order by GID desc"
elseif search=1 then
sql="select GID,BoardID,Title,Url,Hits,addtime,endtime from Ms_ads order by Hits desc"
elseif search=2 then
sql="select GID,BoardID,Title,Url,Hits,addtime,endtime from Ms_ads where Datediff('d',endtime,date())=1 order by addtime desc"
end if
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
i=0
totalPut=rs.recordcount
   rs.move  (currentPage-1)*MaxPerPage
   rs.pagesize=MaxPerPage '得到每页数
   mpage=rs.pagecount     '得到总页数
                   dim i
                   i=0
                      do while not rs.eof
                      GID=rs("GID")
                      BoardID=rs("BoardID")%>
    <tr>
      <td height="24" align="center" class="forumRow"><%=GID%></td>
      <td height="24" align="center" class="forumRow"><%Call boardidt(BoardID)%></td>
      <td height="24" class="forumRow"><a href=admin_ads.asp?action=view&Gid=<%=Gid%> title=点击查看><%=rs("Title")%></a></td>
      <td height="24" align="center" class="forumRow"><%=rs("Hits")%></td>
      <td height="24" align="center" class="forumRow"><%=rs("addtime")%></td>
      <td height="24" align="center" class="forumRow"><%=rs("endtime")%></td>
      <td height="24" align="center" class="forumRow"><a href="Admin_ads.asp?action=etable&Gid=<%=Gid%>">修改</a></td>
      <td height="24" align="center" class="forumRow"><input type="checkbox" name="Gid" value="<%=GID%>"></td>
    </tr>
    <%i=i+1  
if i>=MaxPerPage then exit do
 rs.movenext
 loop%>
    <tr align="center">
      <td height="24" colspan="8" class="forumRow">
        <%
call page()
sub page()%>
        页次:<b><font color="#FF0000"><%=currentPage%></font>/<%=mpage%></b>,每页<b><%=MaxPerPage%></b>个,当前广告<b><%=totalPut%></b>个
        <%
    pageno=currentPage
    if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
        pageno=1
    end if
%>
        [
        <%if cint(pageno)>1 then%>
        <a href=?<%=searchn%>>
        <%end if%>
        <<-</a>
        <%if cint(pageno)>1 then%>
        <a href=?page=<%=pageno-1%>&<%=searchn%>>
        <%end if%>
        <-</a>
        <%                  
pp=cint(pageno)-3            
  if pp<1 then            
  pp=1            
  end if            
for pno=pp to mpage            
p=p+1            
if pno=cint(pageno) then%>
        <font color="#FF0000"><%=pno%></font>
        <%else%>
        <a href=?page=<%=pno%>&<%=searchn%>><%=pno%></a>
        <%end if%>
        <%                  
if p>=7 then exit for            
next%>
        <%if cint(pageno)< mpage then%>
        <a href=?page=<%=pageno+1%>&<%=searchn%>>
        <%end if%>
        -></a>
        <%if cint(pageno)< mpage then%>
        <a href=?page=<%=mpage%>&<%=searchn%>>
        <%end if%>
        -&gt;&gt;</a> ]
        <%
end sub%>
      </td>
    </tr>
    <tr align="right">
      <td height="24" colspan="8" class="forumRow"> <input type="checkbox" name="chkall" value="on" onClick="CheckAll(this.form)">
        选中所有记录 用户操作:
        <input name="delall" type="submit" id="delall" onClick="{if(confirm('确定删除选定记录吗!?')){this.document.listform.submit();return true;}return false;}" value="删除">
      </td>
    </tr>
    <%else
                    response.Write("<table  border=""0"" cellspacing=""1"" cellpadding=""3"" class=""tableBorder""><tr><td height=25  class=""bodytitle""  id=tabletitlelink>信息提示</td></tr><tr><td height=25 class=""forumRow"">数据库中没有记录!</td></tr></table>")
                    end if
                    rs.close%>
  </form>
</table>
<%end if

sub addnews()%>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="3" class="tableBorder">
  <form name="formadd" method="post" action="Admin_ads.asp?action=saveadd">
    <tr align="center">
      <td height=25 colspan="2" class="bodytitle">广告<b>添加</b></td>
    </tr>
    <tr>
      <td width="24%" height="24" align="right" class="forumRow">广告说明:</td>
      <td width="76%" class="forumRow"> <input name="Title" type="text" id="Title" size="30" maxlength="200">
      </td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">版块名称:</td>
      <td height="24" class="forumRow"><select name="boardid" size=1>
          <option value=0>论坛首页</option>
          <%=boardlist%> </select></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">广告图片:</td>
      <td height="24" class="forumRow"><input name="Picurl" type="text" id="Picurl" size="30" maxlength="200"><input type="button" name="Submit" value="上  传" onClick="window.open('upload_flash.asp?formname=formadd&editname=Picurl&uppath=../<%=SaveUpFilesPath%>','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">点击地址:</td>
      <td height="24" class="forumRow"><input name="Url" type="text" id="Url" size="30" maxlength="200">
        点击广告要访问的网页</td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">开始时间:</td>
      <td height="24" class="forumRow"><input name="Addtime" type="text" id="Addtime" value="<%=date()%>" size="20" maxlength="20">
        时间格式:2005-1-31 </td>
    </tr>
    <tr>
      <td height="11" align="right" class="forumRow">结束时间:</td>
      <td height="11" class="forumRow"><input name="Endtime" type="text" id="Endtime" size="20" maxlength="20">
        时间格式:2005-1-31 </td>
    </tr>
    <tr>
      <td height="12" align="right" class="forumRow">点击总数:</td>
      <td height="12" class="forumRow"><input name="Hits" type="text" id="Hits" value="0" size="10" maxlength="10">
        (作弊)</td>
    </tr>
    <tr align="center">
      <td height="24" colspan="2" class="forumRow"><input type="submit" name="Submit" value="提交"></td>
    </tr>
  </form>
</table>
<%end sub
sub saveadd()
dim title,boardid,Picurl,Url,addtime,endtime,hits
Title=checkStr(trim(request("Title")))
boardid=checkStr(trim(request("boardid")))
Picurl=checkStr(trim(request("Picurl")))
Url=checkStr(trim(request("Url")))
Addtime=checkStr(trim(request("Addtime")))
Endtime=checkStr(trim(request("Endtime")))
Hits=checkStr(trim(request("Hits")))
if Title="" or strLength(Title)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告说明不能为空长度不大于200个字符,请重新输入!</li>"
   end if
if Picurl="" or strLength(Picurl)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告图片地址不能为空长度不大于200个字符,请重新输入!</li>"
   end if
   Picurl=replace(Picurl,"../","")
if Url="" or strLength(Url)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告地址不能为空长度不大于200个字符,请重新输入!</li>"
   end if
if Addtime="" or isdate(Addtime)=false then
   founderr=true
   errmsg=errmsg & "<br><li>添加时间不能为空的日期型数字,请重新输入!</li>"
   end if
if Endtime="" or isdate(Endtime)=false then
   founderr=true
   errmsg=errmsg & "<br><li>到期时间不能为空的日期型数字,请重新输入!</li>"
   end if
if Hits="" or isnumeric(Hits)=false then
   founderr=true
   errmsg=errmsg & "<br><li>点击数不能为空的数字,请重新输入!</li>"
   end if
if founderr=true then
Call WriteErrMsg()
response.end
end if
if founderr=false then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select boardid,Title,Url,Picurl,Hits,addtime,endtime from Ms_ads where boardid="&boardid&""
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
response.write("<script>alert('该版块已经有广告了!');location.href='admin_ads.asp?action=addnew'</script>")
   response.end
else
rs.addnew
rs("boardid")=boardid
rs("Title")=Title
rs("Url")=Url
rs("Picurl")=Picurl
rs("Hits")=Hits
rs("addtime")=addtime
rs("endtime")=endtime
rs.update()
rs.close
response.write("<script>alert('您已经成功添加广告了!');location.href='admin_ads.asp?action=addnew'</script>")
   response.end
end if
end if
end sub%>

<%sub etable()
dim Gid
Gid=checkStr(trim(request("Gid")))
Gid=cint(Gid)
Set rsg = Server.CreateObject("ADODB.Recordset")
sql="select BoardID,Title,Url,Picurl,Hits,Addtime,Endtime from Ms_ads where GID="&GID&""
rsg.open sql,conn,1,1
if not (rsg.eof and rsg.bof) then
boardid=rsg("boardid")
Title=rsg("Title")
Url=rsg("Url")
Picurl=rsg("Picurl")
Hits=rsg("Hits")
addtime=rsg("addtime")
endtime=rsg("endtime")
else
response.write("<script>alert('没有该广告,请先添加!');location.href='admin_ads.asp?action=addnew'</script>")
   response.end
end if
rsg.close%>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="3" class="tableBorder">
  <form name="formadd" method="post" action="Admin_ads.asp?action=saveedit">
    <tr align="center">
      <td height=25 colspan="2" class="bodytitle">广告<b>修改</b></td>
    </tr>
    <tr>
      <td width="24%" height="24" align="right" class="forumRow">广告说明:</td>
      <td width="76%" class="forumRow"> <input name="Title" type="text" id="Title" size="30" maxlength="200" value="<%=Title%>"><input name="Gid" type="hidden" id="Gid" value="<%=Gid%>">  
      </td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">版块名称:</td>
      <td height="24" class="forumRow"><select name="boardid" size=1>
          <option value=0>论坛首页</option>
          <%=boardlist%>
        </select></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">广告图片:</td>
      <td height="24" class="forumRow"><input name="Picurl" type="text" id="Picurl" size="30" maxlength="200"  value="<%=Picurl%>"><input name="oldpic" type="hidden" id="oldpic" value="<%=Picurl%>">
        <input type="button" name="Submit" value="上  传" onClick="window.open('upload_flash.asp?formname=formadd&editname=Picurl&uppath=../<%=SaveUpFilesPath%>','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">点击地址:</td>
      <td height="24" class="forumRow"><input name="Url" type="text" id="Url" size="30" maxlength="200" value="<%=Url%>">
        点击广告要访问的网页</td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">开始时间:</td>
      <td height="24" class="forumRow"><input name="Addtime" type="text" id="Addtime" value="<%=Addtime%>" size="20" maxlength="20">
        时间格式:2005-1-31 </td>
    </tr>
    <tr>
      <td height="11" align="right" class="forumRow">结束时间:</td>
      <td height="11" class="forumRow"><input name="Endtime" type="text" id="Endtime" size="20" maxlength="20" value="<%=Endtime%>">
        时间格式:2005-1-31 </td>
    </tr>
    <tr>
      <td height="12" align="right" class="forumRow">点击总数:</td>
      <td height="12" class="forumRow"><input name="Hits" type="text" id="Hits" size="10" maxlength="10" value="<%=Hits%>">
        (作弊)</td>
    </tr>
    <tr align="center">
      <td height="24" colspan="2" class="forumRow"><input type="submit" name="Submit" value="修改"></td>
    </tr>
  </form>
</table>
<%end sub

sub saveedit()
Gid=checkStr(trim(request("Gid")))
oldpic=checkStr(trim(request("oldpic")))
Title=checkStr(trim(request("Title")))
boardid=checkStr(trim(request("boardid")))
Picurl=checkStr(trim(request("Picurl")))
Url=checkStr(trim(request("Url")))
Addtime=checkStr(trim(request("Addtime")))
Endtime=checkStr(trim(request("Endtime")))
Hits=checkStr(trim(request("Hits")))
if Title="" or strLength(Title)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告说明不能为空长度不大于200个字符,请重新输入!</li>"
   end if
if Picurl="" or strLength(Picurl)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告图片地址不能为空长度不大于200个字符,请重新输入!</li>"
   end if
   Picurl=replace(Picurl,"../","")
if Url="" or strLength(Url)>200 then
   founderr=true
   errmsg=errmsg & "<br><li>广告地址不能为空长度不大于200个字符,请重新输入!</li>"
   end if
if Addtime="" or isdate(Addtime)=false then
   founderr=true
   errmsg=errmsg & "<br><li>添加时间不能为空的日期型数字,请重新输入!</li>"
   end if
if Endtime="" or isdate(Endtime)=false then
   founderr=true
   errmsg=errmsg & "<br><li>到期时间不能为空的日期型数字,请重新输入!</li>"
   end if
if Hits="" or isnumeric(Hits)=false then
   founderr=true
   errmsg=errmsg & "<br><li>点击数不能为空的数字,请重新输入!</li>"
   end if
if founderr=true then
Call WriteErrMsg()
response.end
end if
if founderr=false then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select boardid,Title,Url,Picurl,Hits,addtime,endtime from Ms_ads where Gid="&Gid&""
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
rs("boardid")=boardid
rs("Title")=Title
rs("Url")=Url
'***************************************
    '删除无用的上传文件
    if left (Picurl,3)<>"htt" then
    if ObjInstalled=True and oldpic<>"" then
        dim fso,strRubbishFile
        Set fso = Server.CreateObject("Scripting.FileSystemObject")
            if oldpic<>Picurl then
                strRubbishFile=server.MapPath("../" & oldpic)
                if fso.FileExists(strRubbishFile) then
                    fso.DeleteFile(strRubbishFile)
                    response.write "<br><li>" & oldpic & "在广告中没有用到,所以已经被删除!</li>"
        end if
        end if
        set fso=nothing
    end If
    end if
    '结束
    '***************************************
rs("Picurl")=Picurl
rs("Hits")=Hits
rs("addtime")=addtime
rs("endtime")=endtime
rs.update()
rs.close
response.write("<script>alert('您已经成功修改广告了!');location.href='admin_ads.asp'</script>")
   response.end
else
response.write("<script>alert('广告不存在!');location.href='admin_ads.asp'</script>")
   response.end
end if
end if
end sub

sub view()
dim Gid
Gid=checkStr(trim(request("Gid")))
Gid=cint(Gid)
Set rsg = Server.CreateObject("ADODB.Recordset")
sql="select BoardID,Title,Url,Picurl,Hits,Addtime,Endtime from Ms_ads where GID="&GID&""
rsg.open sql,conn,1,1
if not (rsg.eof and rsg.bof) then
boardid=rsg("boardid")
Title=rsg("Title")
Url=rsg("Url")
Picurl=rsg("Picurl")
Hits=rsg("Hits")
addtime=rsg("addtime")
endtime=rsg("endtime")
else
response.write("<script>alert('没有该广告,请先添加!');location.href='admin_ads.asp?action=addnew'</script>")
   response.end
end if
rsg.close%>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="3" class="tableBorder">
    <tr align="center">
      <td height=25 colspan="2" class="bodytitle">广告<b>查看</b></td>
    </tr>
    <tr>
      <td width="24%" height="24" align="right" class="forumRow">广告说明:</td>
      <td width="76%" class="forumRow"><%=Title%> </td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">版块名称:</td>
      <td height="24" class="forumRow"><%Call boardidt(boardid)%></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">广告图片:</td>
      <td height="24" class="forumRow"><img src=<%=Picurl%> border=0></td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">点击地址:</td>
      <td height="24" class="forumRow"><%=Url%> </td>
    </tr>
    <tr>
      <td height="24" align="right" class="forumRow">开始时间:</td>
      <td height="24" class="forumRow"><%=Addtime%></td>
    </tr>
    <tr>
      <td height="11" align="right" class="forumRow">结束时间:</td>
      <td height="11" class="forumRow"><%=Endtime%></td>
    </tr>
    <tr>
      <td height="12" align="right" class="forumRow">点击总数:</td>
      <td height="12" class="forumRow"><%=Hits%></td>
    </tr>
    <tr align="center">
      <td height="24" colspan="2" class="forumRow"></td>
    </tr>
</table>
<%end sub%>
</body>
</html>
<%sub boardidt(BoardID)
if BoardID<>0 then
Set rsb = Server.CreateObject("ADODB.Recordset")
sql="select BoardType from Ms_Board where BoardID="&BoardID&""
rsb.open sql,conn,1,1
if not (rsb.eof and rsb.bof) then
response.Write(""&rsb("BoardType")&"")
end if
rsb.close
else
response.Write("论坛首页")
end if
end sub
end if%>
搜索更多相关主题的帖子: 办法 调试 
2010-11-17 13:01
jun81340
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-11-17
收藏
得分:0 
有兴趣想研究的朋友,加我QQ1344231589  我可以给你整个系统的所有源文件.
2010-11-17 14:07
北京的晚秋
Rank: 4
来 自:北京
等 级:业余侠客
帖 子:94
专家分:247
注 册:2010-11-14
收藏
得分:10 
...

出生在北京的晚秋时节,于是遍爱上了这个季节
2010-11-17 20:10
yukai621
Rank: 2
等 级:论坛游民
威 望:1
帖 子:27
专家分:71
注 册:2010-8-13
收藏
得分:10 
asp
2010-11-19 09:46
快速回复:谁能帮忙调试这段程序吗?实在是没办法了.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035579 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved