www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > admin/download.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="opendb.asp" --> <% Call CheckAdmin() 'Call CnkAdminRight(1) Dim ShowLang ShowLang=Trim(Request("ShowLang")) if ShowLang<>"" then ShowLang=Clng(ShowLang) thispage=request("page_code") if thispage="" then thispage=1 else thispage=clng(thispage) end if if thispage<1 then thispage=1 PagePara="?ShowLang="&ShowLang Dim Action,Language,dlclassid,title,filename,filesize,filetype,OS,PageKeywords,PageDescription,content,recommend,id Action=Trim(Request("Action")) Language=Trim(Request.Form("Language")) dlclassid=Trim(Request.Form("dlclassid")) title=Trim(Request.Form("title")) filename=Trim(Request.Form("filename")) filesize=Trim(Request.Form("filesize")) filetype=Trim(Request.Form("filetype")) OS=Trim(Request.Form("OS")) PageKeywords=Trim(Request.Form("PageKeywords")) PageDescription=Trim(Request.Form("PageDescription")) content=Trim(Request.Form("content")) recommend=Trim(Request.Form("recommend")) id=Trim(Request("id")) Call Head() %> <script language="JavaScript"> <!-- function cform(){ if(!confirm("您确认删除吗? 请注意删除后无法恢复!")) return false; }//--> </script> <script> <!-- function validata_form() { validity=true; if (!check_empty(document.from1.title.value)) { validity=false; alert('请填标题名称'); document.from1.title.focus(); return validity; } if (!check_empty(document.from1.filename.value)) { validity=false; alert('没有上传文件'); document.from1.filename.focus(); return validity; } function check_empty(text) { return (text.length > 2); // returns false if empty } } --> </script> <body> <div class="cnkbox"> <% =GetChannelContent(ChannelID,"ChannelName")%> 管理导航: <a href="?ChannelID=<%= ChannelID %>">下载管理首页</a> | <a href="?ChannelID=<%= ChannelID %>&Action=Add">添加新下载</a></div> <% dim isen,rsp,iselect If Lang=1 then isen="_en" set rsp=server.CreateObject("ADODB.Recordset") select case Action case "saveadd" Call SaveAdd() case "savemodi" Call SaveModi() case "del" Call AdminRight("DelAdmin",ChannelID,session("admin")) Call del() case "" %> <div class="cnkbox"> <div class="title"><% =GetChannelContent(ChannelID,"ChannelName")%> 管理</div> <div class="content"> <% If Lang=2 Then %> <a href="?ChannelID=<%=ChannelID%>">显示全部</a> | <a href="?ChannelID=<%=ChannelID%>&ShowLang=0">只显示中文</a> | <a href="?ChannelID=<%=ChannelID%>&ShowLang=1">只显示英文</a> <% End If %> <% Dim ipage sql="select id,title,recommend,Lang,updatetime from cnk_download where ChannelID="&ChannelID if ShowLang<>"" then sql=sql&" and Lang="&ShowLang sql=sql&" order by updatetime desc" rs.open sql,conn,1,1 if rs.recordcount=0 then Response.Write "未有内容" Response.end else rs.pagesize=20 if thispage>rs.pagecount then thispage=rs.pagecount rs.AbsolutePage = thispage %> <table width="96%" border="0" cellpadding="3" cellspacing="1"> <tr bgcolor="#C2E0FE" align="center"> <td width="17%">更新时间</td> <td width="58%">名称</td> <td width="12%" align="center">首页显示</td> <td width="13%" align="center">操作</td> </tr> <% for ipage=1 to rs.pagesize%> <tr bgcolor="#F6F6F6" onMouseOut="mOut(this,'#F6F6F6');" onMouseOver="mOvr(this,'#EBFFBB');"> <td><%=rs("updatetime")%> </td> <td>[<% If rs("Lang")=0 Then Response.Write("中") Else Response.Write("英")%>] <a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=modi"><%=rs("title")%> </a></td> <td align="center"><% If rs("recommend")=1 Then Response.Write("是") Else Response.Write("否")%></td> <td align="center"><a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=modi">修改</a> | <a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=del" onclick="return cform()">删除</a></td> </tr> <%rs.movenext if rs.eof then exit for next%> </table> <table width="96%" height="21" border="0" background="images/bg-xg.gif" bgcolor="#EFEFEF"> <tr> <td width="50%"><% = GetPageList(rs.pagecount,thispage,PagePara,0) %></td> <td width="50%" align="right"> 共 <strong><%=rs.recordcount%></strong> 条 <% = GetPage(rs.pagecount,thispage,PagePara,0) %></td> </tr> </table> <% rs.close set rs=nothing End If %> </div> </div> <% Case "Add" Call AdminRight("AddAdmin",ChannelID,session("admin"))%> <form method="post" name="form1" action="download.asp" onSubmit="return validata_form()"> <div class="cnkbox"> <div class="title">增加下载内容</div> <div class="content"> <div id="list"> <ul> <li class="t1">选择语言:</li> <li class="t2"> <% If Lang=0 or Lang=2 Then %> <input type="radio" name="Language" value="0" id="Lang1" checked="checked" /> <label for="Lang1">中文</label> <% End If %> <% If Lang=1 or Lang=2 Then %> <input type="radio" name="Language" value="1" id="Lang2" /> <label for="Lang2">EngLish</label> <% End If %> </li> </ul> <% rs.open "select * from cnk_downloadclass order by paixu",conn,1,1 if rs.recordcount>0 then%> <ul> <li class="t1">下载类别:</li> <li class="t2"> <select name="dlclassid" class="input" id="dlclassid"> <option value="0" selected>不限类别</option> <% do while not rs.eof%> <option value="<%= rs("classid") %>"><%= rs("classname")&" "&rs("classname_en") %></option> <% rs.movenext loop rs.close %> </select> <a href="download_class.asp?ChannelID=<%= ChannelID %>">添加、修改类别</a></li> </ul> <% end if %> <ul> <li class="t1">下载名称:</li> <li class="t2"> <input name="title" type="text" class="input" id="title" size="50" maxlength="50" /> 50字符以内,如:XX系列驱动程序 </li> </ul> <ul> <li class="t1">关键词:</li> <li class="t2"> <input name="PageKeywords" type="text" class="input" id="PageKeywords" size="50" maxlength="255" /> 用逗号分隔,最多255字符 </li> </ul> <ul> <li class="t1">描述:</li> <li class="t2"> <input name="PageDescription" type="text" class="input" id="PageDescription" size="50" maxlength="255" /> 用逗号分隔,最多255字符 </li> </ul> <ul> <li class="t1">文件大小:</li> <li class="t2"> <input name="filesize" type="text" class="input" id="filesize" size="50" maxlength="50" /> 如1MB或523KB</li> </ul> <ul> <li class="t1">文件格式(类型):</li> <li class="t2"> <input name="filetype" type="text" class="input" id="filetype" value="RAR" size="50" maxlength="50" /> 如RAR/ZIP/PDF/DOC</li> </ul> <ul> <li class="t1">运行环境:</li> <li class="t2"> <input name="OS" type="text" class="input" id="OS" value="Windows9x/me/2000/XP/2003/vista" size="50" maxlength="50" /> 如Windows9x/me/2000/XP/2003/vista或Linux</li> </ul> <ul> <li class="t1">上传文件:</li> <li class="t2"> <input name="filename" type="text" class="input" id="filename" size="40" maxlength="255" /> <input name="Submit43" type="button" class="button" onClick="window.open('upload_flash.asp?formname=form1&editname=filename&uppath=download&filelx=doc','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" value="上传" /> .doc .pdf .zip .rar 或直接填站外http://完整地址<br> 如果因文件太大无法上传,建议用FTP方式上传文件到upfiles文件夹,然后把文件名填在这里 </li> </ul> <ul> <li class="t1">显示在首页:</li> <li class="t2"> <input type="radio" name="recommend" value="1"> 是 <input name="recommend" type="radio" value="0" checked> 否 </li> </ul> <ul> <li class="t1">详细说明:</li> <li class="t2"> <textarea name="content" cols="50" rows="12" class="input" id="content"></textarea> </li> </ul> <ul> <li class="t1">关联产品:</li> <li class="t2"> <select name="pid" size="10" multiple id="pid"> <% rsp.open "select id,product_name"&isen&" from cnk_products",conn,1,1 do while not rsp.eof Response.Write("<option value="""&rsp(0)&""">"&rsp(1)&"</option>"&vbcrlf) rsp.movenext loop rsp.close %> </select> 按Ctrl键可选择多个产品</li> </ul> <ul> <li class="t1"> <input name="Action" type="hidden" id="Action" value="saveadd" /> <input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" /> <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" /> </li> <li class="t2"> <input type="submit" name="Submit2" class="button" value="增加" /> </li> </ul> <div class="clearboth"></div> </div> </div> </div> </form> <% Case "modi" Call AdminRight("ModiAdmin",ChannelID,session("admin")) rs.open "select * from cnk_download where id="&id,conn,1,1 %> <form name="form1" method="post" action="download.asp" onSubmit="return validata_form()"> <div class="cnkbox"> <div class="title"> <% =GetChannelContent(ChannelID,"ChannelName")&" -- "%> 修改文章</div> <div class="content"> <div id="list"> <ul> <li class="t1">选择语言:</li> <li class="t2"> <% If Lang=0 or Lang=2 Then %> <input type="radio" name="Language" value="0" id="Lang1" <% If rs("Lang")=0 Then Response.Write("checked=""checked""")%> /> <label for="Lang1">中文</label> <% End If %> <% If Lang=1 or Lang=2 Then %> <input type="radio" name="Language" value="1" id="Lang2" <% If rs("Lang")=1 Then Response.Write("checked=""checked""")%> /> <label for="Lang2">EngLish</label> <% End If %> </li> </ul> <% dim rs1 set rs1=server.CreateObject("ADODB.Recordset") rs1.open "select * from cnk_downloadclass order by paixu",conn,1,1 if rs1.recordcount>0 then%> <ul> <li class="t1">下载类别:</li> <li class="t2"> <select name="dlclassid" class="input" id="dlclassid"> <option value="0" selected>不限类别</option> <% do while not rs1.eof%> <option value="<%= rs1("classid") %>" <% If rs("classid")=rs1("classid") Then Response.Write("selected")%>><%= rs1("classname")&" "&rs1("classname_en") %></option> <% rs1.movenext loop rs1.close %> </select> <a href="download_class.asp?ChannelID=<%= ChannelID %>">添加、修改类别</a> </li> </ul> <% end if %> <ul> <li class="t1">下载名称:</li> <li class="t2"> <input name="title" type="text" class="input" id="title" value="<%= rs("title") %>" size="50" maxlength="50" /> 50字符以内,如:XX系列驱动程序 </li> </ul> <ul> <li class="t1">关键词:</li> <li class="t2"> <input name="PageKeywords" type="text" class="input" id="PageKeywords" value="<%= rs("Keywords") %>" size="50" maxlength="255" /> 用逗号分隔,最多255字符 </li> </ul> <ul> <li class="t1">描述:</li> <li class="t2"> <input name="PageDescription" type="text" class="input" id="PageDescription" value="<%= rs("Description") %>" size="50" maxlength="255" /> 用逗号分隔,最多255字符 </li> </ul> <ul> <li class="t1">文件大小:</li> <li class="t2"> <input name="filesize" type="text" class="input" id="filesize" value="<%= rs("filesize") %>" size="50" maxlength="50" /> 如1MB或523KB</li> </ul> <ul> <li class="t1">文件格式(类型):</li> <li class="t2"> <input name="filetype" type="text" class="input" id="filetype" value="<%= rs("filetype") %>" size="50" maxlength="50" /> 如RAR/ZIP/PDF/DOC</li> </ul> <ul> <li class="t1">运行环境:</li> <li class="t2"> <input name="OS" type="text" class="input" id="OS" value="<%= rs("OS") %>" size="50" maxlength="50" /> 如Windows9x/me/2000/XP/2003/vista或Linux</li> </ul> <ul> <li class="t1">上传文件:</li> <li class="t2"> <input name="filename" type="text" class="input" id="filename" value="<%= rs("filename") %>" size="40" maxlength="50" /> <input name="Submit43" type="button" class="button" onClick="window.open('upload_flash.asp?formname=form1&editname=filename&uppath=download&filelx=doc','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" value="上传" /> .doc .pdf .zip .rar </li> </ul> <ul> <li class="t1">显示在首页:</li> <li class="t2"> <input type="radio" name="recommend" value="1" <% If rs("recommend")=1 Then Response.Write("checked=""checked""")%>> 是 <input type="radio" name="recommend" value="0" <% If rs("recommend")=0 Then Response.Write("checked=""checked""")%>> 否 </li> </ul> <ul> <li class="t1">详细说明:</li> <li class="t2"> <textarea name="content" cols="50" rows="12" class="input" id="content"><%= rs("content") %></textarea> </li> </ul> <ul> <li class="t1">关联产品:</li> <li class="t2"> <select name="pid" size="10" multiple id="pid"> <% rsp.open "select id,product_name"&isen&" from cnk_products",conn,1,1 do while not rsp.eof if chkpid(rsp(0),rs("id"))=1 then iselect="selected" Response.Write("<option value="""&rsp(0)&""" "&iselect&">"&rsp(1)&"</option>"&vbcrlf) iselect="" rsp.movenext loop rsp.close %> </select> 按Ctrl键可选择多个产品 </li> </ul> <br /> <ul> <li class="t1"> <input name="Action" type="hidden" id="Action" value="savemodi" /> <input name="id" type="hidden" id="id" value="<%= rs("id") %>" /> <input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" /> <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" /> </li> <li class="t2"> <input name="提交" type="submit" class="button" value="提交" /> </li> </ul> <div class="clearboth"></div> </div> </div> </div> </form> <% rs.close End Select Call Foot() Call Closedb() Sub SaveAdd() sql="insert into cnk_download" sql=sql&" (ChannelID,Lang,classid,title,filename,filesize,filetype,OS,Keywords,Description,content,recommend)" sql=sql&" values ("&ChannelID&","&Language&","&dlclassid&",'"&title&"','"&filename&"','"&filesize&"','"&filetype&"','"&OS&"','"&PageKeywords&"','"&PageDescription&"','"&content&"',"&recommend&")" conn.execute(sql) if Request.Form("pid")<>"" then dim pid,rsd,did,theitem set rsd=conn.execute("select top 1 id from cnk_download order by id desc") did=rsd(0) pid=Split(Request.Form("pid"), ",") for each theitem in pid conn.execute("insert into cnk_pnd (pid,did) values ("&theitem&","&did&")") next end if Call alertmsg_url("添加成功","download.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang) End Sub Sub SaveModi() sql="update cnk_download set" sql=sql&" ChannelID="&ChannelID&",Lang="&Language&",classid="&dlclassid&",title='"&title&"',filename='"&filename&"',filesize='"&filesize&"',filetype='"&filetype&"',OS='"&OS&"',Keywords='"&PageKeywords&"',Description='"&PageDescription&"',content='"&content&"',recommend="&recommend&",updatetime='"&now()&"' where id="&id conn.execute(sql) if Request.Form("pid")<>"" then dim pid,theitem conn.execute("delete from cnk_pnd where did="&id) pid=Split(Request.Form("pid"), ",") for each theitem in pid conn.execute("insert into cnk_pnd (pid,did) values ("&theitem&","&id&")") next end if Call alertmsg_url("修改成功","download.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang) End Sub Sub del() conn.execute("delete from cnk_pnd where did="&id) conn.execute("delete from cnk_download where id="&id) Call alertmsg_url("删除成功","download.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang) End Sub function chkpid(pid,did) dim rspnd,ispid set rspnd=conn.execute("select count(*) from cnk_pnd where pid="&pid&" and did="&did) ispid=rspnd(0) if ispid>0 then chkpid=1 else chkpid=0 end if end function %>