<!--#include file="conn.asp"-->
<!--#include file=cookies.asp-->
<!--#include file=config.asp-->
<!--#include file="../inc/function.asp"-->
<%
if request("jle")="edit" then
function fsow(filename)
set mfo=Server.CreateObject("Scripting.FileSystemObject")
set rtf=mfo.OpenTextFile(server.mappath(filename),1)
body=rtf.readall
fsow=body
end function

function chkjle(char) 
if instr(char,"'") then 
response.write "错误字符！"
response.end 
end if
if instr(char,"|") then
response.write "错误字符！"
response.end 
end if
if instr(char,"<") then
response.write "错误字符！"
response.end 
end if
if instr(char,">") then
response.write "错误字符！"
response.end 
end if
if instr(char,"&") then
response.write "错误字符！"
response.end 
end if
if instr(char,"%") then
response.write "错误字符！"
response.end 
end if
if instr(char,";") then
response.write "错误字符！"
response.end 
end if
if instr(char,"$") then
response.write "错误字符！"
response.end 
end if
end function


username=request.cookies("jle")("username")
class1=trim(request("class1"))
class2=trim(request("class2"))
biaoti=HtmlEncode(trim(request("biaoti")))
memo=HtmlEncodes(trim(request("memo")))
name=HtmlEncode(trim(request("name")))
leixing=HtmlEncode(trim(request("leixing")))
diqu=HtmlEncode(trim(request("diqu")))
tupian=HtmlEncode(trim(request("tupian")))
com=HtmlEncode(trim(request("com")))
email=HtmlEncode(trim(request("email")))
qq=HtmlEncode(trim(request("qq")))
dianhua=HtmlEncode(trim(request("dianhua")))
dizhi=HtmlEncode(trim(request("dizhi")))
d=request("d")
tui=request("tui")
sj=request("sj")
b=request("b")
xurl=HtmlEncode(trim(request("xurl")))
id=trim(request("id"))

if class1="0" or class1="" then
response.write"<SCRIPT language=JavaScript>alert('请正确选择一级分类');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
if class2="0" or class2="" then
response.write"<SCRIPT language=JavaScript>alert('请正确选择二级分类');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
if biaoti=""  then
response.write"<SCRIPT language=JavaScript>alert('标题不为空');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
chkjle(biaoti)
if len(biaoti)>40 then
response.write"<SCRIPT language=JavaScript>alert('标题字数不超过40');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
if memo="" then
response.write"<SCRIPT language=JavaScript>alert('信息内容不为空');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
if trim(request("name"))="" then
response.write"<SCRIPT language=JavaScript>alert('联系人不能为空');javascript:history.go(-1)</SCRIPT>"
response.end 
end if

set rs=server.createobject("adodb.recordset")
sql = "select * from jle_info where id="&cstr(id)
rs.open sql,conn,1,3
if rs.eof then
errjle(0)
response.end
end if
rs("class1")=class1
rs("class2")=class2
rs("biaoti")=biaoti
rs("leixing")=leixing
rs("diqu")=diqu
rs("memo")=memo
rs("tupian")=tupian
rs("name")=name
rs("com")=com
rs("email")=email
rs("qq")=qq
rs("dianhua")=dianhua
rs("dizhi")=dizhi
rs("yz")=d
rs("tuijian")=tui
fbsj=now()
rs("fbsj")=fbsj
rs("sj")=sj
rs("b")=b
rs("xurl")=xurl
rs.update
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
sql = "select * from jle_info where id="&cstr(id)
rs.open sql,conn,1,1
okfile=fsow("../inc/categories_mb.html")
dim NewsFile
if right(rs("xurl"),4)="html" then
ax=left(rs("xurl"),10)
file1=server.mappath("/"&ax&"")
NewsFile2 = rs("xurl")
NewsFile=replace(NewsFile2,""&ax&"/","")
else
file1=server.mappath("/categories")
NewsFile = year(now)&month(now)&day(now)&""&rs("id")&".html"
NewsFile2="categories/"&NewsFile
end if

file2=file1&"\"&NewsFile


set rc=Server.createObject("adodb.recordset")
sql="select * from class1 where id ="&class1&""
rc.open sql,conn,1,1
dim cla1
cla1=rc("class1")
rc.close
set rc=nothing
set rc=Server.createObject("adodb.recordset")
sql="select * from class2 where id ="&class2&" "
rc.open sql,conn,1,1
dim cla2
cla2=rc("class2")
rc.close
set rc=nothing

x_id = rs("id")
ip=rs("ip")
fbsj=rs("fbsj")
okfile = replace(okfile,"X_ID",x_id)
okfile = replace(okfile,"City",city)
okfile = replace(okfile,"Class1",cla1)
okfile = replace(okfile,"C1url",class1)
okfile = replace(okfile,"Class2",cla2)
okfile = replace(okfile,"C2url",class2)
okfile = replace(okfile,"Diqu",diqu)
okfile = replace(okfile,"Leixing",leixing)
okfile = replace(okfile,"Biaoti",biaoti)
okfile = replace(okfile,"Memo",memo)
okfile = replace(okfile,"Adclass1",adclass1)
if tupian<>"" and tupian<>"0" then
if left(tupian,4)="http" then
okfile = replace(okfile,"Tupian",""&tupian&"")
okfile = replace(okfile,"TUurl",""&tupian&"")
else
okfile = replace(okfile,"Tupian","/"&tupian&"")
okfile = replace(okfile,"TUurl","/"&tupian&"")
end if
else
okfile = replace(okfile,"Tupian",ad11(0))
okfile = replace(okfile,"TUurl",ad11(1))
end if
okfile = replace(okfile,"Fbsj",fbsj)
okfile = replace(okfile,"Name",name)
okfile = replace(okfile,"Dianhua",dianhua)
if qq<>"" then
okfile = replace(okfile,"Qq",qq)
else 
okfile  =  replace(okfile,"Qq","这家伙很懒，没留下QQ。")
end if
if dizhi<>"" then
okfile = replace(okfile,"Dizhi",dizhi)
else 
okfile = replace(okfile,"Dizhi","这家伙很懒，没留下联系地址。")
end if
if email<>"" then
okfile = replace(okfile,"Email",email)
else 
okfile  =  replace(okfile,"Email","这家伙很懒，没留下邮箱。")
end if
okfile = replace(okfile,"Userip",ip)
okfile = replace(okfile,"Title",title)
okfile = replace(okfile,"Web",web)
okfile = replace(okfile,"Coryright",coryright)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(file2,true)
fout.writeline okfile
fout.close
sql="update jle_info set xurl = '"&NewsFile2&"', fbsj = '"&fbsj&"' where ID = "&rs("ID")
conn.execute(sql)

rs.close
set rs=nothing
closedb
response.write "<p align=""center"">修改<font color=ff0000>"&biaoti&"</font>成功！</p>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_information.asp"">"
else
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>信息修改</title>
<link href="inc_style.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="0" leftmargin="0">
<div class="kon"></div>
<center>
<form action="?jle=edit" name="myform" method="POST">
<tr> 
<td width="456">
<table width="93%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#c5cfe0" bordercolordark="#FFFFFF" bgcolor="#C5D5E4"  style="font-size:12px; letter-spacing:1px;">
        <tr align="center" bgcolor="#FFFFFF" height="20"> 
<td height="29" colspan="2" align="center" bgcolor="#C5D5E4">
<p><b>修改信息</b> </td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
信息类别：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<%
dim rs
dim sql,i
dim count,username
dim id,class1,class2,biaoti,jiage,diqu,memo,name,email,dianhua,qq,tupian,com,yz,tuijian,dizhi,sj
id=trim(request("id"))
set rs=server.createobject("adodb.recordset")
sql = "select * from jle_info where id="&cstr(id)
rs.open sql,conn,1,1
if rs.eof then
response.write "参数错误！"
response.end
end if
username=rs("username")
class1=rs("class1")
class2=rs("class2")
biaoti=rs("biaoti")
leixing=rs("leixing")
diqu=rs("diqu")
memo=HtmlEncodex(rs("memo"))
name=rs("name")
com=rs("com")
email=rs("email")
qq=rs("qq")
dianhua=rs("dianhua")
dizhi=rs("dizhi")
tupian=rs("tupian")
xurl=rs("xurl")
yz=rs("yz")
tuijian=rs("tuijian")
sj=rs("sj")
b=rs("b")
rs.close
sql = "select * from class2 order by paixu desc"
rs.open sql,conn,1,1
%><SCRIPT language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
        subcat[<%=count%>] = new Array("<%= trim(rs("class2"))%>","<%= trim(rs("class1"))%>","<%= trim(rs("id"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;
function changelocation(locationid)
    {
    document.myform.class2.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.class2.options[document.myform.class2.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        } 
    }    
</SCRIPT>
<%
sql = "select * from class1 order by paixu desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加分类。"
response.end
else
%>
<SELECT name="class1" onChange="changelocation(document.myform.class1.options[document.myform.class1.selectedIndex].value)" size="1">
<OPTION value="0">一级分类</OPTION>
<%do while not rs.eof%>
<OPTION  <%if trim(class1)=cstr(rs("id")) then%>selected<%end if%>  value="<%=trim(rs("id"))%>"><%=trim(rs("class1"))%></OPTION>
<%
        rs.movenext
        loop
	    end if
        rs.close
        %>
</SELECT>
<SELECT name="class2">
<%
sql = "select id,class2 from class2 where id="&cstr(class2)
rs.open sql,conn,1,1
%>
<OPTION  <%if trim(class2)=cstr(rs("id")) then%>selected<%end if%>  value="<%=trim(rs("id"))%>"><%=trim(rs("class2"))%></OPTION>
<%rs.close%>
</SELECT><input type="hidden" name="id" size="7" maxlength="6" value="<%=id%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
标题：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" maxlength="40" name="biaoti" size="47" value="<%=biaoti%>">（<font color="#CC5200">40字以内</font>）</td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
类型：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
                      <input type="text" name="leixing" size="21" maxlength="10" value="<%=leixing%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
地区：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="diqu" size="21" maxlength="10" value="<%=diqu%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
<p>信息说明：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<textarea rows="11" name="memo" cols="58"><%=memo%></textarea></td>
</tr>
<tr>
<td height="25" align="right"  class="tdbar"   >
联系人：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="name" size="23" maxlength="15" value="<%=name%>">
<input type="text" name="com" size="23" maxlength="15" value="<%=com%>"></td>
</tr>
<tr>
<td height="25" align="right"  class="tdbar"   >
email：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="email" size="23" maxlength="40" value="<%=email%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
QQ：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="qq" size="23" maxlength="40" value="<%=qq%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
联系电话：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="dianhua" size="23" maxlength="40" value="<%=dianhua%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
图片地址：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="tupian" size="41" value="<%=tupian%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
联系地址：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="dizhi" size="41" maxlength="40" value="<%=dizhi%>"></td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
审核验证：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="radio" value="1" name="d" <%if yz=1 then%>checked<%end if%> >通过</font><input type="radio" value="11" name="d" <%if yz=0 then%>checked<%end if%> >未通过</td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
推荐：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="radio" value="1" name="tui" <%if tuijian=1 then%>checked<%end if%>>推荐 
<input type="radio" name="tui" value="0" <%if tuijian=0 then%>checked<%end if%>>未推荐</td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
成为贴贴墙：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="radio" value="1" name="sj" <%if sj=1 then%>checked<%end if%>>使用 
<input type="radio" name="sj" value="0" <%if sj=0 then%>checked<%end if%>>不使用</td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
竞价信息：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="radio" value="1" name="b" <%if b=1 then%>checked<%end if%>>设为竞价 
<input type="radio" name="b" value="0" <%if b=0 then%>checked<%end if%>>取消竞价</td>
</tr>
<tr> 
<td height="25" align="right"  class="tdbar"   >
连接地址：</td>
<td height="25"  class="tdbar" style="border-right-style: solid; border-right-width: 1"  >
<input type="text" name="xurl" size="41" value="<%=xurl%>"> </td>
</tr>
<tr> 
<td height="30"  colspan="2" style="border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-width:1px; border-bottom-style:solid; border-bottom-width:1px" >
<p align="center">
<input type="submit" value=" 提交修改 " name="B1"></td>
</tr>
                                        
</table>
<div class="kon"></div>
</td>
</tr>
</form>
</center>
</body>
</html>
<%
closedb
end if
%>