📄 typeedit.asp
字号:
<!--#include file="conn.asp"-->
<%if session("china_admin")="" then
response.redirect "login.asp"
end if%>
<%dim action,id,dname
id=request.QueryString("id")
action=request.querystring("action")
dname=trim(request("name"))
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from china_type where name='"&dname&"' and threeid=0 and twoid=0",conn,1,1
if rs.EOF and rs.BOF then
rs.close
rs.open "select * from china_type where threeid=0 and twoid=0 order by id desc",conn,1,1
if rs.eof and rs.bof then
id=1
else
id=rs("id")+1
end if
rs.close
rs.open "china_type",conn,1,3
rs.AddNew
if id=0 then
rs("id")=1
else
rs("id")=id
end if
rs("name")=dname
rs("indexid")=trim(request("indexid"))
rs("indexshow")=trim(request("indexshow"))
if request("colorshow")="1" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#000000"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="2" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#ffffff"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="3" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#990000"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="4" then
rs("trcolor")="#f7ffe1"
rs("tdcolor")="#92dcb9"
rs("titlecolor")="#009900"
rs("telcolor")="#246838"
end if
if request("colorshow")="5" then
rs("trcolor")="#e6faff"
rs("tdcolor")="#91b9dd"
rs("titlecolor")="#0066cc"
rs("telcolor")="#0066cc"
end if
if request("colorshow")="6" then
rs("trcolor")="#ffe1fb"
rs("tdcolor")="#b021c5"
rs("titlecolor")="#cc33cc"
rs("telcolor")="#990099"
end if
rs.Update
rs.Close
set rs=nothing
else
response.write "<script>window.alert('你输入的一级目录名称:"&dname&"已经有了!');history.go(-1);</script>"
end if
case "edit"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from china_type where twoid=0 and id="&id,conn,1,3
yname=rs("name")
rs("name")=dname
rs("indexid")=trim(request("indexid"))
rs("indexshow")=trim(request("indexshow"))
if request("colorshow")="1" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#000000"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="2" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#ffffff"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="3" then
rs("trcolor")="#ffe8e8"
rs("tdcolor")="#dd91a5"
rs("titlecolor")="#990000"
rs("telcolor")="#ff0000"
end if
if request("colorshow")="4" then
rs("trcolor")="#f7ffe1"
rs("tdcolor")="#92dcb9"
rs("titlecolor")="#009900"
rs("telcolor")="#246838"
end if
if request("colorshow")="5" then
rs("trcolor")="#e6faff"
rs("tdcolor")="#91b9dd"
rs("titlecolor")="#0066cc"
rs("telcolor")="#0066cc"
end if
if request("colorshow")="6" then
rs("trcolor")="#ffe1fb"
rs("tdcolor")="#b021c5"
rs("titlecolor")="#cc33cc"
rs("telcolor")="#990099"
end if
rs.Update
rs.Close
set rs=nothing
sql="update china_data set type_one='"&dname&"' where type_oneid="&id&" and type_twoid=0"
conn.execute sql
case "del"
set rs=server.CreateObject("adodb.recordset")
conn.execute ("delete from china_type where id="&id&"")
sql="select * from china_data where type_oneid = "&id&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
Set fdel = CreateObject("Scripting.FileSystemObject")
if not rs.eof then
For iPage = 1 To rs.recordcount
adid=rs("adid")
pic=rs("pic")
rs.delete
rs.update
sql1="delete from china_message where adid ="&adid&""
conn.execute(sql1)
rs.movenext
'''''''''''删除html开始''''''''''''''''
tempImageDir = Server.MapPath("../html/"&adid&".htm")
fdel.DeleteFile(tempImageDir)
if pic<>"" and lcase(left(pic,7))<>"http://" then
fdel.DeleteFile(Server.MapPath("../adpic/"&pic&""))
end if
'''''''''''删除html结束'''''''''''''''
if rs.eof then exit for
next
set fdel=nothing
rs.close
set rs=nothing
end if
conn.close
set conn=nothing
response.Redirect "typeedit.asp"
end select
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>分类管理</title>
</head>
<body background="images/background.gif">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
<tr>
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">一 级 分 类 栏 目 管 理</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> 首页 <br>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
<tr align="center" bgcolor="#FFFFFF" height="20">
<td width="30">编号</td>
<td>分类名称</td>
<td>显示顺序</td>
<td>首页显示</td>
<td>首页配色</td>
<td>管理操作</td>
</tr>
<%set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from china_type where twoid=0 and id>0 order by id",conn,1,1
dim follows
if rs.EOF and rs.BOF then
response.write"<tr bgcolor=#FFFFFF><td colspan='6'><p align='center'><font color='red'>暂无分类!</font></td></tr></table><br>"
follows=0
else
do while not rs.EOF
i=i+1
%>
<form name="form1" method="post" action="typeedit.asp?action=edit&id=<%=int(rs("id"))%>">
<tr bgcolor="#FFFFFF" align="center">
<td><%=i%></td>
<td><input name="name" type="text" size="12" value="<%=trim(rs("name"))%>">
[<a href="typeedit_two.asp?id=<%=rs("id")%>">子目录</a>]</td>
<td><input name="indexid" type="text" size="2" value="<%=trim(rs("indexid"))%>"></td>
<td><select name="indexshow">
<option value="yes" <%if rs("indexshow")="yes" then%>selected<%end if%>>显示</option>
<option value="no" <%if rs("indexshow")="no" then%>selected<%end if%>>隐藏</option>
</select></td>
<td><select name="colorshow">
<option value="1" <%if rs("trcolor")="#ffe9e9" then%>selected<%end if%> style="COLOR:#000000;BACKGROUND-COLOR:#ffe8e8;">配色1</option>
<option value="2" <%if rs("trcolor")="#ffe8e8" then%>selected<%end if%> style="COLOR:#ffffff;BACKGROUND-COLOR:#C6C6C6;">配色2</option>
<option value="3" <%if rs("trcolor")="#ffe6e6" then%>selected<%end if%> style="COLOR:#990000;BACKGROUND-COLOR:#ffe7e7;">配色3</option>
<option value="4" <%if rs("trcolor")="#f7ffe1" then%>selected<%end if%> style="COLOR:#009900;BACKGROUND-COLOR:#f7ffe1;">配色4</option>
<option value="5" <%if rs("trcolor")="#e6faff" then%>selected<%end if%> style="COLOR:#0066cc;BACKGROUND-COLOR:#e6faff;">配色5</option>
<option value="6" <%if rs("trcolor")="#ffe1fb" then%>selected<%end if%> style="COLOR:#cc33cc;BACKGROUND-COLOR:#ffe1fb;">配色6</option>
</select></td>
<td><input type="submit" name="Submit" value="修 改">
<input type="button" name="DEL" onclick="{if(confirm('确定要删除这个分类吗?\n将删除此分类下所有信息\n此操作不可以恢复!')){location.href='?name=<%=rs("name")%>&action=del&id=<%=rs("id")%>';}return false;}" value="删除" >
</td>
</tr>
</form>
<%
rs.MoveNext
loop
follows=rs.RecordCount
end if%>
</table>
<br></td>
</tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
<tr>
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">添 加 一 级 分 类 名 称</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<br>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
<tr align="center" bgcolor="#FFFFFF" height="20">
<td width="30">编号 </td>
<td>分类名称</td>
<td>显示顺序</td>
<td>首页显示</td>
<td>首页配色</td>
<td>确定操作</td>
</tr>
<form name="form1" method="post" action="typeedit.asp?action=add">
<tr align="center" bgcolor="#FFFFFF">
<td><%=rs.RecordCount+1%></td>
<td><input name="name" type="text" id="name" size="12"></td>
<td><input name="indexid" type="text" value="0" size="2"></td>
<td><select name="indexshow">
<option value="yes" selected>显示</option>
<option value="no">隐藏</option>
</select></td>
<td><select name="colorshow">
<option value="1" style="COLOR:#000000;BACKGROUND-COLOR:#ffe8e8;">配色1</option>
<option value="2" style="COLOR:#ffffff;BACKGROUND-COLOR:#C6C6C6;" selected>配色2</option>
<option value="3" style="COLOR:#009900;BACKGROUND-COLOR:#f7ffe1;">配色3</option>
<option value="4" style="COLOR:#009900;BACKGROUND-COLOR:#f7ffe1;">配色4</option>
<option value="5" style="COLOR:#0066cc;BACKGROUND-COLOR:#e6faff;">配色5</option>
<option value="6" style="COLOR:#cc33cc;BACKGROUND-COLOR:#ffe1fb;">配色6</option>
</select></td>
<td><input type="submit" name="Submit3" value="添 加"></td>
</tr>
</form>
</table>
<br></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -