⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.asp

📁 一个漂亮的网络工作室源码 后台地址:/admin 用户名:admin 密码:admin888
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
If Cint(AdminGroup(1))<>1 then
Response.Redirect("Default.asp")
Response.End()
End If
%>
<!--#include file="md5.asp"-->
<!--#include file="top.asp"-->
<table border="0" align="center" cellpadding="0" cellspacing="1" class="tablecolor">
  <tr> 
          
    <td height="25" align="center" class="banner"><a href="list.asp">栏目管理</a></td>
          
    <td width="20%" align="center" class="banner"><a href="?action=add">添加栏目</a></td>
  </tr>
</table>
<%
select case request("action")
case "del"
call del()
case "delall"
call delall()
case "add"
call add()
case "saveedit"
call saveedit()
case else
call normal()
end select

sub normal()
dim strFileName,listid,language
listid=request("listid")
if language="" then
language=0
end if
strFileName="list.asp?listid=" & listid
pageno=15
dim rs,p_i
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from list order by addtime desc",conn,1,1
rscount=rs.recordcount
%>
<table border="0" align="center" cellpadding="0" cellspacing="1" class="tablecolor">
  <%
   if  rscount<1 then
  %>
  <tr> 
    <td height="25" colspan="6" align="center" class="tablebody">目前还没有栏目!</td>
  </tr>
<%
else
%>
  <tr> 
    <td width="0%" height="25" align="center" class="tablebody">编号</td>
    <td align="center" class="tablebody">栏目名称</td>
    <td width="15%" align="center" class="tablebody">等级</td>
    <td width="15%" align="center" class="tablebody">版本</td>
    <td width="10%" align="center" class="tablebody">修改</td>
    <td width="10%" align="center" class="tablebody">删除</td>
  </tr>
<%
call showsql(pageno)
rs.move(rsno)
for p_i=1 to loopno
%>
   <tr> 
    <td height="25" align="center" class="tablebody"><%=rs("id")%></td>
    <td align="center" class="tablebody"><a href="news.asp?listid=<%=rs("id")%>"><%=htmlcode(rs("title"))%></a></td>
    <td align="center" class="tablebody"><%if rs("groupid")=1 then response.Write("会员区") else response.Write("普通区") end if%></td>
    <td align="center" class="tablebody"><%if rs("yy")=0 then response.Write("中文版") else response.Write("英文版") end if%></td>
    <td align="center" class="tablebody"><a href="?action=add&id=<%=rs("id")%>">修改</a></td>
    <td align="center" class="tablebody"><a onClick="if (confirm('删除该栏目将删除该栏目数据,是否继续?')!=0){window.location='?action=del&id=<%=rs("id")%>'};" href="#">删除</a></td>
  </tr>
   <%
  rs.movenext
  next
  %>
  <tr><td colspan="6" align="right"  class="tablebody"><%call showpage(strFileName,rscount,pageno,false,true,"个类别")%></td>
  </tr>
  <% end if%>
</table>
<%end sub
sub add()
dim title,groupid,id,language 
id=request("id")
if id<>"" then
if not isnumeric(id) then
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end if
dim rs
set rs=conn.execute("select * from list where id="&clng(id))
if rs.bof and rs.eof then
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end if
title=rs("title")
groupid=rs("groupid")
language=rs("yy")
rs.close
set rs=nothing
end if
if language="" then language=0
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <tr> 
    <td height="25" align="center" class="tablebody" colspan="2">
	<%if title="" then 
	response.Write("栏目添加") 
	else
	response.Write("栏目修改") end if%></td>
  </tr>
  <form name="form1" method="post" action="?action=saveedit">
    <tr > 
      <td width="30%" align="center" class="tablebody">栏目名称:</td>
      <td class="tablebody"><input name="title" type="text" id="adminname" value="<%=title%>" maxlength="50"></td>
    </tr>
	    <tr > 
      <td width="150" align="center" class="tablebody">等级:</td>
      <td class="tablebody">
	  <select name="groupid" id="groupid">
	  <%if groupid<>"" then%>
	  <option value=<%=groupid%>><%if groupid=1 then response.Write("会员区") else response.Write("普通区") end if%></option><%end if%>
          <option value="1">会员区</option>
          <option value="0">普通区</option>
        </select></td>
    </tr>
	    <tr >
	      <td align="center" class="tablebody">版本:</td>
          <td class="tablebody"><select name="language" id="language">
            <option value="0" <%if language =0 then response.Write("selected") end if%>>中文版</option>
            <option value="1" <%if language =1 then response.Write("selected") end if%>>英文版</option>
          </select></td>
    </tr>
	<tr> 
      <td class="tablebody">&nbsp;</td>
      <td class="tablebody"><input type="hidden" name="id" value="<%=id%>"> <input type="submit" name="Submit" value="提交"> 
        <input type="reset" name="Submit2" value="重写"></td>
    </tr>
  </form>
</table>
<% end sub
sub saveedit()
dim id,title,groupid,language
id=request("id")
title=checkStr(request.Form("title"))
groupid=cint(Request.Form("groupid"))
language=cint(Request.Form("language"))
'response.Write(language)
'response.End()
if title="" then
response.Write("<script>alert('栏目名称不能为空!');history.back()</script>")
response.End()
end if
if id="" then
'//判断栏目是否存在
dim rs
set rs=conn.execute("select id,title from list where title='"&title&"'")
if not rs.eof then
response.Write("<script>if(confirm('该栏目已存在,是否删除该栏目数据?')!=0) window.location='list.asp?action=delall&listid="&rs("id")&"';else history.back()</script>")
response.end()
end if
rs.close
set rs=nothing
conn.execute("insert into list (title,yy,groupid,userid) values('"&title&"',"&language&","&groupid&","&cint(request.Cookies("admin")("userid"))&")")
response.Write("<script>alert('添加成功!');location='list.asp'</script>")
response.End()
else
conn.execute("update list set title='"&title&"',yy="&language&",groupid="&groupid&" where id="&clng(id))
response.Write("<script>alert('修改成功!');location='list.asp'</script>")
response.End()
end if
end sub

sub del()
dim id
id=request("id")
if id="" or not isnumeric(id) then
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end if
conn.execute("delete from list where id="&clng(id))
response.Write("<script>alert('删除成功!');location='list.asp'</script>")
response.End()
end sub

sub delall()
dim listid
listid=request("listid")
if listid="" or not isnumeric(listid) then
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end if
conn.execute("delete from news where listid="&clng(listid))
response.Write("<script>alert('删除成功!');location='list.asp'</script>")
response.End()
end sub
%>
<%CloseConn%>
<!--#include file="end.asp"-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -