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

📄 cityedit.asp

📁 一个综合类整站
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%if session("china_admin")="" then
response.redirect "login.asp"
end if%>
<%dim action,id,dcity
id=request.QueryString("id")
action=request.querystring("action")
dcity=trim(request("city"))
dcityadmin=trim(request("cityadmin"))
dcitypass=HtmlEncode(trim(request.form("citypass")))
if dcity="" and action<>"" then
	response.write "<script LANGUAGE='javascript'>alert('请认真填写!');history.go(-1);</script>"
	response.end
end if
select case action
case "add" 
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from china_city where city='"&dcity&"' and threeid=0 and twoid=0",conn,1,1
if rs.EOF and rs.BOF then
           rs.close
		   rs.open "select * from china_city 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_city",conn,1,3
rs.AddNew
rs("id")=id
rs("city")=dcity
rs("cityadmin")=dcityadmin
rs("citypass")=md5(dcitypass)
rs("indexid")=trim(request("indexid"))
rs("indexshow")=trim(request("indexshow"))
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_city where twoid=0 and id="&id,conn,1,3
ycity=rs("city")
rs("city")=dcity
rs("cityadmin")=dcityadmin
rs("indexid")=trim(request("indexid"))
rs("indexshow")=trim(request("indexshow"))
if dcitypass<>rs("citypass") then
rs("citypass")=md5(dcitypass)
end if
rs.Update
rs.Close
set rs=nothing
sql="update china_data set city_one='"&dcity&"' where city_oneid="&id&" and city_twoid=0"
conn.execute sql

case "del"
set rs=server.CreateObject("adodb.recordset")
conn.execute ("delete from china_city where id="&id&"")
sql="select * from china_data where city_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
end if
rs.close
sql="select * from news_data where city_oneid ="&id&""
rs.open sql,conn,3,2
if not rs.eof then
 For iPage = 1 To rs.recordcount
 adid=rs("adid")
  pic=rs("pic")
rs.delete
rs.update
sql1="delete from news_message where adid ="&adid&""    
conn.execute(sql1)
rs.movenext  
   '''''''''''删除html开始''''''''''''''''
              tempImageDir = Server.MapPath("../html/news/"&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 end if
next
end if
set fdel=nothing
rs.close
set rs=nothing                          
conn.close   
set conn=nothing 
response.Redirect "cityedit.asp" 
end select
%>
<html>

<head>
<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>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>


<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">一&nbsp;级&nbsp;地 区 分 类 管 理</font></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> &nbsp;&nbsp;首页<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>
          <td>管理操作</td>
        </tr>
        <%set rs=server.CreateObject("adodb.recordset")
		  rs.Open "select * from china_city where id>0 and twoid=0 order by id",conn,1,1
		  dim follows
		  if rs.EOF and rs.BOF then
          response.write"<tr bgcolor=#FFFFFF><td colspan='5'><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="?action=edit&id=<%=int(rs("id"))%>">
          <tr bgcolor="#FFFFFF" align="center"> 
            <td><%=i%></td>
            <td>
              <input name="city" type="text" id="city" value="<%=trim(rs("city"))%>" size="8">
              [<a href="cityedit_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>
              <input name="cityadmin" type="text" id="cityadmin" value="<%=trim(rs("cityadmin"))%>" size="12">
            </td>
            <td>
              <input name="citypass" type="password" id="citypass" value="<%=trim(rs("citypass"))%>" size="12">
            </td>
            <td>
              <input type="submit" name="Submit" value="修 改">
              &nbsp; 
              <input type="button" name="DEL" onclick="{if(confirm('确定要删除这个地区分类吗?\n将删除此分类下所有信息\n此操作不可以恢复!')){location.href='?city=<%=rs("city")%>&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">添 加 一&nbsp;级&nbsp;地 区</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>
          <td>确定操作</td>
        </tr>
        <form name="form1" method="post" action="?action=add">
          <tr align="center" bgcolor="#FFFFFF"> 
            <td><%=rs.RecordCount+1%></td>
            <td>
              <input name="city" type="text" id="city" 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>
              <input name="cityadmin" type="text" id="cityadmin" size="12">
            </td>
            <td>
              <input name="citypass" type="password" id="citypass" size="12">
            </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 + -