www.gusucode.com > 盐城分类信息网asp源码程序 > admin/xinxi_edit.asp

    <!--#include file="conn.asp"-->
<!--#include file=cookies.asp-->
<!--#include file=../config.asp-->

<%
if request("cnmai")="edit" then
function chkcnmai(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("cnmai")("username")
class1=trim(request("class1"))
class2=trim(request("class2"))
biaoti=trim(request("biaoti"))
memo=trim(request("memo"))
name=trim(request("name"))
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
chkcnmai(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
id=trim(request("id"))
set rs=server.createobject("adodb.recordset")
sql = "select * from xinxi where id="&cstr(id)
rs.open sql,conn,1,3
if rs.eof then
errcnmai(0)
response.end
end if
rs("class1")=class1
rs("class2")=class2
rs("biaoti")=biaoti
rs("leixing")=request("leixing")
rs("diqu")=trim(request("diqu"))
rs("memo")=memo
rs("tupian")=request("tupian")
rs("name")=name
rs("com")=request("com")
rs("email")=trim(request("email"))
rs("qq")=trim(request("qq"))
rs("dianhua")=trim(request("dianhua"))
rs("dizhi")=trim(request("dizhi"))
rs("yz")=request("d")
rs("tuijian")=request("tui")
rs.update
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=xinxi.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">
<style type="text/css">
<!--
body {
	background-color: #E7EEF5;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>
<body>
<div align="center">
<center>
<form action="xinxi_edit.asp?cnmai=edit" name="myform" method="POST">
<tr> 
<td width="456">
<table width="88%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4"> 
<td height="25" bgcolor="#C5D5E4" colspan="2"  align="center" >
<p><b>修改信息</b></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
信息类别:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<%
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
id=trim(request("id"))
set rs=server.createobject("adodb.recordset")
sql = "select * from xinxi 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=rs("memo")
name=rs("name")
com=rs("com")
email=rs("email")
qq=rs("qq")
dianhua=rs("dianhua")
dizhi=rs("dizhi")
tupian=rs("tupian")
yz=rs("yz")
tuijian=rs("tuijian")
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 width="103" height="25" align="right" bgcolor="#D8E1EB" >
信息标题:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" maxlength="40" name="biaoti" size="47" value="<%=biaoti%>">(<font color="#CC5200">40字以内</font>)</td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
交易类型:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
              <input type="text" name="leixing" size="12" maxlength="6" value="<%=leixing%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
交易地区:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="diqu" size="12" maxlength="10" value="<%=diqu%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
<p>信息说明:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<textarea rows="11" name="memo" cols="62"><%=memo%></textarea></td>
</tr>
<tr>
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
联系人:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<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 width="103" height="25" align="right" bgcolor="#D8E1EB" >
email:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="email" size="23" maxlength="40" value="<%=email%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
QQ:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="qq" size="23" maxlength="40" value="<%=qq%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
联系电话:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="dianhua" size="23" maxlength="40" value="<%=dianhua%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
图片地址:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="tupian" size="41" value="<%=tupian%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
联系地址:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<input type="text" name="dizhi" size="41" maxlength="40" value="<%=dizhi%>"></td>
</tr>
<tr> 
<td width="103" height="25" align="right" bgcolor="#D8E1EB" >
审核验证:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<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 width="103" height="25" align="right" bgcolor="#D8E1EB" >
推荐:</td>
<td width="410" height="25" bgcolor="#EAEFF4"  >
<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"  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" bordercolor="#999999">
<p align="center">
<input type="submit" value=" 提交修改 " name="B1"></td>
</tr>
                                        
</table>
</td>
</tr>
</form>
</center>
</div>
</body>
</html>
<%
closedb
end if
%>